Mirrored from GitHub
github.com/roostorg/coop
3.4 kB
123 lines
1services:
2 postgres:
3 image: postgres:15.18
4 volumes:
5 - pg_data:/var/lib/postgresql/data
6 healthcheck:
7 test: ['CMD', 'pg_isready', '-U', 'postgres', '-d', 'postgres']
8 interval: 2s
9 start_period: 2s
10 environment:
11 POSTGRES_PASSWORD: postgres123
12 POSTGRES_USER: postgres
13 POSTGRES_DB: postgres
14
15 redis:
16 image: redis:8.6.1-trixie
17 command:
18 - redis-server
19 - --appendonly
20 - 'yes'
21 - --maxmemory
22 - '256mb'
23 - --maxmemory-policy
24 - noeviction
25
26 scylla:
27 image: scylladb/scylla:5.2
28 command: --smp 1 --memory 4G --overprovisioned 1 --developer-mode 1
29 volumes:
30 - scylla_data:/var/lib/scylla
31 healthcheck:
32 # Real CQL query, not `nodetool status`, so 9042 accepts connections
33 # before migrations start.
34 test:
35 [
36 'CMD-SHELL',
37 'cqlsh -e "SELECT release_version FROM system.local" || exit 1',
38 ]
39 interval: 5s
40 timeout: 10s
41 retries: 30
42 start_period: 35s
43
44 clickhouse:
45 image: clickhouse/clickhouse-server:24.3
46 volumes:
47 - clickhouse_data:/var/lib/clickhouse
48 environment:
49 CLICKHOUSE_DB: analytics
50 CLICKHOUSE_USER: default
51 CLICKHOUSE_PASSWORD: clickhouse
52 healthcheck:
53 test:
54 ['CMD-SHELL', 'clickhouse-client --host localhost --query "SELECT 1"']
55 interval: 5s
56 timeout: 3s
57 retries: 5
58
59 migrations:
60 image: ghcr.io/roostorg/coop-migrations:latest
61 command: sh -c 'set -e
62 && for db in api-server-pg scylla clickhouse; do npm run db:create -- --db "$$db" --env staging; npm run db:update -- --db "$$db" --env staging; done'
63 env_file: ./.env.docker
64 depends_on:
65 postgres:
66 condition: service_healthy
67 scylla:
68 condition: service_healthy
69 clickhouse:
70 condition: service_healthy
71
72 seed:
73 image: ghcr.io/roostorg/coop-server:latest
74 entrypoint: ['sh', '-c']
75 command:
76 - |
77 PASSWORD=$$(node -e "process.stdout.write(require('crypto').randomBytes(18).toString('base64url'))")
78 OUTPUT=$$(node bin/create-org-and-user.js \
79 --name "Coop" \
80 --email "admin@coop.local" \
81 --website "https://coop.local" \
82 --firstName "Admin" \
83 --lastName "User" \
84 --password "$$PASSWORD" 2>&1) \
85 && echo "$$OUTPUT" \
86 && echo "" \
87 && echo "============================================" \
88 && echo " Login: admin@coop.local" \
89 && echo " Password: $$PASSWORD" \
90 && echo "============================================" \
91 || { echo "$$OUTPUT"; echo "$$OUTPUT" | grep -q "duplicate key" && echo "Seed user already exists — skipping." || exit 1; }
92 env_file: ./.env.docker
93 environment:
94 NODE_ENV: development
95 depends_on:
96 migrations:
97 condition: service_completed_successfully
98 redis:
99 condition: service_started
100
101 server:
102 image: ghcr.io/roostorg/coop-server:latest
103 ports:
104 - '8080:8080'
105 env_file: ./.env.docker
106 environment:
107 NODE_ENV: development
108 PORT: '8080'
109 depends_on:
110 seed:
111 condition: service_completed_successfully
112 redis:
113 condition: service_started
114
115 client:
116 image: ghcr.io/roostorg/coop-client:latest
117 ports:
118 - '3000:80'
119
120volumes:
121 pg_data:
122 scylla_data:
123 clickhouse_data: