-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.dev.yaml
More file actions
254 lines (210 loc) · 6.14 KB
/
docker-compose.dev.yaml
File metadata and controls
254 lines (210 loc) · 6.14 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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
version: '3.8'
# Development environment with PostgreSQL, MinIO, pgAdmin, and sample data
# Includes hot-reload and debugging capabilities
services:
# PostgreSQL Database with sample data
postgres:
image: postgres:16-alpine
container_name: data-archiver-db-dev
restart: unless-stopped
environment:
POSTGRES_USER: archiver
POSTGRES_PASSWORD: devpassword
POSTGRES_DB: archiver_dev
POSTGRES_INITDB_ARGS: "-E UTF8 --locale=en_US.UTF-8"
volumes:
# Persistent data storage
- postgres-dev-data:/var/lib/postgresql/data
# Sample data initialization scripts
- ./docker/init-db:/docker-entrypoint-initdb.d:ro
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U archiver"]
interval: 5s
timeout: 3s
retries: 5
start_period: 10s
networks:
- archiver-dev-network
logging:
driver: "json-file"
options:
max-size: "5m"
max-file: "2"
# pgAdmin for database management
pgadmin:
image: dpage/pgadmin4:latest
container_name: data-archiver-pgadmin
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
environment:
PGADMIN_DEFAULT_EMAIL: admin@local.dev
PGADMIN_DEFAULT_PASSWORD: admin
PGADMIN_CONFIG_SERVER_MODE: 'False'
PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: 'False'
volumes:
- pgadmin-data:/var/lib/pgadmin
ports:
- "5050:80"
networks:
- archiver-dev-network
logging:
driver: "json-file"
options:
max-size: "5m"
max-file: "2"
# MinIO S3-compatible storage
minio:
image: minio/minio:latest
container_name: data-archiver-s3-dev
restart: unless-stopped
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
volumes:
- minio-dev-data:/data
ports:
- "9000:9000"
- "9001:9001"
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 5s
timeout: 3s
retries: 5
start_period: 10s
networks:
- archiver-dev-network
logging:
driver: "json-file"
options:
max-size: "5m"
max-file: "2"
# MinIO bucket initialization
minio-init:
image: minio/mc:latest
container_name: data-archiver-s3-init-dev
depends_on:
minio:
condition: service_healthy
entrypoint: >
/bin/sh -c "
mc alias set myminio http://minio:9000 minioadmin minioadmin;
mc mb --ignore-existing myminio/archives;
mc mb --ignore-existing myminio/test-archives;
mc anonymous set download myminio/archives;
mc anonymous set download myminio/test-archives;
echo 'MinIO buckets created successfully';
exit 0;
"
networks:
- archiver-dev-network
# PostgreSQL Archiver (development build)
archiver:
build:
context: .
dockerfile: Dockerfile
args:
VERSION: dev
image: data-archiver:dev
container_name: data-archiver-dev
restart: "no" # Don't auto-restart in dev mode
depends_on:
postgres:
condition: service_healthy
minio:
condition: service_healthy
minio-init:
condition: service_completed_successfully
environment:
# Debug mode enabled
ARCHIVE_DEBUG: "true"
ARCHIVE_LOG_FORMAT: text
# PostgreSQL connection (using service name)
ARCHIVE_DB_HOST: postgres
ARCHIVE_DB_PORT: 5432
ARCHIVE_DB_USER: archiver
ARCHIVE_DB_PASSWORD: devpassword
ARCHIVE_DB_NAME: archiver_dev
ARCHIVE_DB_SSLMODE: disable
# MinIO S3 configuration (using service name)
ARCHIVE_S3_ENDPOINT: http://minio:9000
ARCHIVE_S3_BUCKET: test-archives
ARCHIVE_S3_ACCESS_KEY: minioadmin
ARCHIVE_S3_SECRET_KEY: minioadmin
ARCHIVE_S3_REGION: us-east-1
ARCHIVE_S3_PATH_TEMPLATE: "archives/{table}/{YYYY}/{MM}/{DD}/{table}_{YYYY}{MM}{DD}.jsonl.zst"
# Archival configuration (sample data table)
ARCHIVE_TABLE: events
ARCHIVE_START_DATE: "2024-01-01"
ARCHIVE_END_DATE: "2024-01-31"
ARCHIVE_WORKERS: 2
ARCHIVE_DRY_RUN: "false"
ARCHIVE_SKIP_COUNT: "false"
# Output configuration
ARCHIVE_OUTPUT_DURATION: daily
ARCHIVE_OUTPUT_FORMAT: jsonl
ARCHIVE_COMPRESSION: zstd
ARCHIVE_COMPRESSION_LEVEL: 1 # Faster compression for dev
ARCHIVE_DATE_COLUMN: created_at
# Cache viewer enabled
ARCHIVE_CACHE_VIEWER: "true"
ARCHIVE_VIEWER_PORT: 8080
volumes:
# Cache directory for metadata and progress tracking
- archiver-dev-cache:/tmp/.data-archiver
# Optional: Mount source code for hot-reload (requires rebuild)
# - ./cmd:/app/cmd:ro
# - ./internal:/app/internal:ro
ports:
- "8080:8080"
networks:
- archiver-dev-network
# No resource limits in dev mode for easier debugging
stdin_open: true
tty: true
logging:
driver: "json-file"
options:
max-size: "5m"
max-file: "2"
networks:
archiver-dev-network:
driver: bridge
volumes:
postgres-dev-data:
driver: local
pgadmin-data:
driver: local
minio-dev-data:
driver: local
archiver-dev-cache:
driver: local
# Development Quick Start:
#
# 1. Start all services:
# docker compose -f docker-compose.dev.yaml up -d
#
# 2. Access services:
# - PostgreSQL: localhost:5432 (user: archiver, password: devpassword)
# - pgAdmin: http://localhost:5050 (email: admin@local.dev, password: admin)
# - MinIO Console: http://localhost:9001 (user: minioadmin, password: minioadmin)
# - Archiver Web UI: http://localhost:8080
#
# 3. View logs:
# docker compose -f docker-compose.dev.yaml logs -f archiver
#
# 4. Run archiver manually:
# docker compose -f docker-compose.dev.yaml run --rm archiver [args]
#
# 5. Execute shell in archiver (for debugging):
# docker compose -f docker-compose.dev.yaml run --rm --entrypoint /bin/sh archiver
#
# 6. Stop all services:
# docker compose -f docker-compose.dev.yaml down
#
# 7. Reset all data:
# docker compose -f docker-compose.dev.yaml down -v