-
-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1692 from smilerz/master
Add pgAdmin and pgBackup
- Loading branch information
Showing
17 changed files
with
184 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
services: | ||
pgadmin: | ||
image: dpage/pgadmin4:${PGADMIN_TAG} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
services: | ||
pgadmin: | ||
hostname: ${DOCKERHOSTNAME} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
services: | ||
pgadmin: | ||
labels: | ||
com.dockstarter.appinfo.deprecated: "false" | ||
com.dockstarter.appinfo.description: pgAdmin 4 is a web based administration tool for the PostgreSQL database. | ||
com.dockstarter.appinfo.nicename: pgAdmin | ||
com.dockstarter.appvars.pgadmin_disable_postfix: "True" | ||
com.dockstarter.appvars.pgadmin_enabled: "false" | ||
com.dockstarter.appvars.pgadmin_network_mode: "" | ||
com.dockstarter.appvars.pgadmin_default_email: "" | ||
com.dockstarter.appvars.pgadmin_default_password: "" | ||
com.dockstarter.appvars.pgadmin_port_80: "5050" | ||
com.dockstarter.appvars.pgadmin_restart: unless-stopped | ||
com.dockstarter.appvars.pgadmin_tag: "latest" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
services: | ||
pgadmin: | ||
network_mode: ${PGADMIN_NETWORK_MODE} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
services: | ||
pgadmin: | ||
ports: | ||
- ${PGADMIN_PORT_80}:80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
services: | ||
pgadmin: | ||
image: dpage/pgadmin4:${PGADMIN_TAG} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
services: | ||
pgadmin: | ||
container_name: pgadmin | ||
environment: | ||
- PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL} | ||
- PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD} | ||
- PGADMIN_DISABLE_POSTFIX=${PGADMIN_DISABLE_POSTFIX} | ||
- TZ=${TZ} | ||
logging: | ||
driver: json-file | ||
options: | ||
max-file: ${DOCKERLOGGING_MAXFILE} | ||
max-size: ${DOCKERLOGGING_MAXSIZE} | ||
restart: ${PGADMIN_RESTART} | ||
volumes: | ||
- /etc/localtime:/etc/localtime:ro | ||
- ${DOCKERCONFDIR}/pgadmin:/var/lib/pgadmin | ||
- ${DOCKERSTORAGEDIR}:/storage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
services: | ||
pgbackup: | ||
image: prodrigestivill/postgres-backup-local:${PGBACKUP_TAG} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
services: | ||
pgbackup: | ||
hostname: ${DOCKERHOSTNAME} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
services: | ||
pgbackup: | ||
labels: | ||
com.dockstarter.appinfo.deprecated: "false" | ||
com.dockstarter.appinfo.description: Backup PostgresSQL to the local filesystem with periodic rotating backups. | ||
com.dockstarter.appinfo.nicename: pgBackup | ||
com.dockstarter.appvars.pgbackup_enabled: "false" | ||
com.dockstarter.appvars.pgbackup_keep_days: "8" | ||
com.dockstarter.appvars.pgbackup_keep_months: "12" | ||
com.dockstarter.appvars.pgbackup_keep_weeks: "4" | ||
com.dockstarter.appvars.pgbackup_network_mode: "" | ||
com.dockstarter.appvars.pgbackup_postgres_db: "" | ||
com.dockstarter.appvars.pgbackup_postgres_host: "postgres" | ||
com.dockstarter.appvars.pgbackup_postgres_password: "" | ||
com.dockstarter.appvars.pgbackup_postgres_user: "" | ||
com.dockstarter.appvars.pgbackup_restart: unless-stopped | ||
com.dockstarter.appvars.pgbackup_schedule: "@daily" | ||
com.dockstarter.appvars.pgbackup_tag: "16" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
services: | ||
pgbackup: | ||
network_mode: ${PGBACKUP_NETWORK_MODE} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
services: | ||
pgbackup: | ||
image: prodrigestivill/postgres-backup-local:${PGBACKUP_TAG} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
services: | ||
pgbackup: | ||
container_name: pgbackup | ||
environment: | ||
- POSTGRES_HOST=${PGBACKUP_POSTGRES_HOST} | ||
- POSTGRES_DB=${PGBACKUP_POSTGRES_DB} | ||
- POSTGRES_USER=${PGBACKUP_POSTGRES_USER} | ||
- POSTGRES_PASSWORD=${PGBACKUP_POSTGRES_PASSWORD} | ||
- POSTGRES_EXTRA_OPTS=-Z6 --schema=public --blobs | ||
- SCHEDULE=${PGBACKUP_SCHEDULE} | ||
- BACKUP_KEEP_DAYS=${PGBACKUP_KEEP_DAYS} | ||
- BACKUP_KEEP_WEEKS=${PGBACKUP_KEEP_WEEKS} | ||
- BACKUP_KEEP_MONTHS=${PGBACKUP_KEEP_MONTHS} | ||
- TZ=${TZ} | ||
logging: | ||
driver: json-file | ||
options: | ||
max-file: ${DOCKERLOGGING_MAXFILE} | ||
max-size: ${DOCKERLOGGING_MAXSIZE} | ||
restart: ${PGBACKUP_RESTART} | ||
volumes: | ||
- /etc/localtime:/etc/localtime:ro | ||
- ${DOCKERSTORAGEDIR}/backups/postgres:/backups | ||
- ${DOCKERSTORAGEDIR}:/storage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# pgAdmin | ||
|
||
[![Docker Pulls](https://img.shields.io/docker/pulls/dpage/pgadmin4?style=flat-square&color=607D8B&label=docker%20pulls&logo=docker)](https://hub.docker.com/r/dpage/pgadmin4) | ||
[![GitHub Stars](https://img.shields.io/github/stars/pgadmin-org/pgadmin4?style=flat-square&color=607D8B&label=github%20stars&logo=github)](https://github.com/pgadmin-org/pgadmin4) | ||
[![Compose Templates](https://img.shields.io/static/v1?style=flat-square&color=607D8B&label=compose&message=templates)](https://github.com/GhostWriters/DockSTARTer/tree/master/compose/.apps/pgadmin) | ||
|
||
## Description | ||
|
||
[pgAdmin](https://www.pgadmin.org/): pgAdmin is the most popular and feature rich Open Source administration and development platform for PostgreSQL, the most advanced Open Source database in the world. | ||
|
||
## Install/Setup | ||
|
||
An email address (login) and password are the only required inputs for a fullly functional instance of pgAdmin. | ||
|
||
Full variable documentation is available in the pgadmin [documentation](https://www.pgadmin.org/docs/pgadmin4/latest/container_deployment.html#environment-variables). | ||
|
||
Any variable name from [config.py](https://www.pgadmin.org/docs/pgadmin4/latest/config_py.html#config-py) can be defined in the format of `PGADMIN_CONFIG_*` in docker-compose.override.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# pgBackup | ||
|
||
[![Docker Pulls](https://img.shields.io/docker/pulls/prodrigestivill/postgres-backup-local?style=flat-square&color=607D8B&label=docker%20pulls&logo=docker)](https://hub.docker.com/r/prodrigestivill/postgres-backup-local) | ||
[![GitHub Stars](https://img.shields.io/github/stars/prodrigestivill/docker-postgres-backup-local?style=flat-square&color=607D8B&label=github%20stars&logo=github)](https://github.com/prodrigestivill/docker-postgres-backup-local) | ||
[![Compose Templates](https://img.shields.io/static/v1?style=flat-square&color=607D8B&label=compose&message=templates)](https://github.com/GhostWriters/DockSTARTer/tree/master/compose/.apps/pgbackup) | ||
|
||
## Description | ||
|
||
[pgBackup](https://hub.docker.com/r/prodrigestivill/postgres-backup-local): Backup PostgresSQL to the local filesystem with periodic rotating backups | ||
|
||
## Install/Setup | ||
|
||
Set your postgres host, username and password in the .env file along with a comma seperated list of databases you want to backup. | ||
|
||
By default, backups run daily. Change PGBACKUP_SCHEDULE to any valid [cron schedule](http://godoc.org/github.com/robfig/cron#hdr-Predefined_schedules) to modify the default. | ||
|
||
### Recommended docker-compose overrides | ||
|
||
For extra security, it is recommended to limit permissions on the backup folder to a priviledged user. Modify docker-compose.override.yml as below. | ||
|
||
If you are using postgres docker container, add a dependency to the container | ||
|
||
```yaml | ||
pgbackup: | ||
user: postgres:postgres | ||
depends_on: | ||
- postgres | ||
``` | ||
## Manually trigger a backup | ||
`docker exec -it pgbackup ./backup.sh` | ||
|
||
## Restore from latest backup | ||
|
||
If the database already exists, drop it. | ||
Create a database <db_name> | ||
|
||
```bash | ||
docker exec -it <postgres_container> /bin/sh -c "zcat /storage/backups/postgres/last/<db_name>-latest.sql.gz | psql --username=<username> --dbname=<db_name> -W" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters