-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
58 lines (54 loc) · 1.83 KB
/
docker-compose.yml
File metadata and controls
58 lines (54 loc) · 1.83 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
# ─────────────────────────────────────────────────────────────────────────────
# docker-compose.yml
#
# Spins up:
# postgres — custom DB with pg_hint_plan extension pre-loaded
# env — sql_optimizer OpenEnv server
#
# Usage:
# docker-compose down -v <-- RUN THIS ONCE to clear the old database!
# docker-compose up -d --build
# ─────────────────────────────────────────────────────────────────────────────
services:
postgres:
build:
context: .
dockerfile: db.Dockerfile
container_name: sql_optimizer_db
# Force Postgres to load the hint plan extension into shared memory
command: ["postgres", "-c", "shared_preload_libraries=pg_hint_plan"]
environment:
POSTGRES_USER: sqlopt
POSTGRES_PASSWORD: sqlopt
POSTGRES_DB: sqlopt
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./sample_db_init.sql:/docker-entrypoint-initdb.d/01_init.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U sqlopt -d sqlopt"]
interval: 5s
timeout: 5s
retries: 10
env:
build:
context: .
dockerfile: sql_optimizer/server/Dockerfile
container_name: sql_optimizer_env
ports:
- "8000:8000"
environment:
WORKERS: "4"
MAX_STEPS: "10"
QUERY_TIMEOUT_MS: "30000"
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 10s
timeout: 5s
retries: 5
volumes:
postgres_data: