xalt/postgres

By xalt

Updated 8 months ago

Image
0

10K+

Container Startup

On startup the backup server checks the variables TIMEZONE which is false by default (see the Dockerfile). If the TIME_ZONE variable has been set, it attempts to update the /etc/localtime on the container.

Adding a file called DONTSYNC tells the container never to restore a backup to this directory.

If DONTSYNC is not present and the user sets the BACKUP_HOST variable before startup, a backup is sought on the named server which is restored to the home directory defined in POSTGRES_HOME.

If BACKUP_HOST is set to a source backup server (and POSTGRES_HOME is an empty directory) then a corresponding keyfile for the ssh connection must be defined with BACKUP_KEYFILE and the user that the connect will be made as on the remote server. This user is defined with the environment variable BACKUP_USER. The path where the backup is located on the backup source also needs to be defined with the environment variable BACKUP_PATH. The backup to restored to the location POSTGRES_HOME where the data should be mounted. If POSTGRES_HOME is not empty the restore will not take place as mentioned above.

Here is an example of how the variables would look in docker-compose.yml

BACKUP_HOST=192.168.123.123
BACKUP_USER=root
BACKUP_PATH=/backup/postgres1
BACKUP_KEY_FILE=/tmp/id_rsa

If BACKUP_HOST is not defined or the restore is finished, the server startup continues to the docker image's entrypoint.

Docker Pull Command

docker pull xalt/postgres