MAINTENANCE¶
Operating system updates¶
sudo apt-get update
sudo apt-get dist-upgrade
Application backup¶
Give postgresql the right to write files in application folder :
sudo adduser postgres `whoami`
Database
sudo su postgres
pg_dump -Fc geotrekdb > /home/sentiers/`date +%Y%m%d%H%M`-database.backup
exit
Media files
cd Geotrek-X.Y.Z/
tar -zcvf /home/sentiers/`date +%Y%m%d%H%M`-media.tar.gz var/media/
Configuration
# Folder Geotrek-X.Y.Z/
tar -zcvf /home/sentiers/`date +%Y%m%d%H%M`-conf.tar.gz etc/ geotrek/settings/custom.py
Application restore¶
Create empty database :
sudo su postgres
psql -c "CREATE DATABASE ${dbname} ENCODING 'UTF8' TEMPLATE template0;"
psql -d geotrekdb -c "CREATE EXTENSION postgis;"
Restore backup :
pg_restore -d geotrekdb 20140610-geotrekdb.backup
exit
Extract media and configuration files :
cd Geotrek-X.Y.Z/
tar -zxvf 20140610-media.tar.gz
tar -zxvf 20140610-conf.tar.gz
Re-run ./install.sh
.
PostgreSQL optimization¶
- Increase
shared_buffers
andwork_mem
according to your RAM - Log long queries
- Use pg activity for monitoring
Access your database securely on your local machine (QGis)¶
Instead of opening your database to the world (by opening the port 5432 for example), you can use SSH tunnels.