A simple docker container that run Odoo backups covering both Odoo files and PostgreSQL db.
1.2K
A simple docker container that run Odoo backups covering both Odoo files and PostgreSQL db based on docker-pg-backup. It then copy the backup files on GoogleDrive using drive cli.
There are various ways to get the image onto your system:
The preferred way (but using most bandwidth for the initial image) is to get our docker trusted build like this:
docker pull martel/odoo-backup:latest
To build the image yourself without apt-cacher (also consumes more bandwidth since deb packages need to be refetched each time you build) do:
docker build -t martel/odoo-backup .
If you do not wish to do a local checkout first then build directly from github.
git clone git://github.com/martel-innovate/odoo-backup
To create a running container do:
docker run --name="backups"\
--hostname="pg-backups" \
--link=watchkeeper_db_1:db \
-v ${PWD}/backup:/backup \
-v ${PWD}/credentials.json:/var/credentials.json \
-i -d martel/pg-backup
In this example I used a volume into which the actual backups will be stored.
You can also use the following environment variables to pass a user name and password etc for the database connection.
Example usage:
docker run -e PGUSER=bob -e PGPASSWORD=secret -e ODOO_FILES=1
-e DRIVE_DESTINATION=path -link db -i -d martel/pg-backup
One other environment variable you may like to set is a prefix for the database dumps.
Example usage:
docker run -e DUMPPREFIX=foo -link db -i -d martel/pg-backup
Here is a more typical example using docker-composer:
For docker-compose.yml:
db:
image: postgres:9.4
environment:
- POSTGRES_USER=docker
- POSTGRES_PASS=docker
dbbackups:
image: martel/pg-backup:latest
hostname: pg-backups
links:
- db:db
volumes:
- ${PWD}/backup:/var/backup
- ${PWD}/credentials.json:/var/credentials/credentials.json #TODO document how to create the file
environment:
- ODOO_FILES=0
- DRIVE_DESTINATION=path
- ODOO_FILES=0
- DRIVE_DESTINATION=path
- PGHOST=db
- PGDB=db
- PGUSER=docker
- PGPASSWORD=docker
- PGPORT=5432
Then run using:
docker-compose up -d dbbackup
Content type
Image
Digest
Size
489.4 MB
Last updated
about 8 years ago
docker pull martel/odoo-backup