This commit is contained in:
Mike McFetridge
2026-07-20 09:23:17 -04:00
parent c1315882da
commit 72272e4006
3179 changed files with 562960 additions and 14 deletions
+71
View File
@@ -0,0 +1,71 @@
services:
<< service_name >>:
image: docker.io/library/postgres:18.3
hostname: << container_hostname >>
environment:
- POSTGRES_INITDB_ARGS=<< postgres_initdb_args >>
<%- if postgres_host_auth_method %>
- POSTGRES_HOST_AUTH_METHOD=<< postgres_host_auth_method >>
<%- endif %>
- POSTGRES_USER=<< database_user >>
- POSTGRES_PASSWORD=<< database_password >>
- POSTGRES_DB=<< database_name >>
- TZ=<< container_timezone >>
<%- if network_mode == 'bridge' or network_mode == '' %>
networks:
<< network_name >>:
<%- endif %>
<%- if network_mode == 'bridge' or network_mode == '' %>
ports:
- target: 5432
published: << ports_postgres >>
protocol: tcp
mode: host
<%- endif %>
volumes:
<%- if volume_mode == 'mount' %>
- << volume_mount_path >>:/var/lib/postgresql:rw
<%- else %>
- << service_name >>-data:/var/lib/postgresql
<%- endif %>
healthcheck:
test: ["CMD-SHELL", "pg_isready -U << database_user >>"]
start_period: 30s
interval: 10s
timeout: 10s
retries: 5
deploy:
mode: replicated
replicas: 1
<%- if swarm_placement_host %>
placement:
constraints:
- node.hostname == << swarm_placement_host >>
<%- endif %>
restart_policy:
condition: on-failure
<%- if volume_mode == 'local' %>
volumes:
<< service_name >>-data:
driver: local
<%- elif volume_mode == 'nfs' %>
volumes:
<< service_name >>-data:
driver: local
driver_opts:
type: nfs
o: addr=<< volume_nfs_server >>,<< volume_nfs_options >>
device: ":<< volume_nfs_path >>"
<%- endif %>
<%- if network_mode == 'bridge' or network_mode == '' %>
networks:
<< network_name >>:
<%- if network_external %>
external: true
<%- else %>
driver: overlay
attachable: true
<%- endif %>
<%- endif %>