this file describe how to install geotrek instance on makina geotrek docker server
ssh root@ip_of_server
cd /srv/geotrek
git clone https://gitlab.makina-corpus.net/geotrek/geotrek-admin-deploy-docker.git your_instance_name
cd your_instance_name
git remote add your_instance_name instance_git
git checkout -b your_instance_name your_instance_name/your_instance_name
$ su - postgres
$ psql
CREATE USER your_database_user WITH ENCRYPTED PASSWORD 'your_user_password';
CREATE DATABASE your_database WITH OWNER your_database_user;
\c your_database
CREATE EXTENSION POSTGIS;
\q
$ cp .env.dist .env
GEOTREK_VERSION=geotrek_version
POSTGRES_HOST=172.17.0.1 ( | interface_address)
POSTGRES_USER=your_database_user
POSTGRES_DB=your_database
POSTGRES_PASSWORD=your_user_password
DOMAIN_NAME=your.final.geotrek.domain
SECRET_KEY=secret-and-unique-secret-and-unique
GUNICORN_CMD_ARGS=--bind=0.0.0.0:8000 --workers=5 --timeout=600
# CONVERSION_HOST=convertit_web
# CAPTURE_HOST=screamshotter_web
For the version of geotrek check : https://hub.docker.com/r/geotrekce/admin/tags/
docker-compose run web bash exit
$ sudo nano ./var/conf/custom.py
Fix at least your :
- SRID
- SPATIAL_EXTENT
- DEFAULT_STRUCTURE_NAME
- MODELTRANSLATION_LANGUAGES
- SYNC_RANDO_OPTIONS
Use this command only if you do not use docker-compose
docker stack deploy -c docker-stack.yml your_instance_name
With docker stack :
docker exec $(docker ps -q -f name="your_instance_name_web") initial.sh
With docker-compose :
docker-compose run web initial.sh
- Edit your docker-compose.yml, change ports :
web: image: geotrekce/admin:${GEOTREK_VERSION} ports: - "127.0.0.1:<port_not_use_1>:8000" env_file: - .env volumes: - ./var:/app/src/var depends_on: - celery command: gunicorn geotrek.wsgi:application api: image: geotrekce/admin:${GEOTREK_VERSION} ports: - "127.0.0.1:<port_not_use_2>:8000" env_file: - .env volumes: - ./var:/app/src/var depends_on: - web - celery command: gunicorn geotrek.wsgi:application
- Create a symbolic link between your nginx and /etc/nginx/sites-enable/
ln -s nginx.conf /etc/nginx/sites-enable/<your_instance_name>.conf
- Rename your service :
mv your_instance_name.service <your_instance_name>.service
- Fix Working Directory in <your_instance_name>.service
WorkingDirectory=/srv/geotrek/<your_instance_name>
- Copy your service in /etc/systemd/system
cp <your_instance_name>.service /etc/systemd/system/<your_instance_name>.service
- Enable the system
systemctl enable <your_instance_name>.service
systemctl start your_instance_name
systemctl stop your_instance_name
docker stack rm your_instance_name
docker stack deploy -c docker-stack.yml your_instance_name
docker exec $(docker ps -q -f name="your_instance_name_web") update.sh
edit host's cron to run cleanup.sh
edit host's cron to run backup.sh Backup are stored in /var/backups/geotrek/your_instance_name
edit host's cron to run sync_rando.sh
Don't forget to set SYNC_RANDO_OPTIONS in custom.py to set url, portal_url, skip_tiles and other required sync settings
edit host's cron to run