-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
142 lines (137 loc) · 4.28 KB
/
docker-compose.yml
File metadata and controls
142 lines (137 loc) · 4.28 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
services:
database:
image: postgres:15.14-alpine
container_name: openwatch-db
environment:
POSTGRES_DB: openwatch
POSTGRES_USER: openwatch
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "127.0.0.1:5432:5432"
networks:
- openwatch-network
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U openwatch -d openwatch"]
interval: 5s
timeout: 3s
retries: 10
start_period: 10s
# FastAPI Backend
backend:
build:
context: .
dockerfile: docker/Dockerfile.backend
container_name: openwatch-backend
environment:
OPENWATCH_DATABASE_URL: postgresql://openwatch:${POSTGRES_PASSWORD}@database:5432/openwatch
OPENWATCH_SECRET_KEY: ${OPENWATCH_SECRET_KEY}
OPENWATCH_MASTER_KEY: ${MASTER_KEY}
OPENWATCH_ENCRYPTION_KEY: ${OPENWATCH_ENCRYPTION_KEY}
OPENWATCH_FIPS_MODE: "false"
OPENWATCH_REQUIRE_HTTPS: "false"
OPENWATCH_DEBUG: "true"
OPENWATCH_LICENSE_TIER: "${OPENWATCH_LICENSE_TIER:-openwatch_plus}"
BUILD_DATE: "${BUILD_DATE:-}"
OPENWATCH_USE_QUERY_BUILDER: "${OPENWATCH_USE_QUERY_BUILDER:-false}"
OPENWATCH_USE_REPOSITORY_PATTERN: "${OPENWATCH_USE_REPOSITORY_PATTERN:-false}"
OPENWATCH_SSH_STRICT_MODE: "false"
volumes:
- app_data:/openwatch/data
- app_logs:/openwatch/logs
- ./security/certs:/openwatch/security/certs:ro
- ./security/keys:/openwatch/security/keys
- ssh_known_hosts:/openwatch/security/known_hosts
ports:
- "8000:8000"
depends_on:
database:
condition: service_healthy
networks:
- openwatch-network
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
# Job Queue Worker (replaces Celery worker + Beat)
worker:
build:
context: .
dockerfile: docker/Dockerfile.backend
container_name: openwatch-worker
command: ["python3", "-m", "app.services.job_queue"]
environment:
OPENWATCH_DATABASE_URL: postgresql://openwatch:${POSTGRES_PASSWORD}@database:5432/openwatch
OPENWATCH_SECRET_KEY: ${OPENWATCH_SECRET_KEY}
OPENWATCH_MASTER_KEY: ${MASTER_KEY}
OPENWATCH_ENCRYPTION_KEY: ${OPENWATCH_ENCRYPTION_KEY}
OPENWATCH_FIPS_MODE: "false"
OPENWATCH_DEBUG: "true"
OPENWATCH_LICENSE_TIER: "${OPENWATCH_LICENSE_TIER:-openwatch_plus}"
OPENWATCH_SSH_STRICT_MODE: "false"
volumes:
- app_data:/openwatch/data
- app_logs:/openwatch/logs
- ./security/certs:/openwatch/security/certs:ro
- ./security/keys:/openwatch/security/keys
- ssh_known_hosts:/openwatch/security/known_hosts
depends_on:
- database
networks:
- openwatch-network
restart: unless-stopped
# Override the backend Dockerfile's HEALTHCHECK (which curls port 8000
# -- the API runs in the backend container, not here). Verify the worker
# can reach the DB; without DB, it cannot dequeue or enqueue anything.
healthcheck:
test:
- "CMD-SHELL"
- "python3 -c \"from sqlalchemy import create_engine, text; import os; e=create_engine(os.environ['OPENWATCH_DATABASE_URL']); e.connect().execute(text('SELECT 1'))\" || exit 1"
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
# React Frontend
frontend:
build:
context: .
dockerfile: docker/Dockerfile.frontend
container_name: openwatch-frontend
ports:
- "3000:80"
volumes:
- ./security/certs/frontend.crt:/etc/ssl/certs/frontend.crt:ro
- ./security/keys/frontend.key:/etc/ssl/private/frontend.key:ro
environment:
REACT_APP_API_URL: https://localhost:8000
HTTPS: "true"
depends_on:
- backend
networks:
- openwatch-network
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
volumes:
postgres_data:
driver: local
app_data:
driver: local
app_logs:
driver: local
ssh_known_hosts:
driver: local
networks:
openwatch-network:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/16