-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
226 lines (218 loc) · 6.19 KB
/
Copy pathdocker-compose.yml
File metadata and controls
226 lines (218 loc) · 6.19 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# ===========================================
# LibreDiary Docker Compose - Pre-built Images
#
# For end users deploying with published images.
# No source code or build step required.
#
# Usage:
# cp .env.example .env
# docker compose up -d
#
# HTTP-only mode (no TLS):
# docker compose -f docker-compose.yml -f docker-compose.local.yml up -d
#
# Optional services:
# --profile storage Enable MinIO (S3-compatible storage)
# --profile search Enable Meilisearch (full-text search)
#
# Developed by Akaal Creatives
# https://www.akaalcreatives.com
# ===========================================
services:
# ===========================================
# Nginx Reverse Proxy
# ===========================================
nginx:
image: nginx:1.27-alpine
container_name: librediary-nginx
ports:
- "${HTTP_PORT:-80}:80"
- "${HTTPS_PORT:-443}:443"
volumes:
- ./tooling/docker/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./tooling/docker/nginx/default.conf.template:/etc/nginx/templates/default.conf.template:ro
- ${SSL_CERT_PATH:-./tooling/docker/nginx/ssl}:/etc/nginx/ssl:ro
- certbot_webroot:/var/www/certbot:ro
environment:
- DOMAIN=${DOMAIN:-localhost}
depends_on:
server:
condition: service_healthy
web:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:80/health"]
interval: 30s
timeout: 10s
retries: 3
deploy:
resources:
limits:
memory: 128M
networks:
- librediary_network
# ===========================================
# Server (Fastify API)
# ===========================================
server:
image: ghcr.io/akaal-creatives/librediary-server:latest
container_name: librediary-server
expose:
- "3000"
env_file:
- ./.env
environment:
- NODE_ENV=production
- HOST=0.0.0.0
- PORT=3000
- DATABASE_URL=postgresql://${POSTGRES_USER:-librediary}:${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}@postgres:5432/${POSTGRES_DB:-librediary}
- STORAGE_LOCAL_PATH=/app/data/files
- BACKUP_LOCAL_PATH=/app/backups
- MEILISEARCH_HOST=http://meilisearch:7700
- STORAGE_S3_ENDPOINT=http://minio:9000
volumes:
- server_uploads:/app/data/files
- server_backups:/app/backups
depends_on:
postgres:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: ["CMD", "node", "-e", "fetch('http://localhost:3000/health').then(r => { if (!r.ok) throw new Error(); }).catch(() => process.exit(1))"]
interval: 30s
timeout: 10s
start_period: 60s
retries: 3
deploy:
resources:
limits:
memory: 512M
networks:
- librediary_network
# ===========================================
# Web (Vue SPA)
# ===========================================
web:
image: ghcr.io/akaal-creatives/librediary-web:latest
container_name: librediary-web
expose:
- "80"
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:80/"]
interval: 30s
timeout: 10s
start_period: 5s
retries: 3
deploy:
resources:
limits:
memory: 128M
networks:
- librediary_network
# ===========================================
# PostgreSQL Database
# ===========================================
postgres:
image: postgres:16-alpine
container_name: librediary-postgres-prod
environment:
POSTGRES_USER: ${POSTGRES_USER:-librediary}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}
POSTGRES_DB: ${POSTGRES_DB:-librediary}
volumes:
- postgres_data:/var/lib/postgresql/data
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-librediary}"]
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
limits:
memory: 512M
networks:
- librediary_network
# ===========================================
# MinIO (S3-compatible storage) - Optional
# ===========================================
minio:
image: minio/minio:RELEASE.2025-02-18T16-25-55Z
container_name: librediary-minio-prod
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-minioadmin}
volumes:
- minio_data:/data
expose:
- "9000"
ports:
- "${MINIO_CONSOLE_PORT:-9001}:9001"
restart: unless-stopped
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 30s
timeout: 10s
retries: 3
deploy:
resources:
limits:
memory: 256M
profiles:
- storage
networks:
- librediary_network
# ===========================================
# Meilisearch (Full-text search) - Optional
# ===========================================
meilisearch:
image: getmeili/meilisearch:v1.13
container_name: librediary-meilisearch-prod
environment:
MEILI_MASTER_KEY: ${MEILISEARCH_API_KEY:-masterkey}
MEILI_ENV: production
volumes:
- meilisearch_data:/meili_data
expose:
- "7700"
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:7700/health"]
interval: 30s
timeout: 10s
start_period: 30s
retries: 3
deploy:
resources:
limits:
memory: 256M
profiles:
- search
networks:
- librediary_network
# ===========================================
# Volumes
# ===========================================
volumes:
postgres_data:
name: librediary_postgres_prod
server_uploads:
name: librediary_uploads_prod
server_backups:
name: librediary_backups_prod
certbot_webroot:
name: librediary_certbot
minio_data:
name: librediary_minio_prod
meilisearch_data:
name: librediary_meilisearch_prod
# ===========================================
# Networks
# ===========================================
networks:
librediary_network:
name: librediary_network
driver: bridge