-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
47 lines (46 loc) · 1.61 KB
/
Copy pathdocker-compose.yml
File metadata and controls
47 lines (46 loc) · 1.61 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
services:
ruley:
build: .
image: ghcr.io/rzh0504/ruley:latest
container_name: ruley
restart: unless-stopped
ports:
- "${PORT:-4000}:4000"
env_file:
- .env
environment:
NODE_ENV: production
NODE_OPTIONS: "--max-old-space-size=${NODE_MAX_OLD_SPACE_SIZE:-256}"
NEXT_PUBLIC_APP_URL: "${NEXT_PUBLIC_APP_URL:-}"
mem_limit: "${MEM_LIMIT:-512m}"
healthcheck:
test: ["CMD", "node", "-e", "fetch('http://127.0.0.1:4000/api/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
subscription-refresher:
image: curlimages/curl:8.16.0
container_name: ruley-subscription-refresher
restart: unless-stopped
depends_on:
- ruley
environment:
ENABLE_AUTOUPDATE: "${ENABLE_AUTOUPDATE:-false}"
CRON_SECRET: "${CRON_SECRET}"
REFRESH_INTERVAL_SECONDS: "${REFRESH_INTERVAL_SECONDS:-21600}"
REFRESH_URL: "http://ruley:4000/api/internal/refresh-subscriptions"
entrypoint: ["/bin/sh", "-c"]
command: >
if [ "$${ENABLE_AUTOUPDATE}" != "true" ]; then
echo "Subscription auto refresh is disabled because ENABLE_AUTOUPDATE is not true.";
while true; do sleep 86400; done;
fi;
if [ -z "$${CRON_SECRET}" ]; then
echo "Subscription auto refresh is enabled but CRON_SECRET is not set.";
while true; do sleep 86400; done;
fi;
while true; do
curl -fsS -X POST "$${REFRESH_URL}" -H "Authorization: Bearer $${CRON_SECRET}" || true;
sleep "$${REFRESH_INTERVAL_SECONDS}";
done