User:GeoMechain/Tutorial:Install your own tasking manager

From OpenStreetMap Wiki
Jump to navigation Jump to search

The installation procedure described here is that of the HOT Tasking Manager whose source code is available on the project's github repository.

TM 4

Installation with Docker

Complete all items between the < and > symbols and delete these symbols.

$ sudo -i # root user login
$ apt-get update # update the list of files available in the APT repositories present in the configuration file 
$ apt-get upgrade # update all packages installed on the system to the latest versions

Docker Installation

$ apt-get install curl # curl installation
$ curl -fsSL https://get.docker.com/ | sh # docker download
$ systemctl enable docker # docker boot authorization
$ service docker start # docker start
$ usermod -aG docker root # access authorization to the docker group for the root user
$ service docker status # docker start check

Press Ctrl+C to exit.

Docker-Compose Installation

$ apt-get install python-pip # pip installation
$ pip install docker-compose # docker-compose installation
$ docker-compose -v # verification of docker-composer installation

Firewall Configuration

$ ufw status
$ ufw enable
$ ufw allow OpenSSH
$ ufw allow 9000 # portainer
$ ufw allow 5432 # postgresql
$ ufw allow 5000 # backend & migration
$ ufw allow 80 # traefik & frontend

To help us in the installation of the tasking manager and its monitoring we will install Portainer.

$ docker volume create portainer_data # creation of the container portainer
$ docker run -d -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce # starting the container portainer

TM Installation

$ git clone https://github.com/hotosm/tasking-manager.git --branch feature/docker # clone hotosm/tasking-manager repository
$ cd ./tasking-manager/ # go to the tasking-manager folder
$ cp example.env tasking-manager.env # copy configuration file
$ nano tasking-manager.env # edit the configuration file

Now you can edit the configuration file.

TM_APP_BASE_URL=https://tasks.<organisation name>.com/
TM_ORG_NAME="<organisation name>"
TM_ORG_CODE=<organisation code>
TM_EDITS_API_URL=https://osm-stats-production-api.azurewebsites.net/stats/<nameofyourorganisation>
TM_CONSUMER_KEY=<generated oauth key>
TM_CONSUMER_SECRET=<generated oauth secret>
TM_DEFAULT_CHANGESET_COMMENT="#{<nameofyourorganisation>}-project"
POSTGRES_DB=tasking-manager
POSTGRES_USER=<define user>
POSTGRES_PASSWORD=<define password>
POSTGRES_ENDPOINT=postgresql
POSTGRES_PORT=5432

Changing the port is recommended, in order to make it more difficult for black hats to get in (and therefore change the firewall settings).

Press Ctrl+X to exit and Y to confirm save.

$ nano docker-compose.override.yml
services:
  postgresql:
    volumes:
      - "postgresql-data:/var/lib/postgresql/data"

volumes:
  postgresql-data:
TM_APP_API_URL=https://tasks.<organisation name>.com/api
traefik.http.routers.frontend.rule=Host(`localhost`, `tasks.<organisation name>.com`)
$ nano docker-compose.yml
traefik.http.routers.backend.rule=Host(`localhost`, `tasks.<organisation name>.com`) && PathPrefix(`/api/`)
traefik.http.routers.frontend.rule=Host(`localhost`, `tasks.<organisation name>.com`)
$ make up # compilation


To fix this problem, proceed as follows:

$ find . | xargs grep 'git clone --depth=1 git://github.com/hotosm/tasking-manager.git' -sl # search all files containing the specified character string.

This command gives you several results. Now you will have to edit each of these files using nano. Then you have to replace all "git:" by "https:". Rerun the find command to check that all corrections have been made.

Now it should work better! To check this, launch the build.

$ make up # compilation

The TM should now be visible if you access the URL previously specified in the TM_APP_BASE_URL field of the tasking-manager.env file.

Log in to the tasking manager for the first time. This way your username will be registered in the internal database.

However at this stage it is not possible to create a project since our user has classic privileges (contributor). To remedy this it is necessary to edit the TM database to switch from contributor to administrator (c.f Issue #1824 on the github repository).

$ docker exec -it postgresql psql -U taskingmanager -W tasking-manager # connection to the tasking-manager database
postgres-# SELECT * FROM users; # display the list of users
postgres-# UPDATE users set role = 1, email_address = 'john.doe@company.com', is_email_verified = true WHERE username = 'JohnDoe'; # grant administrator privileges
postgres-# \q # leave postgres

You now have administrator privileges. To know the possibilities offered by this role for can read the associated documentation: Tasking Manager Administrator Guide. For classic users, a documentation also exists: Tasking Manager Mapper Guide.

However you will notice that when you create a project, the site displays you as an empty page (c.f Issue #3503 on the github repository). We need to fix this!

Switch from a local to a remote access application

See also