Installation¶
Software Requirements¶
It is recommended to run FMTM on a Linux-based machine.
This includes MacOS, but some tools must be substituted.
For Windows users, the easiest option is to use Windows Subsystem for Linux
Before you can install and use this application, you will need to have the following software installed and configured on your system:
If running Debian/Ubuntu, the install script below does this for you.
Git to clone the FMTM repository.
Docker to run FMTM inside containers.
Docker Compose for easy orchestration of the FMTM services.
This is Docker Compose V2, the official Docker CLI plugin.
i.e.
docker compose
commands, notdocker-compose
(the old tool).
Easy Install¶
On a Linux-based machine with bash
installed, run the script:
Note: it is best to run this script as a user other than root.
However, if you run as root, a user svcfmtm will be created for you.
curl -L https://get.fmtm.dev -o install.sh
bash install.sh
# Then follow the prompts
Manual Install¶
If more details are required, check out the dev docs
Table of Contents¶
- Installation
Clone the FMTM repository¶
Clone the repository to your local machine using the following command:
git clone https://github.com/hotosm/fmtm.git
# If you wish to deploy for production, change to the main branch
git checkout main
Setup Your Local Environment¶
These steps are essential to run and test your code!
1. Setup OSM OAuth 2.0¶
The FMTM uses OAuth with OSM to authenticate users.
To properly configure your FMTM project, you will need to create keys for OSM.
-
Login to OSM (If you do not have an account yet, click the signup button at the top navigation bar to create one).
Click the drop down arrow on the top right of the navigation bar and select My Settings.
-
Register your FMTM instance to OAuth 2 applications.
Put your login redirect url as
http://127.0.0.1:7051/osmauth
if running locally, or for production replace with https://{YOUR_DOMAIN}/osmauthNote:
127.0.0.1
is required for debugging instead oflocalhost
due to OSM restrictions. -
Add required permissions:
- 'Read user preferences' (
read_prefs
) - 'Send private messages to other users' (
send_messages
)
- 'Read user preferences' (
-
Now save your Client ID and Client Secret for the next step.
2. Create an .env
File¶
Environmental variables are used throughout this project.
To get started, create .env
file in the top level dir,
a sample is located at .env.example
.
This can be created interactively by running:
bash scripts/1-environment/gen-env.sh
Note: If extra cors origins are required for testing, the variable
EXTRA_CORS_ORIGINS
is a set of comma separated strings, e.g.: http://fmtm.localhost:7050,http://some.other.domainNote: It is possible to generate the auth pub/priv key manually using: openssl genrsa -out fmtm-private.pem 4096 openssl rsa -in fmtm-private.pem -pubout -out fmtm-private.pem
Start the API with Docker¶
This is the easiest way to get started with FMTM.
Docker runs each service inside containers, fully isolated from your host operating system.
Select the install type¶
Determine the what type of FMTM install you would like:
main - the latest production
staging - the latest staging
development - the latest development (warning: may be unstable)
local test - used during development, or to start a test version
The corresponding docker-compose files are:
main - deploy/compose.main.yaml
staging - deploy/compose.staging.yaml
development - deploy/compose.development.yaml
local test - compose.yaml
Set your selection to a terminal variable to make the next step easier:
export COMPOSE_FILE={your_selection}
# E.g.
export COMPOSE_FILE=deploy/compose.development.yaml
Pull the Images¶
docker compose -f "${COMPOSE_FILE}" pull
This will pull the latest containers for the branch you selected.
Build the Frontend¶
Before we can run, you need to build your version of the frontend.
This is because the frontend contains variable specific to your deployment.
docker compose -f "${COMPOSE_FILE}" build ui
Start the Containers¶
docker compose -f "${COMPOSE_FILE}" up -d
You should see the containers start up in order.
Once complete, you should now be able to navigate to the project in your browser:
https://{YOUR_DOMAIN}
# For the local test setup, this will be
http://fmtm.localhost:7050
Note: If those link doesn't work, check the logs with
docker compose logs api
.Note: Use
docker ps
to view all container names.
Setup ODK Central User (Optional)¶
The FMTM uses ODK Central to store ODK data.
- By default, the docker setup includes a Central server.
- The credentials should have been provided in your
.env
file to automatically create a user. - To create a user manually:
docker compose exec central odk-cmd --email YOUREMAIL@ADDRESSHERE.com user-create
docker-compose exec central odk-cmd --email YOUREMAIL@ADDRESSHERE.com user-promote
Note: Alternatively, you may use an external Central server and user.
Set Up Monitoring (Optional)¶
- There is an optional configuration for application monitoring via OpenTelemetry.
-
To enable this set in your
.env
file:# For OpenObserve MONITORING="openobserve" # For Sentry MONITORING="sentry"
- Check the
.env.example
for additional required parameters. - Everything should be configured for you to see endpoint calls in the selected web dashboard, providing full error tracebacks and stats.
Check Authentication (Optional)¶
Once you have deployed, you will need to check that you can properly authenticate.
-
Navigate to your frontend (e.g.
http://fmtm.localhost:7050
) -
Click the 'Sign In' button and follow the popup prompts.
-
If successful, you should see your username in the header.
-
If you see an error instead, double check your credentials and redirect URL in the openstreetmap.org settings.
Configure Custom Branding (Optional)¶
- It's possible to replace the HOTOSM logo and change the colour scheme for your deployment.
-
By default the
config.json
configuration is:{ "logoUrl": "/favicon.svg", "logoText": "Humanitarian OpenStreetMap Team", "cssFile": "https://cdn.jsdelivr.net/npm/@hotosm/ui@0.2.0-b6/dist/style.css" }
- To change the logo and styling, upload your logo and custom CSS file to a publicly accessible URL (uploading to the bundle Minio S3 bucket is a good choice).
- Then update the
config.json
values and upload this file to the location:https://s3.{YOUR_FIELDTM_DOMAIN}/fmtm-data/frontend/config.json
. - This file will be automatically picked up and used to style your application.
By default, FieldTM will fallback to the bundled
config.json
.
That's it, you have successfully set up FieldTM!!