forked from
tranquil.farm/tranquil-pds
Our Personal Data Server from scratch!
1services:
2 tranquil-pds:
3 build:
4 context: .
5 dockerfile: Dockerfile
6 image: tranquil-pds:latest
7 restart: unless-stopped
8 environment:
9 SERVER_HOST: "0.0.0.0"
10 SERVER_PORT: "3000"
11 PDS_HOSTNAME: "${PDS_HOSTNAME:?PDS_HOSTNAME is required}"
12 DATABASE_URL: "postgres://tranquil_pds:${DB_PASSWORD:?DB_PASSWORD is required}@db:5432/pds"
13 BLOB_STORAGE_PATH: "/var/lib/tranquil/blobs"
14 BACKUP_STORAGE_PATH: "/var/lib/tranquil/backups"
15 JWT_SECRET: "${JWT_SECRET:?JWT_SECRET is required (min 32 chars)}"
16 DPOP_SECRET: "${DPOP_SECRET:?DPOP_SECRET is required (min 32 chars)}"
17 MASTER_KEY: "${MASTER_KEY:?MASTER_KEY is required (min 32 chars)}"
18 CRAWLERS: "${CRAWLERS:-https://bsky.network}"
19 volumes:
20 - ./config.toml:/etc/tranquil-pds/config.toml:ro
21 - blob_data:/var/lib/tranquil/blobs
22 - backup_data:/var/lib/tranquil/backups
23 depends_on:
24 db:
25 condition: service_healthy
26 healthcheck:
27 test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/xrpc/_health"]
28 interval: 30s
29 timeout: 10s
30 retries: 3
31 start_period: 10s
32 deploy:
33 resources:
34 limits:
35 memory: 1G
36 reservations:
37 memory: 256M
38
39 frontend:
40 build:
41 context: ./frontend
42 dockerfile: Dockerfile
43 image: tranquil-pds-frontend:latest
44 restart: unless-stopped
45 healthcheck:
46 test: ["CMD", "wget", "-q", "--spider", "http://localhost:80/"]
47 interval: 30s
48 timeout: 10s
49 retries: 3
50 start_period: 5s
51 deploy:
52 resources:
53 limits:
54 memory: 128M
55 reservations:
56 memory: 32M
57
58 db:
59 image: postgres:18-alpine
60 restart: unless-stopped
61 environment:
62 POSTGRES_USER: tranquil_pds
63 POSTGRES_PASSWORD: "${DB_PASSWORD:?DB_PASSWORD is required}"
64 POSTGRES_DB: pds
65 volumes:
66 - postgres_data:/var/lib/postgresql/data
67 healthcheck:
68 test: ["CMD-SHELL", "pg_isready -U tranquil_pds -d pds"]
69 interval: 10s
70 timeout: 5s
71 retries: 5
72 start_period: 10s
73 deploy:
74 resources:
75 limits:
76 memory: 512M
77 reservations:
78 memory: 128M
79
80 nginx:
81 image: nginx:1.29-alpine
82 restart: unless-stopped
83 ports:
84 - "80:80"
85 - "443:443"
86 volumes:
87 - ./nginx.frontend.conf:/etc/nginx/nginx.conf:ro
88 - ./certs:/etc/nginx/certs:ro
89 - acme_challenge:/var/www/acme:ro
90 depends_on:
91 - tranquil-pds
92 - frontend
93 healthcheck:
94 test: ["CMD", "nginx", "-t"]
95 interval: 30s
96 timeout: 10s
97 retries: 3
98
99 certbot:
100 image: certbot/certbot:v5.2.2
101 volumes:
102 - ./certs:/etc/letsencrypt
103 - acme_challenge:/var/www/acme
104 entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew --webroot -w /var/www/acme; sleep 12h & wait $${!}; done'"
105
106 prometheus:
107 image: prom/prometheus:v3.8.0
108 restart: unless-stopped
109 ports:
110 - "127.0.0.1:9090:9090"
111 volumes:
112 - ./observability/prometheus.yaml:/etc/prometheus/prometheus.yaml:ro
113 - prometheus_data:/prometheus
114 command:
115 - '--config.file=/etc/prometheus/prometheus.yaml'
116 - '--storage.tsdb.path=/prometheus'
117 - '--storage.tsdb.retention.time=30d'
118 deploy:
119 resources:
120 limits:
121 memory: 256M
122
123volumes:
124 postgres_data:
125 blob_data:
126 backup_data:
127 prometheus_data:
128 acme_challenge: