Maintenance#
Application backup#
Database
sudo -u postgres pg_dump --no-acl --no-owner -Fc geotrekdb > `date +%Y%m%d%H%M`-database.backup
Media files
tar -zcvf `date +%Y%m%d%H%M`-media.tar.gz /opt/geotrek-admin/var/media/
Configuration
tar -zcvf `date +%Y%m%d%H%M`-conf.tar.gz /opt/geotrek-admin/var/conf/
Application restore#
If you restore Geotrek-admin on a new server, you will have to install PostgreSQL and PostGIS and create a database user first. Otherwise go directly to the database creation step.
Example for Ubuntu 18:
sudo apt install postgresql-10 postgresql-10-postgis-2.5
sudo -u postgres psql -c "CREATE USER geotrek PASSWORD 'geotrek';"
Create an empty database (geotrekdb
in this example):
sudo -u postgres psql -c "CREATE DATABASE geotrekdb OWNER geotrek;"
sudo -u postgres psql -d geotrekdb -c "CREATE EXTENSION postgis;"
sudo -u postgres psql -d geotrekdb -c "CREATE EXTENSION postgis_raster;"
sudo -u postgres psql -d geotrekdb -c "CREATE EXTENSION pgcrypto;"
Restore backup:
pg_restore -U geotrek -h localhost --clean --no-acl --no-owner -d geotrekdb 20200510-geotrekdb.backup
If errors persist, rename your database and recreate a fresh one, then restore.
Extract media and configuration files:
tar -zxvf 20200510-media.tar.gz
tar -zxvf 20200510-conf.tar.gz
Follow Fresh installation method. Choose to manage database by yourself.
PostgreSQL optimization#
Increase
shared_buffers
andwork_mem
according to your RAMUse pg activity for monitoring
Access your database securely on your local machine (QGIS)#
Instead of opening your database to the world (by opening the 5432 port for example), you can use SSH tunnels.
Manage Cache#
You can purge application cache with command or in admin interface
sudo geotrek clearcache --cache_name default --cache_name fat --cache_name api_v2h ori
Major evolutions from version 2.33#
From version 2.33, Geotrek-admin is packaged in a debian package. This mean several things :
a system user
geotrek
is created on install ;base code is located in
/opt/geotrek-admin
folder ;geotrek
is the new command, replacingbin/django
, and must be run in root (system usergeotrek
is used after) ;there is no more
settings.ini
but anenv
file with environment variables ;configuration files (custom.py et env), parsers and all customisation files (templates and translations) are now located in
/opt/geotrek-admin/var/conf
;we advise you to configure data synchronization in
/opt/geotrek-admin/var