Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
93 lines (89 loc) · 2.9 KB
/
Copy pathdocker-compose.yml
File metadata and controls
93 lines (89 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
services:
db:
image: postgres:17-alpine
restart: unless-stopped
environment:
POSTGRES_USER: bugfree
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-bugfree}
POSTGRES_DB: bugfree
ports:
# Local access only (dev tools, psql); the API reaches it over the compose network.
- "127.0.0.1:5442:5432"
volumes:
- db-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U bugfree"]
interval: 5s
timeout: 3s
retries: 10
# Daily pg_dump to ./backups, keeping BACKUP_KEEP_DAYS days. Restore with:
# docker compose exec -T db pg_restore -U bugfree -d bugfree --clean < backups/bugfree-<date>.dump
backup:
image: postgres:17-alpine
restart: unless-stopped
environment:
PGHOST: db
PGUSER: bugfree
PGPASSWORD: ${POSTGRES_PASSWORD:-bugfree}
PGDATABASE: bugfree
BACKUP_KEEP_DAYS: ${BACKUP_KEEP_DAYS:-7}
BACKUP_INTERVAL_HOURS: ${BACKUP_INTERVAL_HOURS:-24}
volumes:
- ./backups:/backups
entrypoint:
- /bin/sh
- -c
- |
while true; do
f=/backups/bugfree-$$(date +%Y%m%d-%H%M%S).dump
if pg_dump -Fc -f "$$f.tmp"; then mv "$$f.tmp" "$$f"; echo "backup: saved $$f"; else rm -f "$$f.tmp"; echo "backup: FAILED"; fi
find /backups -name 'bugfree-*.dump' -mtime +$$BACKUP_KEEP_DAYS -delete
sleep $$(( BACKUP_INTERVAL_HOURS * 3600 ))
done
depends_on:
db:
condition: service_healthy
api:
image: ghcr.io/dwarelab/bugfree-api:${BUGFREE_VERSION:-latest}
restart: unless-stopped
build:
context: .
dockerfile: apps/api/Dockerfile
environment:
DATABASE_URL: postgres://bugfree:${POSTGRES_PASSWORD:-bugfree}@db:5432/bugfree
API_URL: ${API_URL:-http://localhost:4100}
APP_URL: ${APP_URL:-http://localhost:3100}
COOKIE_DOMAIN: ${COOKIE_DOMAIN:-}
COOKIE_SECURE: ${COOKIE_SECURE:-false}
GITHUB_CLIENT_ID: ${GITHUB_CLIENT_ID:-}
GITHUB_CLIENT_SECRET: ${GITHUB_CLIENT_SECRET:-}
SMTP_URL: ${SMTP_URL:-}
ALERT_FROM: ${ALERT_FROM:-bugfree <alerts@localhost>}
RETENTION_DAYS: ${RETENTION_DAYS:-30}
LOG_RETENTION_DAYS: ${LOG_RETENTION_DAYS:-14}
ARTIFACT_RETENTION_DAYS: ${ARTIFACT_RETENTION_DAYS:-90}
ARTIFACT_KEEP_RELEASES: ${ARTIFACT_KEEP_RELEASES:-5}
INGEST_RATE_LIMIT: ${INGEST_RATE_LIMIT:-50}
LOG_RATE_LIMIT: ${LOG_RATE_LIMIT:-2000}
TRUST_PROXY: ${TRUST_PROXY:-1}
PORT: 4100
NODE_ENV: production
ports:
- "4100:4100"
depends_on:
db:
condition: service_healthy
web:
image: ghcr.io/dwarelab/bugfree-web:${BUGFREE_VERSION:-latest}
restart: unless-stopped
build:
context: .
dockerfile: apps/web/Dockerfile
args:
NEXT_PUBLIC_API_URL: ${API_URL:-http://localhost:4100}
ports:
- "3100:3100"
depends_on:
- api
volumes:
db-data: