This commit is contained in:
parent
f353f67150
commit
e8bbb4b167
@ -1,3 +1,4 @@
|
|||||||
|
{% import 'macro/postgres.j2' as pg with context %}
|
||||||
---
|
---
|
||||||
version: '3.9'
|
version: '3.9'
|
||||||
|
|
||||||
@ -36,22 +37,7 @@ services:
|
|||||||
db:
|
db:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
|
||||||
db:
|
{{ pg.postgres("db", gitea.db.user, gitea.db.password, gitea.db.name, ["backend"], version="14" ) }}
|
||||||
image: postgres:14
|
|
||||||
restart: always
|
|
||||||
environment:
|
|
||||||
- "POSTGRES_USER={{ gitea.db.user }}"
|
|
||||||
- "POSTGRES_PASSWORD={{ gitea.db.password }}"
|
|
||||||
- "POSTGRES_DB={{ gitea.db.name }}"
|
|
||||||
networks:
|
|
||||||
- backend
|
|
||||||
volumes:
|
|
||||||
- pg_data:/var/lib/postgresql/data
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "pg_isready", "-U", "{{ gitea.db.user }}"]
|
|
||||||
interval: 10s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 5
|
|
||||||
|
|
||||||
drone:
|
drone:
|
||||||
image: drone/drone:2
|
image: drone/drone:2
|
||||||
@ -82,11 +68,13 @@ services:
|
|||||||
- gitea
|
- gitea
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
|
postgres:
|
||||||
|
internal: true
|
||||||
backend:
|
backend:
|
||||||
internal: true
|
internal: true
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
gitea_data:
|
gitea_data:
|
||||||
drone_data:
|
drone_data:
|
||||||
pg_data:
|
db_data:
|
||||||
...
|
...
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
{% import 'macro/postgres.j2' as pg with context %}
|
||||||
---
|
---
|
||||||
version: '3'
|
version: '3'
|
||||||
services:
|
services:
|
||||||
@ -53,27 +54,16 @@ services:
|
|||||||
- default
|
- default
|
||||||
- metrics
|
- metrics
|
||||||
|
|
||||||
db:
|
{{ pg.postgres("db", gotosocial.db.user, gotosocial.db.password, gotosocial.db.user, ["backend"]) }}
|
||||||
image: postgres:15
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
- POSTGRES_USER={{ gotosocial.db.user }}
|
|
||||||
- POSTGRES_PASSWORD={{ gotosocial.db.password }}
|
|
||||||
volumes:
|
|
||||||
- database:/var/lib/postgresql/data
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "pg_isready", "-U", "{{ gotosocial.db.user }}"]
|
|
||||||
interval: 10s
|
|
||||||
start_period: 30s
|
|
||||||
networks:
|
|
||||||
- backend
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
database:
|
db_data:
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
backend:
|
backend:
|
||||||
internal: true
|
internal: true
|
||||||
metrics:
|
metrics:
|
||||||
external: true
|
external: true
|
||||||
|
postgres:
|
||||||
|
internal: true
|
||||||
...
|
...
|
||||||
|
@ -44,3 +44,5 @@ networks:
|
|||||||
internal: true
|
internal: true
|
||||||
metrics:
|
metrics:
|
||||||
external: true
|
external: true
|
||||||
|
postgres:
|
||||||
|
internal: true
|
||||||
|
@ -1,23 +1,7 @@
|
|||||||
|
{% import 'macro/postgres.j2' as pg with context %}
|
||||||
---
|
---
|
||||||
version: '3'
|
version: '3'
|
||||||
services:
|
services:
|
||||||
database:
|
|
||||||
image: postgres:13-alpine
|
|
||||||
environment:
|
|
||||||
- POSTGRES_USER={{ hedgedoc.db.user }}
|
|
||||||
- POSTGRES_PASSWORD={{ hedgedoc.db.password }}
|
|
||||||
- POSTGRES_DB={{ hedgedoc.db.name }}
|
|
||||||
volumes:
|
|
||||||
- database:/var/lib/postgresql/data
|
|
||||||
restart: always
|
|
||||||
networks:
|
|
||||||
- backend
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "pg_isready", "-U", "{{ hedgedoc.db.user }}"]
|
|
||||||
interval: 10s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 5
|
|
||||||
|
|
||||||
app:
|
app:
|
||||||
# Make sure to use the latest release from https://hedgedoc.org/latest-release
|
# Make sure to use the latest release from https://hedgedoc.org/latest-release
|
||||||
image: quay.io/hedgedoc/hedgedoc:1.9.3
|
image: quay.io/hedgedoc/hedgedoc:1.9.3
|
||||||
@ -63,19 +47,22 @@ services:
|
|||||||
- "prometheus-scrape.enabled=true"
|
- "prometheus-scrape.enabled=true"
|
||||||
- "prometheus-scrape.port=3000"
|
- "prometheus-scrape.port=3000"
|
||||||
depends_on:
|
depends_on:
|
||||||
database:
|
db:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
networks:
|
networks:
|
||||||
- backend
|
- backend
|
||||||
- metrics
|
- metrics
|
||||||
- default # oauth
|
- default # oauth
|
||||||
|
{{ pg.postgres("db", hedgedoc.db.user, hedgedoc.db.password, hedgedoc.db.name, ["backend"], version="13-alpine") }}
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
database:
|
db_data:
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
backend:
|
backend:
|
||||||
internal: true
|
internal: true
|
||||||
metrics:
|
metrics:
|
||||||
external: true
|
external: true
|
||||||
|
postgres:
|
||||||
|
internal: true
|
||||||
...
|
...
|
||||||
|
@ -1,29 +1,13 @@
|
|||||||
|
{% import 'macro/postgres.j2' as pg with context %}
|
||||||
---
|
---
|
||||||
version: '3.9'
|
version: '3.9'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
postgres:
|
|
||||||
image: postgres:15
|
|
||||||
restart: always
|
|
||||||
environment:
|
|
||||||
- "POSTGRES_DB={{ auth.db.name }}"
|
|
||||||
- "POSTGRES_USER={{ auth.db.user }}"
|
|
||||||
- "POSTGRES_PASSWORD={{ auth.db.password }}"
|
|
||||||
volumes:
|
|
||||||
- pg_data:/var/lib/postgresql/data
|
|
||||||
networks:
|
|
||||||
- backend
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "pg_isready", "-U", "{{ auth.db.user }}"]
|
|
||||||
interval: 10s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 5
|
|
||||||
|
|
||||||
keycloak:
|
keycloak:
|
||||||
image: registry.tobiasmanske.de/keycloak:main
|
image: registry.tobiasmanske.de/keycloak:main
|
||||||
command: start
|
command: start
|
||||||
depends_on:
|
depends_on:
|
||||||
postgres:
|
pg:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
environment:
|
environment:
|
||||||
- "KC_DB=postgres"
|
- "KC_DB=postgres"
|
||||||
@ -46,7 +30,11 @@ services:
|
|||||||
- backend
|
- backend
|
||||||
- default # keycloak needs to talk to social logins
|
- default # keycloak needs to talk to social logins
|
||||||
|
|
||||||
|
{{ pg.postgres("pg", auth.db.user, auth.db.password, auth.db.name, ["backend"]) }}
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
|
postgres:
|
||||||
|
internal: true
|
||||||
backend:
|
backend:
|
||||||
internal: true
|
internal: true
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
{% import 'macro/postgres.j2' as pg with context %}
|
||||||
---
|
---
|
||||||
version: '3.9'
|
version: '3.9'
|
||||||
|
|
||||||
@ -46,23 +47,7 @@ services:
|
|||||||
- "prometheus-scrape.port=9091"
|
- "prometheus-scrape.port=9091"
|
||||||
- "prometheus-scrape.metrics_path=/_synapse/metrics"
|
- "prometheus-scrape.metrics_path=/_synapse/metrics"
|
||||||
|
|
||||||
db:
|
{{ pg.postgres("db", matrix.db.user, matrix.db.password, matrix.db.database, ["backend"], schedule="@hourly" ) }}
|
||||||
image: postgres:15
|
|
||||||
restart: always
|
|
||||||
environment:
|
|
||||||
- POSTGRES_USER={{ matrix.db.user }}
|
|
||||||
- POSTGRES_DB={{ matrix.db.database }}
|
|
||||||
- POSTGRES_PASSWORD={{ matrix.db.password }}
|
|
||||||
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
|
|
||||||
networks:
|
|
||||||
- backend
|
|
||||||
volumes:
|
|
||||||
- db_data:/var/lib/postgresql/data
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "pg_isready", "-U", "{{ matrix.db.user }}"]
|
|
||||||
interval: 10s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 5
|
|
||||||
|
|
||||||
caddy:
|
caddy:
|
||||||
image: caddy:2
|
image: caddy:2
|
||||||
@ -98,23 +83,7 @@ services:
|
|||||||
|
|
||||||
### SLIDING SYNC
|
### SLIDING SYNC
|
||||||
|
|
||||||
syncv3-db:
|
{{ pg.postgres("db-syncv3", matrix.syncv3.user, matrix.syncv3.password, matrix.syncv3.database, ["syncv3"] ) }}
|
||||||
image: postgres:15
|
|
||||||
restart: always
|
|
||||||
environment:
|
|
||||||
- POSTGRES_USER={{ matrix.syncv3.user }}
|
|
||||||
- POSTGRES_DB={{ matrix.syncv3.database }}
|
|
||||||
- POSTGRES_PASSWORD={{ matrix.syncv3.password }}
|
|
||||||
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
|
|
||||||
networks:
|
|
||||||
- syncv3
|
|
||||||
volumes:
|
|
||||||
- syncv3_db_data:/var/lib/postgresql/data
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "pg_isready", "-U", "{{ matrix.syncv3.user }}"]
|
|
||||||
interval: 10s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 5
|
|
||||||
|
|
||||||
syncv3-proxy:
|
syncv3-proxy:
|
||||||
image: ghcr.io/matrix-org/sliding-sync:latest
|
image: ghcr.io/matrix-org/sliding-sync:latest
|
||||||
@ -158,23 +127,7 @@ services:
|
|||||||
- db-bridge-tg
|
- db-bridge-tg
|
||||||
- synapse
|
- synapse
|
||||||
|
|
||||||
db-bridge-tg:
|
{{ pg.postgres("db-bridge-tg", matrix.bridge.tg.dbuser, matrix.bridge.tg.dbpass, matrix.bridge.tg.dbname, ["backend"] ) }}
|
||||||
image: postgres:15
|
|
||||||
restart: always
|
|
||||||
environment:
|
|
||||||
- POSTGRES_USER={{ matrix.bridge.tg.dbuser }}
|
|
||||||
- POSTGRES_DB={{ matrix.bridge.tg.dbname }}
|
|
||||||
- POSTGRES_PASSWORD={{ matrix.bridge.tg.dbpass }}
|
|
||||||
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
|
|
||||||
networks:
|
|
||||||
- backend
|
|
||||||
volumes:
|
|
||||||
- bridge_tg_db:/var/lib/postgresql/data
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "pg_isready", "-U", "{{ matrix.bridge.tg.dbuser }}"]
|
|
||||||
interval: 10s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 5
|
|
||||||
|
|
||||||
#### SLACK
|
#### SLACK
|
||||||
|
|
||||||
@ -195,23 +148,7 @@ services:
|
|||||||
- db-bridge-slack
|
- db-bridge-slack
|
||||||
- synapse
|
- synapse
|
||||||
|
|
||||||
db-bridge-slack:
|
{{ pg.postgres("db-bridge-slack", matrix.bridge.slack.dbuser, matrix.bridge.slack.dbpass, matrix.bridge.slack.dbname, ["backend"] ) }}
|
||||||
image: postgres:15
|
|
||||||
restart: always
|
|
||||||
environment:
|
|
||||||
- POSTGRES_USER={{ matrix.bridge.slack.dbuser }}
|
|
||||||
- POSTGRES_DB={{ matrix.bridge.slack.dbname }}
|
|
||||||
- POSTGRES_PASSWORD={{ matrix.bridge.slack.dbpass }}
|
|
||||||
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
|
|
||||||
networks:
|
|
||||||
- backend
|
|
||||||
volumes:
|
|
||||||
- bridge_slack_db:/var/lib/postgresql/data
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "pg_isready", "-U", "{{ matrix.bridge.slack.dbuser }}"]
|
|
||||||
interval: 10s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 5
|
|
||||||
|
|
||||||
#### SIGNAL
|
#### SIGNAL
|
||||||
mautrix-signal:
|
mautrix-signal:
|
||||||
@ -241,24 +178,11 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- signald_data:/signald
|
- signald_data:/signald
|
||||||
|
|
||||||
db-bridge-signal:
|
{{ pg.postgres("db-bridge-signal", matrix.bridge.signal.dbuser, matrix.bridge.signal.dbpass, matrix.bridge.signal.dbname, ["backend"] ) }}
|
||||||
image: postgres:15
|
|
||||||
restart: unless-stopped
|
|
||||||
networks:
|
|
||||||
- backend
|
|
||||||
environment:
|
|
||||||
- POSTGRES_USER={{ matrix.bridge.signal.dbuser }}
|
|
||||||
- POSTGRES_DB={{ matrix.bridge.signal.dbname }}
|
|
||||||
- POSTGRES_PASSWORD={{ matrix.bridge.signal.dbpass }}
|
|
||||||
volumes:
|
|
||||||
- bridge_signal_db:/var/lib/postgresql/data
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "pg_isready", "-U", "{{ matrix.bridge.signal.dbuser }}"]
|
|
||||||
interval: 10s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 5
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
|
postgres:
|
||||||
|
internal: true
|
||||||
backend:
|
backend:
|
||||||
internal: true
|
internal: true
|
||||||
syncv3:
|
syncv3:
|
||||||
@ -267,14 +191,14 @@ networks:
|
|||||||
external: true
|
external: true
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
synapse_data:
|
|
||||||
syncv3_db_data:
|
|
||||||
bridge_tg_data:
|
|
||||||
bridge_tg_db:
|
|
||||||
bridge_slack_data:
|
|
||||||
bridge_slack_db:
|
|
||||||
bridge_signal_data:
|
bridge_signal_data:
|
||||||
bridge_signal_db:
|
bridge_slack_data:
|
||||||
signald_data:
|
bridge_tg_data:
|
||||||
|
db-bridge-signal_data:
|
||||||
|
db-bridge-slack_data:
|
||||||
|
db-bridge-tg_data:
|
||||||
|
db-syncv3_data:
|
||||||
db_data:
|
db_data:
|
||||||
|
signald_data:
|
||||||
|
synapse_data:
|
||||||
...
|
...
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
{% import 'macro/postgres.j2' as pg with context %}
|
||||||
---
|
---
|
||||||
version: '3'
|
version: '3'
|
||||||
services:
|
services:
|
||||||
@ -39,23 +40,10 @@ services:
|
|||||||
- default
|
- default
|
||||||
- metrics
|
- metrics
|
||||||
|
|
||||||
db:
|
{{ pg.postgres("db", miniflux.db.user, miniflux.db.password, miniflux.db.user, ["backend"], version="13") }}
|
||||||
image: postgres:13
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
- POSTGRES_USER={{ miniflux.db.user }}
|
|
||||||
- POSTGRES_PASSWORD={{ miniflux.db.password }}
|
|
||||||
volumes:
|
|
||||||
- database:/var/lib/postgresql/data
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "pg_isready", "-U", "{{ miniflux.db.user }}"]
|
|
||||||
interval: 10s
|
|
||||||
start_period: 30s
|
|
||||||
networks:
|
|
||||||
- backend
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
database:
|
db_data:
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
backend:
|
backend:
|
||||||
@ -64,4 +52,6 @@ networks:
|
|||||||
external: true
|
external: true
|
||||||
metrics:
|
metrics:
|
||||||
external: true
|
external: true
|
||||||
|
postgres:
|
||||||
|
internal: true
|
||||||
...
|
...
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
{% import 'macro/postgres.j2' as pg with context %}
|
||||||
---
|
---
|
||||||
version: '3'
|
version: '3'
|
||||||
services:
|
services:
|
||||||
@ -29,25 +30,14 @@ services:
|
|||||||
- backend
|
- backend
|
||||||
- default
|
- default
|
||||||
|
|
||||||
db:
|
{{ pg.postgres("db", wallabag.db.user, wallabag.db.password, wallabag.db.user, ["backend"], version="15-alpine") }}
|
||||||
image: postgres:15-alpine
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
- POSTGRES_USER={{ wallabag.db.user }}
|
|
||||||
- POSTGRES_PASSWORD={{ wallabag.db.password }}
|
|
||||||
volumes:
|
|
||||||
- database:/var/lib/postgresql/data
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "pg_isready", "-U", "{{ wallabag.db.user }}"]
|
|
||||||
interval: 10s
|
|
||||||
start_period: 30s
|
|
||||||
networks:
|
|
||||||
- backend
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
database:
|
db_data:
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
backend:
|
backend:
|
||||||
internal: true
|
internal: true
|
||||||
|
postgres:
|
||||||
|
internal: true
|
||||||
...
|
...
|
||||||
|
36
ansible/plays/templates/macro/postgres.j2
Normal file
36
ansible/plays/templates/macro/postgres.j2
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
{# https://github.com/prodrigestivill/docker-postgres-backup-local #}
|
||||||
|
{% macro postgres(name, user, pass, db, networks, schedule="@daily", version="15") %}
|
||||||
|
{{ name | mandatory | string }}:
|
||||||
|
image: postgres:{{ version | mandatory }}
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER={{ user | mandatory }}
|
||||||
|
- POSTGRES_DB={{ db | mandatory }}
|
||||||
|
- POSTGRES_PASSWORD={{ pass | mandatory }}
|
||||||
|
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
|
||||||
|
networks: {{ networks | mandatory | list | union(["postgres"]) | sort }}
|
||||||
|
volumes:
|
||||||
|
- {{ name | string | lower }}_data:/var/lib/postgresql/data
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready", "-U", "{{ user }}"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
{{ name | mandatory | string }}_pgbackup:
|
||||||
|
image: prodrigestivill/postgres-backup-local:latest
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- "/opt/pgbackups/${COMPOSE_PROJECT_NAME}/:/backups:z"
|
||||||
|
networks:
|
||||||
|
- postgres
|
||||||
|
depends_on:
|
||||||
|
- {{ name | mandatory | string }}
|
||||||
|
environment:
|
||||||
|
- POSTGRES_HOST={{ name | mandatory | string }}
|
||||||
|
- POSTGRES_USER={{ user | mandatory }}
|
||||||
|
- POSTGRES_DB={{ db | mandatory }}
|
||||||
|
- POSTGRES_PASSWORD={{ pass | mandatory }}
|
||||||
|
- POSTGRES_EXTRA_OPTS=-Z6 --schema=public --blobs
|
||||||
|
- SCHEDULE={{ schedule | mandatory }}
|
||||||
|
{% endmacro %}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user