{"modulePath":"github.com/bodymindarts/shield","version":"v0.0.0-20160224193344-cad6cb593f26","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package main\n\nThe \\`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.\n\n### PLUGIN FEATURES {#hdr-PLUGIN_FEATURES}\n\nThis plugin implements functionality suitable for use with the following SHIELD Job components:\n\n\tTarget: yes\n\tStore:  no\n\n### PLUGIN CONFIGURATION {#hdr-PLUGIN_CONFIGURATION}\n\nNo 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:\n\n\t{}\n\n### BACKUP DETAILS {#hdr-BACKUP_DETAILS}\n\nThe \\`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.\n\n### RESTORE DETAILS {#hdr-RESTORE_DETAILS}\n\nDuring 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\\`.\n\nRestores with \\`docker-postgres\\` are service-impacting. Postgres containers are potentially deleted and re-created, preventing apps from communicating with them during the backup.\n\n### DEPENDENCIES {#hdr-DEPENDENCIES}\n\nThis 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\\`.\n\n## Types\n\n```go\ntype ArchiveReader struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewArchiveReader(io io.Reader) *ArchiveReader\n```\n\n```go\nfunc (a *ArchiveReader) Next(metadata interface{}) (io.Reader, error)\n```\n\n```go\ntype ArchiveWriter struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewArchiveWriter(io io.Writer) *ArchiveWriter\n```\n\n```go\nfunc (a *ArchiveWriter) Close()\n```\n\n```go\nfunc (a *ArchiveWriter) Write(prefix string, metadata interface{}, data *os.File) error\n```\n\n```go\ntype DockerPostgresPlugin PluginInfo\n```\n\n```go\nfunc (p DockerPostgresPlugin) Backup(endpoint ShieldEndpoint) error\n```\n\n```go\nfunc (p DockerPostgresPlugin) Meta() PluginInfo\n```\n\n```go\nfunc (p DockerPostgresPlugin) Purge(endpoint ShieldEndpoint, file string) error\n```\n\n```go\nfunc (p DockerPostgresPlugin) Restore(endpoint ShieldEndpoint) error\n```\n\n```go\nfunc (p DockerPostgresPlugin) Retrieve(endpoint ShieldEndpoint, file string) error\n```\n\n```go\nfunc (p DockerPostgresPlugin) Store(endpoint ShieldEndpoint) (string, error)\n```\n\n```go\ntype MultiError struct {\n\tMessage string\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (e *MultiError) Append(x error)\n```\n\n```go\nfunc (e *MultiError) Appendf(msg string, args ...interface{})\n```\n\n```go\nfunc (e MultiError) Error() string\n```\n\n```go\nfunc (e *MultiError) Valid() bool\n```\n\n","path":"github.com/bodymindarts/shield/plugin/docker-postgres","name":"main","synopsis":"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.","isRedistributable":true}
