Maintenance

This section covers the periodic tasks required to ensure the system remains healthy and performs optimally.

These tasks include :

  • Enabling maintenance mode when necessary

  • Cleaning up attachments

  • Clearing caches

Regular execution of these actions helps maintain system stability, performance, and data integrity.

Maintenance mode

If you want to block access to your application while you are performing maintenance tasks, you can activate the maintenance mode. This will display a message to users indicating that the application is temporarily unavailable.

sudo geotrek maintenance_mode on # activate maintenance mode
sudo geotrek maintenance_mode off # deactivate maintenance mode
docker compose run --rm web ./manage.py maintenance_mode on # activate maintenance mode
docker compose run --rm web ./manage.py maintenance_mode off # deactivate maintenance mode

PostgreSQL optimization

  • Use PGTune to generate an optimized configuration file for your PostgreSQL database

  • Increase shared_buffers and work_mem according to your RAM

  • You can use postgresql pool by overriding your custom.py file with the following content :

DATABASES['default']['OPTIONS']['pool'] = True
DATABASES['default']['CONN_MAX_AGE'] = 0

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. Follow this tutorial for more information (in french).

Manage Cache

You can purge application cache :

  • with command line :

sudo geotrek clearcache
docker compose run --rm web ./manage.py clearcache
  • in Geotrek-admin interface : https://<server_url>/admin/clearcache/