From 7cb40ffe74e92a642d526b017f7014bb66603ef6 Mon Sep 17 00:00:00 2001 From: smilerz Date: Thu, 9 Nov 2023 07:53:31 -0600 Subject: [PATCH 01/19] added pgadmin container and documentation --- compose/.apps/pgadmin/pgadmin.aarch64.yml | 3 +++ compose/.apps/pgadmin/pgadmin.hostname.yml | 3 +++ compose/.apps/pgadmin/pgadmin.labels.yml | 14 ++++++++++++++ compose/.apps/pgadmin/pgadmin.netmode.yml | 3 +++ compose/.apps/pgadmin/pgadmin.ports.yml | 4 ++++ compose/.apps/pgadmin/pgadmin.x86_64.yml | 3 +++ compose/.apps/pgadmin/pgadmin.yml | 19 +++++++++++++++++++ docs/apps/pgadmin.md | 15 +++++++++++++++ mkdocs.yml | 2 ++ 9 files changed, 66 insertions(+) create mode 100755 compose/.apps/pgadmin/pgadmin.aarch64.yml create mode 100755 compose/.apps/pgadmin/pgadmin.hostname.yml create mode 100755 compose/.apps/pgadmin/pgadmin.labels.yml create mode 100755 compose/.apps/pgadmin/pgadmin.netmode.yml create mode 100755 compose/.apps/pgadmin/pgadmin.ports.yml create mode 100755 compose/.apps/pgadmin/pgadmin.x86_64.yml create mode 100755 compose/.apps/pgadmin/pgadmin.yml create mode 100644 docs/apps/pgadmin.md diff --git a/compose/.apps/pgadmin/pgadmin.aarch64.yml b/compose/.apps/pgadmin/pgadmin.aarch64.yml new file mode 100755 index 0000000000..451bd9308e --- /dev/null +++ b/compose/.apps/pgadmin/pgadmin.aarch64.yml @@ -0,0 +1,3 @@ +services: + pgadmin: + image: dpage/pgadmin4:${PGADMIN_TAG} diff --git a/compose/.apps/pgadmin/pgadmin.hostname.yml b/compose/.apps/pgadmin/pgadmin.hostname.yml new file mode 100755 index 0000000000..fc7f3cb7d7 --- /dev/null +++ b/compose/.apps/pgadmin/pgadmin.hostname.yml @@ -0,0 +1,3 @@ +services: + pgadmin: + hostname: ${DOCKERHOSTNAME} diff --git a/compose/.apps/pgadmin/pgadmin.labels.yml b/compose/.apps/pgadmin/pgadmin.labels.yml new file mode 100755 index 0000000000..49c58292da --- /dev/null +++ b/compose/.apps/pgadmin/pgadmin.labels.yml @@ -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_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_5050: "5050" + com.dockstarter.appvars.pgadmin_restart: unless-stopped + com.dockstarter.appvars.pgadmin_tag: "latest" + diff --git a/compose/.apps/pgadmin/pgadmin.netmode.yml b/compose/.apps/pgadmin/pgadmin.netmode.yml new file mode 100755 index 0000000000..75f1cd8fed --- /dev/null +++ b/compose/.apps/pgadmin/pgadmin.netmode.yml @@ -0,0 +1,3 @@ +services: + pgadmin: + network_mode: ${PGADMIN_NETWORK_MODE} diff --git a/compose/.apps/pgadmin/pgadmin.ports.yml b/compose/.apps/pgadmin/pgadmin.ports.yml new file mode 100755 index 0000000000..60642850af --- /dev/null +++ b/compose/.apps/pgadmin/pgadmin.ports.yml @@ -0,0 +1,4 @@ +services: + pgadmin: + ports: + - ${PGADMIN_PORT_5050}:5050 diff --git a/compose/.apps/pgadmin/pgadmin.x86_64.yml b/compose/.apps/pgadmin/pgadmin.x86_64.yml new file mode 100755 index 0000000000..451bd9308e --- /dev/null +++ b/compose/.apps/pgadmin/pgadmin.x86_64.yml @@ -0,0 +1,3 @@ +services: + pgadmin: + image: dpage/pgadmin4:${PGADMIN_TAG} diff --git a/compose/.apps/pgadmin/pgadmin.yml b/compose/.apps/pgadmin/pgadmin.yml new file mode 100755 index 0000000000..abb824f9f2 --- /dev/null +++ b/compose/.apps/pgadmin/pgadmin.yml @@ -0,0 +1,19 @@ +services: + pgadmin: + container_name: pgadmin + environment: + - PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL} + - PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD} + - PGADMIN_DISABLE_POSTFIX=True + - PGADMIN_LISTEN_PORT=5050 + - 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 diff --git a/docs/apps/pgadmin.md b/docs/apps/pgadmin.md new file mode 100644 index 0000000000..f650a5b073 --- /dev/null +++ b/docs/apps/pgadmin.md @@ -0,0 +1,15 @@ +# PostgresSQL + +[![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 diff --git a/mkdocs.yml b/mkdocs.yml index f5bbbedce0..244384e7d7 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -196,6 +196,8 @@ nav: - apps/openvpnas.md - apps/organizr.md - apps/ouroboros.md + - apps/pgadmin.md + - apps/pgbackup.md - apps/photostructure.md - apps/phpmyadmin.md - apps/picard.md From 9ab6e7161c12f34f7231fb67495d04ed72841576 Mon Sep 17 00:00:00 2001 From: smilerz Date: Thu, 9 Nov 2023 16:17:40 -0600 Subject: [PATCH 02/19] added pgbackup container and documentation --- compose/.apps/pgbackup/pgbackup.aarch64.yml | 3 +++ compose/.apps/pgbackup/pgbackup.hostname.yml | 3 +++ compose/.apps/pgbackup/pgbackup.labels.yml | 19 +++++++++++++++ compose/.apps/pgbackup/pgbackup.netmode.yml | 3 +++ compose/.apps/pgbackup/pgbackup.x86_64.yml | 3 +++ compose/.apps/pgbackup/pgbackup.yml | 25 ++++++++++++++++++++ 6 files changed, 56 insertions(+) create mode 100755 compose/.apps/pgbackup/pgbackup.aarch64.yml create mode 100755 compose/.apps/pgbackup/pgbackup.hostname.yml create mode 100755 compose/.apps/pgbackup/pgbackup.labels.yml create mode 100755 compose/.apps/pgbackup/pgbackup.netmode.yml create mode 100755 compose/.apps/pgbackup/pgbackup.x86_64.yml create mode 100755 compose/.apps/pgbackup/pgbackup.yml diff --git a/compose/.apps/pgbackup/pgbackup.aarch64.yml b/compose/.apps/pgbackup/pgbackup.aarch64.yml new file mode 100755 index 0000000000..51f99b1fad --- /dev/null +++ b/compose/.apps/pgbackup/pgbackup.aarch64.yml @@ -0,0 +1,3 @@ +services: + pgbackup: + image: prodrigestivill/postgres-backup-local:${PGBACKUP_TAG} diff --git a/compose/.apps/pgbackup/pgbackup.hostname.yml b/compose/.apps/pgbackup/pgbackup.hostname.yml new file mode 100755 index 0000000000..39877444a5 --- /dev/null +++ b/compose/.apps/pgbackup/pgbackup.hostname.yml @@ -0,0 +1,3 @@ +services: + pgbackup: + hostname: ${DOCKERHOSTNAME} diff --git a/compose/.apps/pgbackup/pgbackup.labels.yml b/compose/.apps/pgbackup/pgbackup.labels.yml new file mode 100755 index 0000000000..49355558e7 --- /dev/null +++ b/compose/.apps/pgbackup/pgbackup.labels.yml @@ -0,0 +1,19 @@ +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_keep_days: "8" + com.dockstarter.appvars.pgbackup_keep_months: "12" + com.dockstarter.appvars.pgbackup_keep_weeks: "4" + com.dockstarter.appvars.pgbackup_healthcheck_port: "8080" + 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" + com.dockstarter.appvars.pgbackup_user: "postgres" diff --git a/compose/.apps/pgbackup/pgbackup.netmode.yml b/compose/.apps/pgbackup/pgbackup.netmode.yml new file mode 100755 index 0000000000..9def0983fb --- /dev/null +++ b/compose/.apps/pgbackup/pgbackup.netmode.yml @@ -0,0 +1,3 @@ +services: + pgbackup: + network_mode: ${PGBACKUP_NETWORK_MODE} diff --git a/compose/.apps/pgbackup/pgbackup.x86_64.yml b/compose/.apps/pgbackup/pgbackup.x86_64.yml new file mode 100755 index 0000000000..51f99b1fad --- /dev/null +++ b/compose/.apps/pgbackup/pgbackup.x86_64.yml @@ -0,0 +1,3 @@ +services: + pgbackup: + image: prodrigestivill/postgres-backup-local:${PGBACKUP_TAG} diff --git a/compose/.apps/pgbackup/pgbackup.yml b/compose/.apps/pgbackup/pgbackup.yml new file mode 100755 index 0000000000..8e6e51c7ad --- /dev/null +++ b/compose/.apps/pgbackup/pgbackup.yml @@ -0,0 +1,25 @@ +services: + postgres: + container_name: pgpackup + 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} + - HEALTHCHECK_PORT=${PGBACKUP_HEALTHCHECK_PORT} + - TZ=${TZ} + logging: + driver: json-file + options: + max-file: ${DOCKERLOGGING_MAXFILE} + max-size: ${DOCKERLOGGING_MAXSIZE} + restart: ${PGBACKUP_RESTART} + volumes: + - /etc/localtime:/etc/localtime:ro + - ${DOCKERCONFDIR}/pgbackup:/backups + - ${DOCKERSTORAGEDIR}:/storage From f34b049d56fb25e4bcba3fada692b2448f88be95 Mon Sep 17 00:00:00 2001 From: smilerz Date: Thu, 9 Nov 2023 16:23:13 -0600 Subject: [PATCH 03/19] WIP --- compose/.apps/pgbackup/pgbackup.labels.yml | 2 -- compose/.apps/pgbackup/pgbackup.yml | 1 - docs/apps/pgbackup.md | 28 ++++++++++++++++++++++ docs/apps/postgres.md | 17 +++++++++++++ 4 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 docs/apps/pgbackup.md diff --git a/compose/.apps/pgbackup/pgbackup.labels.yml b/compose/.apps/pgbackup/pgbackup.labels.yml index 49355558e7..29790ee918 100755 --- a/compose/.apps/pgbackup/pgbackup.labels.yml +++ b/compose/.apps/pgbackup/pgbackup.labels.yml @@ -7,7 +7,6 @@ services: 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_healthcheck_port: "8080" com.dockstarter.appvars.pgbackup_network_mode: "" com.dockstarter.appvars.pgbackup_postgres_db: "" com.dockstarter.appvars.pgbackup_postgres_host: "postgres" @@ -16,4 +15,3 @@ services: com.dockstarter.appvars.pgbackup_restart: unless-stopped com.dockstarter.appvars.pgbackup_schedule: "@daily" com.dockstarter.appvars.pgbackup_tag: "16" - com.dockstarter.appvars.pgbackup_user: "postgres" diff --git a/compose/.apps/pgbackup/pgbackup.yml b/compose/.apps/pgbackup/pgbackup.yml index 8e6e51c7ad..5be09f7454 100755 --- a/compose/.apps/pgbackup/pgbackup.yml +++ b/compose/.apps/pgbackup/pgbackup.yml @@ -11,7 +11,6 @@ services: - BACKUP_KEEP_DAYS=${PGBACKUP_KEEP_DAYS} - BACKUP_KEEP_WEEKS=${PGBACKUP_KEEP_WEEKS} - BACKUP_KEEP_MONTHS=${PGBACKUP_KEEP_MONTHS} - - HEALTHCHECK_PORT=${PGBACKUP_HEALTHCHECK_PORT} - TZ=${TZ} logging: driver: json-file diff --git a/docs/apps/pgbackup.md b/docs/apps/pgbackup.md new file mode 100644 index 0000000000..3bc27e5759 --- /dev/null +++ b/docs/apps/pgbackup.md @@ -0,0 +1,28 @@ +# PostgresSQL + +[![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 + +[Postgres](https://www.postgresql.org/): The World's Most Advanced Open Source Relational Database + +## Install/Setup + +PostgreSQL is a powerful, open source object-relational database system with over 35 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance. + +There is a wealth of information to be found describing how to [install](https://www.postgresql.org/download/) and [use](https://www.postgresql.org/docs/) PostgreSQL through the [official documentation](https://www.postgresql.org/docs/). The [open source community](https://www.postgresql.org/community/) provides many helpful places to become familiar with PostgreSQL, discover how it works. + +We **heavily** recommend that if you spin up a container that requires a database you create a user for that container. You should **NEVER** use the root account for anything other than database management. + + +user: 1024:users + - SCHEDULE=${PGBACKUP_SCHEDULE} + - BACKUP_KEEP_DAYS=${PGBACKUP_KEEP_DAYS} + - BACKUP_KEEP_WEEKS=${PGBACKUP_KEEP_WEEKS} + - BACKUP_KEEP_MONTHS=${PGBACKUP_KEEP_MONTHS} + - POSTGRES_DB=${PGBACKUP_POSTGRES_DB} + + depends_on: + - postgres diff --git a/docs/apps/postgres.md b/docs/apps/postgres.md index 7ef8c6ea1c..a5f1920799 100644 --- a/docs/apps/postgres.md +++ b/docs/apps/postgres.md @@ -15,3 +15,20 @@ PostgreSQL is a powerful, open source object-relational database system with ove There is a wealth of information to be found describing how to [install](https://www.postgresql.org/download/) and [use](https://www.postgresql.org/docs/) PostgreSQL through the [official documentation](https://www.postgresql.org/docs/). The [open source community](https://www.postgresql.org/community/) provides many helpful places to become familiar with PostgreSQL, discover how it works. We **heavily** recommend that if you spin up a container that requires a database you create a user for that container. You should **NEVER** use the root account for anything other than database management. + +## Common Activities + +### Create user +``` +CREATE USER newuser WITH PASSWORD 'password123'; +``` + +### Make user a superuser +``` +CREATE USER newadmin WITH PASSWORD 'password123'; +ALTER USER newadmin WITH SUPERUSER; +``` + +### Create a database and owner to the new user +CREATE DATABASE newdatabase; +ALTER DATABASE newdatabase OWNER TO newuser; From 3d01fb3b9f1860ebf689a6cc6fd594eb6c43c9b8 Mon Sep 17 00:00:00 2001 From: smilerz Date: Thu, 9 Nov 2023 16:50:58 -0600 Subject: [PATCH 04/19] missing pgbackup_enabled --- compose/.apps/pgbackup/pgbackup.labels.yml | 1 + compose/.apps/pgbackup/pgbackup.yml | 3 +-- docs/apps/pgbackup.md | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/compose/.apps/pgbackup/pgbackup.labels.yml b/compose/.apps/pgbackup/pgbackup.labels.yml index 29790ee918..9ddcd4e9f4 100755 --- a/compose/.apps/pgbackup/pgbackup.labels.yml +++ b/compose/.apps/pgbackup/pgbackup.labels.yml @@ -4,6 +4,7 @@ services: 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" diff --git a/compose/.apps/pgbackup/pgbackup.yml b/compose/.apps/pgbackup/pgbackup.yml index 5be09f7454..b05d87db51 100755 --- a/compose/.apps/pgbackup/pgbackup.yml +++ b/compose/.apps/pgbackup/pgbackup.yml @@ -20,5 +20,4 @@ services: restart: ${PGBACKUP_RESTART} volumes: - /etc/localtime:/etc/localtime:ro - - ${DOCKERCONFDIR}/pgbackup:/backups - - ${DOCKERSTORAGEDIR}:/storage + - ${DOCKERSTORAGEDIR}/backups/postgres:/storage diff --git a/docs/apps/pgbackup.md b/docs/apps/pgbackup.md index 3bc27e5759..63bd174dbd 100644 --- a/docs/apps/pgbackup.md +++ b/docs/apps/pgbackup.md @@ -26,3 +26,8 @@ user: 1024:users depends_on: - postgres + +manual backup +docker exec -it pgbackup ./backup.sh + +restore from latest From cf4fe304c69216dd495a78ce749183d756957a81 Mon Sep 17 00:00:00 2001 From: smilerz Date: Thu, 9 Nov 2023 17:02:19 -0600 Subject: [PATCH 05/19] changed volume configuration --- compose/.apps/pgbackup/pgbackup.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/compose/.apps/pgbackup/pgbackup.yml b/compose/.apps/pgbackup/pgbackup.yml index b05d87db51..d601240248 100755 --- a/compose/.apps/pgbackup/pgbackup.yml +++ b/compose/.apps/pgbackup/pgbackup.yml @@ -1,6 +1,6 @@ services: - postgres: - container_name: pgpackup + pgbckup: + container_name: pgbackup environment: - POSTGRES_HOST=${PGBACKUP_POSTGRES_HOST} - POSTGRES_DB=${PGBACKUP_POSTGRES_DB} @@ -20,4 +20,5 @@ services: restart: ${PGBACKUP_RESTART} volumes: - /etc/localtime:/etc/localtime:ro - - ${DOCKERSTORAGEDIR}/backups/postgres:/storage + - ${DOCKERSTORAGEDIR}/backups/postgres:/backups + - ${DOCKERSTORAGEDIR}:/storage From 50bbe3bb2207389d55dd4c1307cebdcb38165e2b Mon Sep 17 00:00:00 2001 From: smilerz Date: Thu, 9 Nov 2023 17:07:49 -0600 Subject: [PATCH 06/19] fix typo again --- compose/.apps/pgbackup/pgbackup.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compose/.apps/pgbackup/pgbackup.yml b/compose/.apps/pgbackup/pgbackup.yml index d601240248..d7fa0c4825 100755 --- a/compose/.apps/pgbackup/pgbackup.yml +++ b/compose/.apps/pgbackup/pgbackup.yml @@ -1,5 +1,5 @@ services: - pgbckup: + pgbackup: container_name: pgbackup environment: - POSTGRES_HOST=${PGBACKUP_POSTGRES_HOST} From b174241f70e9107b1029f537e4b79a06b0553033 Mon Sep 17 00:00:00 2001 From: smilerz Date: Thu, 9 Nov 2023 17:31:53 -0600 Subject: [PATCH 07/19] updated documentation --- docs/apps/pgbackup.md | 31 +++++++++++++++++-------------- docs/apps/postgres.md | 2 ++ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/docs/apps/pgbackup.md b/docs/apps/pgbackup.md index 63bd174dbd..b8afbd55c1 100644 --- a/docs/apps/pgbackup.md +++ b/docs/apps/pgbackup.md @@ -6,28 +6,31 @@ ## Description -[Postgres](https://www.postgresql.org/): The World's Most Advanced Open Source Relational Database +[pgBackup](https://hub.docker.com/r/prodrigestivill/postgres-backup-local): Backup PostgresSQL to the local filesystem with periodic rotating backups ## Install/Setup -PostgreSQL is a powerful, open source object-relational database system with over 35 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance. +Set your postgres host, username and password in the .env file along with a comma seperated list of databases you want to backup. -There is a wealth of information to be found describing how to [install](https://www.postgresql.org/download/) and [use](https://www.postgresql.org/docs/) PostgreSQL through the [official documentation](https://www.postgresql.org/docs/). The [open source community](https://www.postgresql.org/community/) provides many helpful places to become familiar with PostgreSQL, discover how it works. +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. -We **heavily** recommend that if you spin up a container that requires a database you create a user for that container. You should **NEVER** use the root account for anything other than database management. +### 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 -user: 1024:users - - SCHEDULE=${PGBACKUP_SCHEDULE} - - BACKUP_KEEP_DAYS=${PGBACKUP_KEEP_DAYS} - - BACKUP_KEEP_WEEKS=${PGBACKUP_KEEP_WEEKS} - - BACKUP_KEEP_MONTHS=${PGBACKUP_KEEP_MONTHS} - - POSTGRES_DB=${PGBACKUP_POSTGRES_DB} - +``` + pgbackup: + user: postgres:postgres depends_on: - postgres +``` + +## Manually trigger a backup +`docker exec -it pgbackup ./backup.sh` -manual backup -docker exec -it pgbackup ./backup.sh +## Restore from latest backup +If the database already exists, drop it. +Create a database -restore from latest +`docker exec -it /bin/sh -c "zcat /storage/backups/postgres/last/-latest.sql.gz | psql --username= --dbname= -W"` diff --git a/docs/apps/postgres.md b/docs/apps/postgres.md index a5f1920799..656ad1004f 100644 --- a/docs/apps/postgres.md +++ b/docs/apps/postgres.md @@ -16,6 +16,8 @@ There is a wealth of information to be found describing how to [install](https:/ We **heavily** recommend that if you spin up a container that requires a database you create a user for that container. You should **NEVER** use the root account for anything other than database management. +Strongly consider also installing [pgAdmin](https://github.com/GhostWriters/DockSTARTer/tree/master/compose/.apps/pgadmin) for adminsitration and [pgBackup](https://github.com/GhostWriters/DockSTARTer/tree/master/compose/.apps/pgbackup) for periodic rotating backups. + ## Common Activities ### Create user From 724580e8d17779365d64580dd73d25d00c2f4345 Mon Sep 17 00:00:00 2001 From: smilerz Date: Thu, 9 Nov 2023 17:33:14 -0600 Subject: [PATCH 08/19] Update pgbackup.md --- docs/apps/pgbackup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/apps/pgbackup.md b/docs/apps/pgbackup.md index b8afbd55c1..c020b95a6a 100644 --- a/docs/apps/pgbackup.md +++ b/docs/apps/pgbackup.md @@ -1,4 +1,4 @@ -# PostgresSQL +# 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) From b7021bb0585159ca36f8f81678e669bb37c938f2 Mon Sep 17 00:00:00 2001 From: smilerz Date: Thu, 9 Nov 2023 17:35:32 -0600 Subject: [PATCH 09/19] Update pgadmin.md --- docs/apps/pgadmin.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/apps/pgadmin.md b/docs/apps/pgadmin.md index f650a5b073..7ac372bfbc 100644 --- a/docs/apps/pgadmin.md +++ b/docs/apps/pgadmin.md @@ -1,4 +1,4 @@ -# PostgresSQL +# 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) @@ -11,5 +11,7 @@ ## 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 From f49e0121a63653a7e18d26d31d7549fd0f30bf38 Mon Sep 17 00:00:00 2001 From: smilerz Date: Thu, 9 Nov 2023 17:48:59 -0600 Subject: [PATCH 10/19] remove extra lines from pgadmin.labels.yml --- compose/.apps/pgadmin/pgadmin.labels.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/compose/.apps/pgadmin/pgadmin.labels.yml b/compose/.apps/pgadmin/pgadmin.labels.yml index 49c58292da..8803792a6a 100755 --- a/compose/.apps/pgadmin/pgadmin.labels.yml +++ b/compose/.apps/pgadmin/pgadmin.labels.yml @@ -11,4 +11,3 @@ services: com.dockstarter.appvars.pgadmin_port_5050: "5050" com.dockstarter.appvars.pgadmin_restart: unless-stopped com.dockstarter.appvars.pgadmin_tag: "latest" - From 03aec9af7c9456f52bc8822075ac830bd72c1b7e Mon Sep 17 00:00:00 2001 From: smilerz Date: Thu, 9 Nov 2023 17:51:04 -0600 Subject: [PATCH 11/19] Add blank lines around headers in postgres.md --- docs/apps/postgres.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/apps/postgres.md b/docs/apps/postgres.md index 656ad1004f..bbee5aa2a9 100644 --- a/docs/apps/postgres.md +++ b/docs/apps/postgres.md @@ -21,16 +21,19 @@ Strongly consider also installing [pgAdmin](https://github.com/GhostWriters/Dock ## Common Activities ### Create user + ``` CREATE USER newuser WITH PASSWORD 'password123'; ``` ### Make user a superuser + ``` CREATE USER newadmin WITH PASSWORD 'password123'; ALTER USER newadmin WITH SUPERUSER; ``` ### Create a database and owner to the new user + CREATE DATABASE newdatabase; ALTER DATABASE newdatabase OWNER TO newuser; From 97397df81dfb758ec2d7571443369f7e647aa367 Mon Sep 17 00:00:00 2001 From: smilerz Date: Thu, 9 Nov 2023 17:51:45 -0600 Subject: [PATCH 12/19] Add blank lines around headers in pgbackup.md --- docs/apps/pgbackup.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/apps/pgbackup.md b/docs/apps/pgbackup.md index c020b95a6a..f1b0e5f878 100644 --- a/docs/apps/pgbackup.md +++ b/docs/apps/pgbackup.md @@ -15,6 +15,7 @@ Set your postgres host, username and password in the .env file along with a comm 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 @@ -27,9 +28,11 @@ If you are using postgres docker container, add a dependency to the container ``` ## Manually trigger a backup + `docker exec -it pgbackup ./backup.sh` ## Restore from latest backup + If the database already exists, drop it. Create a database From 25438d057e3167c84016deb066b43929f2e540c7 Mon Sep 17 00:00:00 2001 From: smilerz Date: Thu, 9 Nov 2023 18:00:10 -0600 Subject: [PATCH 13/19] Added language to code block pgbackup.md --- docs/apps/pgbackup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/apps/pgbackup.md b/docs/apps/pgbackup.md index f1b0e5f878..08772c90c0 100644 --- a/docs/apps/pgbackup.md +++ b/docs/apps/pgbackup.md @@ -20,7 +20,7 @@ For extra security, it is recommended to limit permissions on the backup folder If you are using postgres docker container, add a dependency to the container -``` +```yaml pgbackup: user: postgres:postgres depends_on: From a8e3598edbfbab7aab12acb664ca35a87dee1038 Mon Sep 17 00:00:00 2001 From: smilerz Date: Thu, 9 Nov 2023 18:00:55 -0600 Subject: [PATCH 14/19] changed restore command to code block in pgbackup.md --- docs/apps/pgbackup.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/apps/pgbackup.md b/docs/apps/pgbackup.md index 08772c90c0..dde889c461 100644 --- a/docs/apps/pgbackup.md +++ b/docs/apps/pgbackup.md @@ -36,4 +36,6 @@ If you are using postgres docker container, add a dependency to the container If the database already exists, drop it. Create a database -`docker exec -it /bin/sh -c "zcat /storage/backups/postgres/last/-latest.sql.gz | psql --username= --dbname= -W"` +```bash +docker exec -it /bin/sh -c "zcat /storage/backups/postgres/last/-latest.sql.gz | psql --username= --dbname= -W" +``` From 04197d41ad0a7d813ccc8b22c9b3393f5925b8f7 Mon Sep 17 00:00:00 2001 From: smilerz Date: Thu, 9 Nov 2023 18:09:14 -0600 Subject: [PATCH 15/19] added language to code block in postgres.md --- docs/apps/postgres.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/apps/postgres.md b/docs/apps/postgres.md index bbee5aa2a9..ab31b252ae 100644 --- a/docs/apps/postgres.md +++ b/docs/apps/postgres.md @@ -22,13 +22,13 @@ Strongly consider also installing [pgAdmin](https://github.com/GhostWriters/Dock ### Create user -``` +``` sql CREATE USER newuser WITH PASSWORD 'password123'; ``` ### Make user a superuser -``` +``` sql CREATE USER newadmin WITH PASSWORD 'password123'; ALTER USER newadmin WITH SUPERUSER; ``` From 2dde19d7b2bf5564dd1ea42578c4a55c54724edb Mon Sep 17 00:00:00 2001 From: smilerz Date: Mon, 20 Nov 2023 08:39:26 -0600 Subject: [PATCH 16/19] remove pgadmin_listening port chnage pgadmin_disable_postfix to variable --- compose/.apps/pgadmin/pgadmin.labels.yml | 2 +- compose/.apps/pgadmin/pgadmin.yml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/compose/.apps/pgadmin/pgadmin.labels.yml b/compose/.apps/pgadmin/pgadmin.labels.yml index 8803792a6a..7467e99a9c 100755 --- a/compose/.apps/pgadmin/pgadmin.labels.yml +++ b/compose/.apps/pgadmin/pgadmin.labels.yml @@ -4,10 +4,10 @@ services: 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_5050: "5050" com.dockstarter.appvars.pgadmin_restart: unless-stopped com.dockstarter.appvars.pgadmin_tag: "latest" diff --git a/compose/.apps/pgadmin/pgadmin.yml b/compose/.apps/pgadmin/pgadmin.yml index abb824f9f2..62ccd6c068 100755 --- a/compose/.apps/pgadmin/pgadmin.yml +++ b/compose/.apps/pgadmin/pgadmin.yml @@ -4,8 +4,7 @@ services: environment: - PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL} - PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD} - - PGADMIN_DISABLE_POSTFIX=True - - PGADMIN_LISTEN_PORT=5050 + - PGADMIN_DISABLE_POSTFIX=${PGADMIN_DISABLE_POSTFIX} - TZ=${TZ} logging: driver: json-file From 5d8e78935bd34f8893440499795d1cddab8f42d8 Mon Sep 17 00:00:00 2001 From: smilerz Date: Mon, 20 Nov 2023 09:05:38 -0600 Subject: [PATCH 17/19] update pgadmin port mapping --- compose/.apps/pgadmin/pgadmin.labels.yml | 1 + compose/.apps/pgadmin/pgadmin.ports.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/compose/.apps/pgadmin/pgadmin.labels.yml b/compose/.apps/pgadmin/pgadmin.labels.yml index 7467e99a9c..2fceef244d 100755 --- a/compose/.apps/pgadmin/pgadmin.labels.yml +++ b/compose/.apps/pgadmin/pgadmin.labels.yml @@ -9,5 +9,6 @@ services: 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" diff --git a/compose/.apps/pgadmin/pgadmin.ports.yml b/compose/.apps/pgadmin/pgadmin.ports.yml index 60642850af..81e4781ca6 100755 --- a/compose/.apps/pgadmin/pgadmin.ports.yml +++ b/compose/.apps/pgadmin/pgadmin.ports.yml @@ -1,4 +1,4 @@ services: pgadmin: ports: - - ${PGADMIN_PORT_5050}:5050 + - ${PGADMIN_PORT_80}:80 From 0163b5fc26ab2f0fb16093f0590d3d7ecdc08ea6 Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Wed, 22 Nov 2023 15:15:01 -0600 Subject: [PATCH 18/19] fix: adjust line endings and chmod Signed-off-by: Eric Nemchik --- compose/.apps/pgadmin/pgadmin.aarch64.yml | 0 compose/.apps/pgadmin/pgadmin.hostname.yml | 0 compose/.apps/pgadmin/pgadmin.labels.yml | 0 compose/.apps/pgadmin/pgadmin.netmode.yml | 0 compose/.apps/pgadmin/pgadmin.ports.yml | 0 compose/.apps/pgadmin/pgadmin.x86_64.yml | 0 compose/.apps/pgadmin/pgadmin.yml | 0 compose/.apps/pgbackup/pgbackup.aarch64.yml | 0 compose/.apps/pgbackup/pgbackup.hostname.yml | 0 compose/.apps/pgbackup/pgbackup.labels.yml | 0 compose/.apps/pgbackup/pgbackup.netmode.yml | 0 compose/.apps/pgbackup/pgbackup.x86_64.yml | 0 compose/.apps/pgbackup/pgbackup.yml | 0 docs/apps/pgadmin.md | 34 ++++---- docs/apps/pgbackup.md | 82 ++++++++++---------- docs/apps/postgres.md | 78 +++++++++---------- 16 files changed, 97 insertions(+), 97 deletions(-) mode change 100755 => 100644 compose/.apps/pgadmin/pgadmin.aarch64.yml mode change 100755 => 100644 compose/.apps/pgadmin/pgadmin.hostname.yml mode change 100755 => 100644 compose/.apps/pgadmin/pgadmin.labels.yml mode change 100755 => 100644 compose/.apps/pgadmin/pgadmin.netmode.yml mode change 100755 => 100644 compose/.apps/pgadmin/pgadmin.ports.yml mode change 100755 => 100644 compose/.apps/pgadmin/pgadmin.x86_64.yml mode change 100755 => 100644 compose/.apps/pgadmin/pgadmin.yml mode change 100755 => 100644 compose/.apps/pgbackup/pgbackup.aarch64.yml mode change 100755 => 100644 compose/.apps/pgbackup/pgbackup.hostname.yml mode change 100755 => 100644 compose/.apps/pgbackup/pgbackup.labels.yml mode change 100755 => 100644 compose/.apps/pgbackup/pgbackup.netmode.yml mode change 100755 => 100644 compose/.apps/pgbackup/pgbackup.x86_64.yml mode change 100755 => 100644 compose/.apps/pgbackup/pgbackup.yml diff --git a/compose/.apps/pgadmin/pgadmin.aarch64.yml b/compose/.apps/pgadmin/pgadmin.aarch64.yml old mode 100755 new mode 100644 diff --git a/compose/.apps/pgadmin/pgadmin.hostname.yml b/compose/.apps/pgadmin/pgadmin.hostname.yml old mode 100755 new mode 100644 diff --git a/compose/.apps/pgadmin/pgadmin.labels.yml b/compose/.apps/pgadmin/pgadmin.labels.yml old mode 100755 new mode 100644 diff --git a/compose/.apps/pgadmin/pgadmin.netmode.yml b/compose/.apps/pgadmin/pgadmin.netmode.yml old mode 100755 new mode 100644 diff --git a/compose/.apps/pgadmin/pgadmin.ports.yml b/compose/.apps/pgadmin/pgadmin.ports.yml old mode 100755 new mode 100644 diff --git a/compose/.apps/pgadmin/pgadmin.x86_64.yml b/compose/.apps/pgadmin/pgadmin.x86_64.yml old mode 100755 new mode 100644 diff --git a/compose/.apps/pgadmin/pgadmin.yml b/compose/.apps/pgadmin/pgadmin.yml old mode 100755 new mode 100644 diff --git a/compose/.apps/pgbackup/pgbackup.aarch64.yml b/compose/.apps/pgbackup/pgbackup.aarch64.yml old mode 100755 new mode 100644 diff --git a/compose/.apps/pgbackup/pgbackup.hostname.yml b/compose/.apps/pgbackup/pgbackup.hostname.yml old mode 100755 new mode 100644 diff --git a/compose/.apps/pgbackup/pgbackup.labels.yml b/compose/.apps/pgbackup/pgbackup.labels.yml old mode 100755 new mode 100644 diff --git a/compose/.apps/pgbackup/pgbackup.netmode.yml b/compose/.apps/pgbackup/pgbackup.netmode.yml old mode 100755 new mode 100644 diff --git a/compose/.apps/pgbackup/pgbackup.x86_64.yml b/compose/.apps/pgbackup/pgbackup.x86_64.yml old mode 100755 new mode 100644 diff --git a/compose/.apps/pgbackup/pgbackup.yml b/compose/.apps/pgbackup/pgbackup.yml old mode 100755 new mode 100644 diff --git a/docs/apps/pgadmin.md b/docs/apps/pgadmin.md index 7ac372bfbc..2c0d81adfa 100644 --- a/docs/apps/pgadmin.md +++ b/docs/apps/pgadmin.md @@ -1,17 +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 +# 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 diff --git a/docs/apps/pgbackup.md b/docs/apps/pgbackup.md index dde889c461..174eecd855 100644 --- a/docs/apps/pgbackup.md +++ b/docs/apps/pgbackup.md @@ -1,41 +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 - -```bash -docker exec -it /bin/sh -c "zcat /storage/backups/postgres/last/-latest.sql.gz | psql --username= --dbname= -W" -``` +# 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 + +```bash +docker exec -it /bin/sh -c "zcat /storage/backups/postgres/last/-latest.sql.gz | psql --username= --dbname= -W" +``` diff --git a/docs/apps/postgres.md b/docs/apps/postgres.md index ab31b252ae..c4314f93a6 100644 --- a/docs/apps/postgres.md +++ b/docs/apps/postgres.md @@ -1,39 +1,39 @@ -# PostgresSQL - -[![Docker Pulls](https://img.shields.io/docker/pulls/_/postgres?style=flat-square&color=607D8B&label=docker%20pulls&logo=docker)](https://hub.docker.com/r/_/postgres) -[![GitHub Stars](https://img.shields.io/github/stars/docker-library/postgres?style=flat-square&color=607D8B&label=github%20stars&logo=github)](https://github.com/docker-library/postgres) -[![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/postgres) - -## Description - -[Postgres](https://www.postgresql.org/): The World's Most Advanced Open Source Relational Database - -## Install/Setup - -PostgreSQL is a powerful, open source object-relational database system with over 35 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance. - -There is a wealth of information to be found describing how to [install](https://www.postgresql.org/download/) and [use](https://www.postgresql.org/docs/) PostgreSQL through the [official documentation](https://www.postgresql.org/docs/). The [open source community](https://www.postgresql.org/community/) provides many helpful places to become familiar with PostgreSQL, discover how it works. - -We **heavily** recommend that if you spin up a container that requires a database you create a user for that container. You should **NEVER** use the root account for anything other than database management. - -Strongly consider also installing [pgAdmin](https://github.com/GhostWriters/DockSTARTer/tree/master/compose/.apps/pgadmin) for adminsitration and [pgBackup](https://github.com/GhostWriters/DockSTARTer/tree/master/compose/.apps/pgbackup) for periodic rotating backups. - -## Common Activities - -### Create user - -``` sql -CREATE USER newuser WITH PASSWORD 'password123'; -``` - -### Make user a superuser - -``` sql -CREATE USER newadmin WITH PASSWORD 'password123'; -ALTER USER newadmin WITH SUPERUSER; -``` - -### Create a database and owner to the new user - -CREATE DATABASE newdatabase; -ALTER DATABASE newdatabase OWNER TO newuser; +# PostgresSQL + +[![Docker Pulls](https://img.shields.io/docker/pulls/_/postgres?style=flat-square&color=607D8B&label=docker%20pulls&logo=docker)](https://hub.docker.com/r/_/postgres) +[![GitHub Stars](https://img.shields.io/github/stars/docker-library/postgres?style=flat-square&color=607D8B&label=github%20stars&logo=github)](https://github.com/docker-library/postgres) +[![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/postgres) + +## Description + +[Postgres](https://www.postgresql.org/): The World's Most Advanced Open Source Relational Database + +## Install/Setup + +PostgreSQL is a powerful, open source object-relational database system with over 35 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance. + +There is a wealth of information to be found describing how to [install](https://www.postgresql.org/download/) and [use](https://www.postgresql.org/docs/) PostgreSQL through the [official documentation](https://www.postgresql.org/docs/). The [open source community](https://www.postgresql.org/community/) provides many helpful places to become familiar with PostgreSQL, discover how it works. + +We **heavily** recommend that if you spin up a container that requires a database you create a user for that container. You should **NEVER** use the root account for anything other than database management. + +Strongly consider also installing [pgAdmin](https://github.com/GhostWriters/DockSTARTer/tree/master/compose/.apps/pgadmin) for adminsitration and [pgBackup](https://github.com/GhostWriters/DockSTARTer/tree/master/compose/.apps/pgbackup) for periodic rotating backups. + +## Common Activities + +### Create user + +``` sql +CREATE USER newuser WITH PASSWORD 'password123'; +``` + +### Make user a superuser + +``` sql +CREATE USER newadmin WITH PASSWORD 'password123'; +ALTER USER newadmin WITH SUPERUSER; +``` + +### Create a database and owner to the new user + +CREATE DATABASE newdatabase; +ALTER DATABASE newdatabase OWNER TO newuser; From fc918d125b5c3dd8d5a76ed64ded2038a4db6429 Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Wed, 22 Nov 2023 15:18:54 -0600 Subject: [PATCH 19/19] fix: adjust line endings and chmod Signed-off-by: Eric Nemchik --- docs/apps/pgadmin.md | 34 +++++++++--------- docs/apps/pgbackup.md | 82 +++++++++++++++++++++---------------------- docs/apps/postgres.md | 78 ++++++++++++++++++++-------------------- 3 files changed, 97 insertions(+), 97 deletions(-) diff --git a/docs/apps/pgadmin.md b/docs/apps/pgadmin.md index 2c0d81adfa..7ac372bfbc 100644 --- a/docs/apps/pgadmin.md +++ b/docs/apps/pgadmin.md @@ -1,17 +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 +# 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 diff --git a/docs/apps/pgbackup.md b/docs/apps/pgbackup.md index 174eecd855..e5a978e11d 100644 --- a/docs/apps/pgbackup.md +++ b/docs/apps/pgbackup.md @@ -1,41 +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 - -```bash -docker exec -it /bin/sh -c "zcat /storage/backups/postgres/last/-latest.sql.gz | psql --username= --dbname= -W" -``` +# 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 + +```bash +docker exec -it /bin/sh -c "zcat /storage/backups/postgres/last/-latest.sql.gz | psql --username= --dbname= -W" +``` diff --git a/docs/apps/postgres.md b/docs/apps/postgres.md index c4314f93a6..bdb2e69b14 100644 --- a/docs/apps/postgres.md +++ b/docs/apps/postgres.md @@ -1,39 +1,39 @@ -# PostgresSQL - -[![Docker Pulls](https://img.shields.io/docker/pulls/_/postgres?style=flat-square&color=607D8B&label=docker%20pulls&logo=docker)](https://hub.docker.com/r/_/postgres) -[![GitHub Stars](https://img.shields.io/github/stars/docker-library/postgres?style=flat-square&color=607D8B&label=github%20stars&logo=github)](https://github.com/docker-library/postgres) -[![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/postgres) - -## Description - -[Postgres](https://www.postgresql.org/): The World's Most Advanced Open Source Relational Database - -## Install/Setup - -PostgreSQL is a powerful, open source object-relational database system with over 35 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance. - -There is a wealth of information to be found describing how to [install](https://www.postgresql.org/download/) and [use](https://www.postgresql.org/docs/) PostgreSQL through the [official documentation](https://www.postgresql.org/docs/). The [open source community](https://www.postgresql.org/community/) provides many helpful places to become familiar with PostgreSQL, discover how it works. - -We **heavily** recommend that if you spin up a container that requires a database you create a user for that container. You should **NEVER** use the root account for anything other than database management. - -Strongly consider also installing [pgAdmin](https://github.com/GhostWriters/DockSTARTer/tree/master/compose/.apps/pgadmin) for adminsitration and [pgBackup](https://github.com/GhostWriters/DockSTARTer/tree/master/compose/.apps/pgbackup) for periodic rotating backups. - -## Common Activities - -### Create user - -``` sql -CREATE USER newuser WITH PASSWORD 'password123'; -``` - -### Make user a superuser - -``` sql -CREATE USER newadmin WITH PASSWORD 'password123'; -ALTER USER newadmin WITH SUPERUSER; -``` - -### Create a database and owner to the new user - -CREATE DATABASE newdatabase; -ALTER DATABASE newdatabase OWNER TO newuser; +# PostgresSQL + +[![Docker Pulls](https://img.shields.io/docker/pulls/_/postgres?style=flat-square&color=607D8B&label=docker%20pulls&logo=docker)](https://hub.docker.com/r/_/postgres) +[![GitHub Stars](https://img.shields.io/github/stars/docker-library/postgres?style=flat-square&color=607D8B&label=github%20stars&logo=github)](https://github.com/docker-library/postgres) +[![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/postgres) + +## Description + +[Postgres](https://www.postgresql.org/): The World's Most Advanced Open Source Relational Database + +## Install/Setup + +PostgreSQL is a powerful, open source object-relational database system with over 35 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance. + +There is a wealth of information to be found describing how to [install](https://www.postgresql.org/download/) and [use](https://www.postgresql.org/docs/) PostgreSQL through the [official documentation](https://www.postgresql.org/docs/). The [open source community](https://www.postgresql.org/community/) provides many helpful places to become familiar with PostgreSQL, discover how it works. + +We **heavily** recommend that if you spin up a container that requires a database you create a user for that container. You should **NEVER** use the root account for anything other than database management. + +Strongly consider also installing [pgAdmin](https://github.com/GhostWriters/DockSTARTer/tree/master/compose/.apps/pgadmin) for adminsitration and [pgBackup](https://github.com/GhostWriters/DockSTARTer/tree/master/compose/.apps/pgbackup) for periodic rotating backups. + +## Common Activities + +### Create user + +```sql +CREATE USER newuser WITH PASSWORD 'password123'; +``` + +### Make user a superuser + +```sql +CREATE USER newadmin WITH PASSWORD 'password123'; +ALTER USER newadmin WITH SUPERUSER; +``` + +### Create a database and owner to the new user + +CREATE DATABASE newdatabase; +ALTER DATABASE newdatabase OWNER TO newuser;