1+ # ==============================================================================
2+ # Environment variables (copy to a .env file in the same directory)
3+ #
4+ # POSTGRES_USER=postgres
5+ # POSTGRES_PASSWORD=postgres
6+ # POSTGRES_DB=nimletter_db
7+ #
8+ # SMTP_HOST=smtp.example.com
9+ # SMTP_PORT=465
10+ # SMTP_USER=user@example.com
11+ # SMTP_PASSWORD=changeme
12+ # SMTP_FROMEMAIL=noreply@example.com
13+ # SMTP_FROMNAME="App Notifications"
14+ # SMTP_MAILSPERSECOND=1
15+ #
16+ # ADMIN_EMAIL=admin@example.com
17+ # ADMIN_PASSWORD=supersecurepassword
18+ #
19+ # SNS_WEBHOOK_SECRET=randomlongsecret
20+ #
21+ # NIMLETTER_HOST=letter.example.com
22+ # DBGATE_HOST=db.example.com
23+ # ==============================================================================
24+
25+ version : ' 3.9'
26+
127services :
228
3- postgres :
4- image : docker.io/postgres:17.2 -alpine
5- container_name : postgres
29+ postgres-db :
30+ image : docker.io/postgres:17-alpine
31+ container_name : postgres-db
632 restart : unless-stopped
733 environment :
8- POSTGRES_USER : postgres
9- POSTGRES_PASSWORD : postgres
10- POSTGRES_DB : nimletter_db
34+ POSTGRES_USER : ${POSTGRES_USER}
35+ POSTGRES_PASSWORD : ${POSTGRES_PASSWORD}
36+ POSTGRES_DB : ${POSTGRES_DB}
1137 volumes :
12- - postgres_data :/var/lib/postgresql/data
13- ports :
14- - " 5432:5432 "
38+ - ./data/postgres :/var/lib/postgresql/data
39+ networks :
40+ - app-net
1541 healthcheck :
16- test : ["CMD-SHELL", "pg_isready -U postgres"]
17- interval : 10s
18- retries : 5
19- network_mode : host
42+ test : ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
43+ start_period : 4s
44+ interval : 16s
45+ timeout : 8s
46+ retries : 4
2047
2148 nimletter :
2249 image : ghcr.io/thomastjdev/nimletter:latest
2350 container_name : nimletter
2451 restart : unless-stopped
2552 depends_on :
26- postgres :
53+ postgres-db :
2754 condition : service_healthy
2855 environment :
29- PG_HOST : 127.0.0.1 :5432
30- PG_USER : postgres
31- PG_PASSWORD : postgres
32- PG_DATABASE : nimletter_db
56+ PG_HOST : postgres-db :5432
57+ PG_USER : ${POSTGRES_USER}
58+ PG_PASSWORD : ${POSTGRES_PASSWORD}
59+ PG_DATABASE : ${POSTGRES_DB}
3360 PG_WORKERS : 3
34- SMTP_HOST : smtp_host
35- SMTP_PORT : 465
36- SMTP_USER : smtp_username
37- SMTP_PASSWORD : smtp_password
38- SMTP_FROMEMAIL : admin@nimletter.com
39- SMTP_FROMNAME : ADMIN
40- # Maximum number of emails to send per second
41- SMTP_MAILSPERSECOND : 1
42- # Use a random long string - it's part of the route to the webhook
43- SNS_WEBHOOK_SECRET : secret
44- ports :
45- - " 5555:5555"
46- network_mode : host
61+ SMTP_HOST : ${SMTP_HOST}
62+ SMTP_PORT : ${SMTP_PORT}
63+ SMTP_USER : ${SMTP_USER}
64+ SMTP_PASSWORD : ${SMTP_PASSWORD}
65+ SMTP_FROMEMAIL : ${SMTP_FROMEMAIL}
66+ SMTP_FROMNAME : ${SMTP_FROMNAME}
67+ SMTP_MAILSPERSECOND : ${SMTP_MAILSPERSECOND}
68+ ADMIN_EMAIL : ${ADMIN_EMAIL}
69+ ADMIN_PASSWORD : ${ADMIN_PASSWORD}
70+ SNS_WEBHOOK_SECRET : ${SNS_WEBHOOK_SECRET}
71+ networks :
72+ - app-net
73+ - proxy
74+ labels :
75+ - ' traefik.enable=true'
76+ - ' traefik.http.routers.nimletter.rule=Host(`${NIMLETTER_HOST}`)'
77+ - ' traefik.http.routers.nimletter.entrypoints=https'
78+ - ' traefik.http.routers.nimletter.tls=true'
79+ - ' traefik.http.routers.nimletter.tls.certresolver=letsencrypt'
80+ - ' traefik.http.routers.nimletter.middlewares=authelia@docker,error-pages@docker'
81+ - ' traefik.http.routers.nimletter.service=nimletter-service'
82+ - ' traefik.http.services.nimletter-service.loadbalancer.server.port=5555'
83+
84+ dbgate :
85+ image : dbgate/dbgate
86+ container_name : dbgate
87+ restart : always
88+ environment :
89+ CONNECTIONS : con2
90+ LABEL_con2 : PostgreSQL
91+ SERVER_con2 : postgres-db
92+ USER_con2 : ${POSTGRES_USER}
93+ PASSWORD_con2 : ${POSTGRES_PASSWORD}
94+ PORT_con2 : 5432
95+ ENGINE_con2 : postgres@dbgate-plugin-postgres
96+ depends_on :
97+ postgres-db :
98+ condition : service_healthy
99+ networks :
100+ - app-net
101+ - proxy
102+ labels :
103+ - ' traefik.enable=true'
104+ - ' traefik.http.routers.dbgate.rule=Host(`${DBGATE_HOST}`)'
105+ - ' traefik.http.routers.dbgate.entrypoints=https'
106+ - ' traefik.http.routers.dbgate.tls=true'
107+ - ' traefik.http.routers.dbgate.tls.certresolver=letsencrypt'
108+ - ' traefik.http.routers.dbgate.middlewares=authelia@docker,error-pages@docker'
109+ - ' traefik.http.routers.dbgate.service=dbgate-service'
110+ - ' traefik.http.services.dbgate-service.loadbalancer.server.port=3000'
47111
48- volumes :
49- postgres_data:
112+ networks :
113+ app-net :
114+ name : app-net
115+ proxy :
116+ external : true
0 commit comments