From f043b75fd41c2fe95864f5feb42fd1ebe452242e Mon Sep 17 00:00:00 2001 From: javielico Date: Wed, 12 Aug 2026 14:20:20 +0100 Subject: [PATCH] init pgsql --- README.md | 8 +++---- compose.yml | 60 +++++++++++++++++++++++++++++++++-------------------- 2 files changed, 41 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index ee81d3c..bdc3a3c 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ -# pgsql +# PostgreSQL -> One line description of the recipe +> 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. * **Category**: Apps * **Status**: 0 -* **Image**: [`pgsql`](https://hub.docker.com/r/pgsql), 4, upstream +* **Image**: [`pgautoupgrade/pgautoupgrade`](https://hub.docker.com/r/pgautoupgrade/pgautoupgrade), 4, upstream * **Healthcheck**: No -* **Backups**: No +* **Backups**: Yes * **Email**: No * **Tests**: No * **SSO**: No diff --git a/compose.yml b/compose.yml index 5e77224..975291f 100644 --- a/compose.yml +++ b/compose.yml @@ -1,39 +1,53 @@ --- +version: "3.8" + services: - app: - image: nginx:1.27.5 + pgautoupgrade: + image: pgautoupgrade/pgautoupgrade:18-alpine networks: - proxy + environment: + PGHOST: postgres + PGPORT: "5432" + PGDATABASE: postgres + PGUSER_FILE: /run/secrets/pguser + PGPASSWORD_FILE: /run/secrets/pgpassword + secrets: + - pguser + - pgpassword + volumes: + - pgdata:/var/lib/postgresql/data + - pglogs:/var/log/postgresql + deploy: restart_policy: condition: on-failure labels: - - "traefik.enable=true" - - "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=80" - - "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})" - - "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure" - - "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}" - ## Edit the following line if you are using one, but not both, "Redirect" sections below - #- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirectscheme,${STACK_NAME}-redirecthostname" - ## Redirect from EXTRA_DOMAINS to DOMAIN - # - "traefik.http.middlewares.${STACK_NAME}-redirecthostname.redirectregex.regex=^http[s]?://([^/]*)/(.*)" - # - "traefik.http.middlewares.${STACK_NAME}-redirecthostname.redirectregex.replacement=https://${DOMAIN}/$${2}" - # - "traefik.http.middlewares.${STACK_NAME}-redirecthostname.redirectregex.permanent=true" - ## Redirect HTTP to HTTPS - # - "traefik.http.middlewares.${STACK_NAME}-redirectscheme.redirectscheme.scheme=https" - # - "traefik.http.middlewares.${STACK_NAME}-redirectscheme.redirectscheme.permanent=true" - ## When you're ready for release, run "abra recipe sync " to set this - - "coop-cloud.${STACK_NAME}.version=" - ## Enable backups: https://docs.coopcloud.tech/maintainers/handbook/#how-do-i-configure-backuprestore - # - "backupbot.backup=true" - # - "backupbot.backup.path=/some/path" + - "backupbot.backup=true" + - "backupbot.backup.path=/var/lib/postgresql/data/,/var/log/postgresql/" + - "coop-cloud.${STACK_NAME}.timeout=${TIMEOUT:-240}" + - "coop-cloud.${STACK_NAME}.version=18-alpine" + - "traefik.enable=false" + healthcheck: - test: ["CMD", "curl", "-f", "http://localhost"] + test: ["CMD-SHELL", "ps -ef | grep -v grep | grep -qi pgautoupgrade || exit 1"] interval: 30s timeout: 10s retries: 10 - start_period: 1m + start_period: 30s networks: proxy: external: true + +volumes: + pgdata: + pglogs: + +secrets: + pguser: + external: true + name: ${STACK_NAME}_pguser_${SECRET_PGUSER_VERSION} + pgpassword: + external: true + name: ${STACK_NAME}_pgpassword_${SECRET_PGPASSWORD_VERSION}