-
Notifications
You must be signed in to change notification settings - Fork 118
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
155 lines (145 loc) · 4.86 KB
/
Copy pathdocker-compose.yml
File metadata and controls
155 lines (145 loc) · 4.86 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
# docker-compose.yml
# Full-stack deployment: RustForge daemon + infrastructure services
#
# Usage:
# docker compose up -d # start everything
# docker compose up -d daemon # start daemon + deps only
# docker compose run --rm cli # one-shot CLI command
# docker compose --profile benchmark up # run benchmark_audit
services:
# ── Application Services ───────────────────────────────────────────────
daemon:
build:
context: .
dockerfile: Dockerfile
image: ghcr.io/ashutosh0x/rust-finance:latest
container_name: rustforge_daemon
restart: unless-stopped
env_file: .env
environment:
DATABASE_URL: postgres://${POSTGRES_USER:-rustforge}:${POSTGRES_PASSWORD:-rustforge_secret}@pgbouncer:6432/${POSTGRES_DB:-rustforge}
REDIS_URL: redis://dragonfly:6379
ports:
- "50051:50051" # gRPC
- "9090:9090" # Metrics / health
depends_on:
dragonfly:
condition: service_healthy
pgbouncer:
condition: service_started
networks:
- rustforge_net
deploy:
resources:
limits:
memory: 2G
reservations:
memory: 512M
cli:
build:
context: .
dockerfile: Dockerfile
image: ghcr.io/ashutosh0x/rust-finance:latest
container_name: rustforge_cli
env_file: .env
environment:
DATABASE_URL: postgres://${POSTGRES_USER:-rustforge}:${POSTGRES_PASSWORD:-rustforge_secret}@pgbouncer:6432/${POSTGRES_DB:-rustforge}
REDIS_URL: redis://dragonfly:6379
command: ["cli"]
depends_on:
dragonfly:
condition: service_healthy
pgbouncer:
condition: service_started
networks:
- rustforge_net
profiles:
- cli
benchmark_audit:
build:
context: .
dockerfile: Dockerfile
image: ghcr.io/ashutosh0x/rust-finance:latest
container_name: rustforge_benchmark
env_file: .env
command: ["benchmark_audit"]
networks:
- rustforge_net
profiles:
- benchmark
# ── Infrastructure Services ────────────────────────────────────────────
dragonfly:
# Pinned by digest for supply-chain security
# To update: docker pull docker.dragonflydb.io/dragonflydb/dragonfly:latest && docker inspect --format='{{index .RepoDigests 0}}'
image: docker.dragonflydb.io/dragonflydb/dragonfly:v1.25.5@sha256:79e634c0ae5bb1637e8cbc13165a8db4bca0e56a9093f53c7e1a0b59f2f0cb7f
container_name: rustforge_dragonfly
restart: unless-stopped
ports:
- "6379:6379"
ulimits:
memlock: -1
command: >
--logtostderr
--cache_mode=true
--maxmemory=2gb
--hz=1000
--tcp_nodelay=true
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
networks:
- rustforge_net
timescaledb:
# Pinned by digest for supply-chain security
# To update: docker pull timescale/timescaledb:latest-pg16 && docker inspect --format='{{index .RepoDigests 0}}'
image: timescale/timescaledb:2.17.2-pg16@sha256:4fa02e3b4f0adbf5eb5b5b3c7b0fba63e929fac9a02d496f03b8b87c0f0c4c1e
container_name: rustforge_timescale
restart: unless-stopped
ports:
- "5432:5432"
environment:
POSTGRES_USER: ${POSTGRES_USER:-rustforge}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-rustforge_secret}
POSTGRES_DB: ${POSTGRES_DB:-rustforge}
TIMESCALEDB_TELEMETRY: "off"
volumes:
- timescale_data:/var/lib/postgresql/data
- ./crates/persistence/db/migrations:/docker-entrypoint-initdb.d:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-rustforge}"]
interval: 5s
timeout: 3s
retries: 10
networks:
- rustforge_net
pgbouncer:
# Pinned by digest for supply-chain security
# To update: docker pull bitnami/pgbouncer:latest && docker inspect --format='{{index .RepoDigests 0}}'
image: bitnami/pgbouncer:1.23.1@sha256:3d2a938e7a0e0f2d7f10eacbf5b1649e3ac47dbce3c8f1f0c12a4461e5e6e1e4
container_name: rustforge_pgbouncer
restart: unless-stopped
ports:
- "6432:6432"
environment:
POSTGRESQL_HOST: timescaledb
POSTGRESQL_PORT: 5432
POSTGRESQL_USERNAME: ${POSTGRES_USER:-rustforge}
POSTGRESQL_PASSWORD: ${POSTGRES_PASSWORD:-rustforge_secret}
POSTGRESQL_DATABASE: ${POSTGRES_DB:-rustforge}
PGBOUNCER_POOL_MODE: transaction
PGBOUNCER_MAX_CLIENT_CONN: 1000
PGBOUNCER_DEFAULT_POOL_SIZE: 20
PGBOUNCER_MIN_POOL_SIZE: 5
PGBOUNCER_SERVER_IDLE_TIMEOUT: 600
depends_on:
timescaledb:
condition: service_healthy
networks:
- rustforge_net
volumes:
timescale_data:
networks:
rustforge_net:
driver: bridge