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`


sudo su postgres
pg_dump -Fc geotrekdb > /home/sentiers/`date +%Y%m%d%H%M`-database.backup

Media files

cd Geotrek-X.Y.Z/
tar -zcvf /home/sentiers/`date +%Y%m%d%H%M`-media.tar.gz var/media/


# Folder Geotrek-X.Y.Z/
tar -zcvf /home/sentiers/`date +%Y%m%d%H%M`-conf.tar.gz etc/ geotrek/settings/

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

Extract media and configuration files :

cd Geotrek-X.Y.Z/
tar -zxvf 20140610-media.tar.gz
tar -zxvf 20140610-conf.tar.gz

Re-run ./

PostgreSQL optimization

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.