Documentation ¶
Overview ¶
The `docker-postgres` plugin for SHIELD implements backup + restore functionality specific to the `docker-boshrelease`'s cf-containers-broker, in conjunction with Postgres docker containers. It is very specific to backing up postgres docker containers on this service broker, and will likely not work with other implementations.
PLUGIN FEATURES ¶
This plugin implements functionality suitable for use with the following SHIELD Job components:
Target: yes Store: no
PLUGIN CONFIGURATION ¶
No configuration is required for this plugin, as the docker deployments are self-contained on a single VM, and all the data for backing up + restoring services can be detected automatically. Your endpoint JSON should look something like this:
{}
Default Configuration
{}
BACKUP DETAILS ¶
The `docker-postgres` plugin backs up by connecting to docker, finding all running containers, and loops through each, grabbing its connection info from docker, and runs a pg_dump on the docker database. Each dump is written into a tar archive, along with metadata about the service ID and connection info.
RESTORE DETAILS ¶
During restore, `docker-postgres` iterates through each backup in the archive, parsing out service information + data. It then deletes any existing containers using the ID of the container to be restored, recreates its volume directories if necessary, and creates a new container with the original name, id, and port mappings. Finally, it restores the data to the new postgres instance via `psql`.
Restores with `docker-postgres` are service-impacting. Postgres containers are potentially deleted and re-created, preventing apps from communicating with them during the backup.
DEPENDENCIES ¶
This plugin relies on the `pg_dump` and `psql` commands. Please ensure that they are present on the system that will be running the backups + restores for postgres. If you are using shield-boshrelease to deploy SHIELD, these tools are provided, if you include the `agent-pgtools` job template along side your `shield-agent`.