Repository navigation
Expand file tree
/
Copy pathdocker-compose.sqlite.yml
More file actions
162 lines (152 loc) · 4.08 KB
/
Copy pathdocker-compose.sqlite.yml
File metadata and controls
162 lines (152 loc) · 4.08 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
# Journiv Production Docker Compose (SQLite).
# Journiv recommends using PostgreSQL based deployment instead.
# However, SQLite is still supported if you want to use it.
#
# Usage:
# docker compose -f docker-compose.sqlite.yml up -d
#
# Required Environment Variables:
# SECRET_KEY - Generate with: python -c "import secrets; print(secrets.token_urlsafe(32))"
# DOMAIN_NAME - Needed when running in same-origin SPA mode (ENABLE_CORS=false)
x-common-environment: &common-environment
DB_DRIVER: sqlite
DATABASE_URL: sqlite:////data/journiv.db
ENVIRONMENT: production
# Production stays fail-closed unless a trusted-LAN operator explicitly opts in.
ALLOW_INSECURE_COOKIE_AUTH_OVER_HTTP: ${ALLOW_INSECURE_COOKIE_AUTH_OVER_HTTP:-false}
REDIS_URL: redis://valkey:6379/0
CELERY_BROKER_URL: redis://valkey:6379/0
CELERY_RESULT_BACKEND: redis://valkey:6379/0
x-celery-common: &celery-common
image: swalabtech/journiv-app:${APP_VERSION:-latest}
env_file: .env
volumes:
- ./data:/data
depends_on:
valkey:
condition: service_healthy
networks:
- backend
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "5"
deploy:
resources:
limits:
cpus: "1.0"
memory: 1g
reservations:
memory: 256m
x-app-common: &app-common
image: swalabtech/journiv-app:${APP_VERSION:-latest}
env_file: .env
volumes:
- ./data:/data
depends_on:
valkey:
condition: service_healthy
networks:
- backend
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "5"
x-celery-healthcheck: &celery-healthcheck
interval: 30s
timeout: 10s
retries: 5
start_period: 40s
services:
# Journiv uses Valkey which is similar to Redis for cache.
valkey:
image: valkey/valkey:9.0-alpine
container_name: journiv-valkey-cache
restart: unless-stopped
volumes:
- ./data/valkey:/data
networks:
- backend
healthcheck:
test: ["CMD", "valkey-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
celery-worker:
<<: *celery-common
container_name: journiv-celery-worker
# Keep idle memory predictable for self-hosted deployments.
# Defaults can be overridden in .env without editing compose.
command: >
celery -A app.core.celery_app worker
--loglevel=info
--concurrency=${CELERY_WORKER_CONCURRENCY:-1}
--max-memory-per-child=${CELERY_WORKER_MAX_MEMORY_PER_CHILD_KB:-300000}
--max-tasks-per-child=${CELERY_WORKER_MAX_TASKS_PER_CHILD:-200}
environment:
<<: *common-environment
SERVICE_ROLE: celery-worker
healthcheck:
<<: *celery-healthcheck
celery-beat:
<<: *celery-common
container_name: journiv-celery-beat
command: celery -A app.core.celery_app beat --loglevel=info --scheduler redbeat.RedBeatScheduler --pidfile=/tmp/celerybeat.pid
environment:
<<: *common-environment
SERVICE_ROLE: celery-beat
REDBEAT_REDIS_URL: redis://valkey:6379/2
healthcheck:
<<: *celery-healthcheck
app:
<<: *app-common
container_name: journiv-sqlite-app
ports:
- "${APP_PORT:-8000}:8000"
environment:
<<: *common-environment
SERVICE_ROLE: app
RATE_LIMIT_STORAGE_URI: redis://valkey:6379/1
networks:
- backend
- frontend
healthcheck:
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
deploy:
resources:
limits:
cpus: "2.0"
memory: 2g
reservations:
memory: 512m
admin-cli:
<<: *app-common
container_name: journiv-sqlite-admin-cli
profiles: ["admin"]
command: ["sleep", "infinity"]
environment:
<<: *common-environment
SERVICE_ROLE: admin-cli
# No healthcheck needed for idle container
healthcheck:
disable: true
deploy:
resources:
limits:
cpus: "1.0"
memory: 1g
reservations:
memory: 256m
networks:
backend:
driver: bridge
frontend:
driver: bridge