-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
212 lines (205 loc) · 7.61 KB
/
docker-compose.yml
File metadata and controls
212 lines (205 loc) · 7.61 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
# SITMUN Application Stack - Docker Compose Configuration
#
# ============================================================================
# Environment Configuration (.env files)
# ============================================================================
#
# This stack uses Docker Compose's environment file system:
#
# 1. .env (not committed) - Default development configuration
# - At least should include COMPOSE_PROFILES
# - Minimum content:
# COMPOSE_PROFILES=postgres,dev
#
# 2. Profile files (profiles/*.env) - Predefined configurations
# - development-postgres.env: Development with PostgreSQL + demo data
# - development-oracle.env: Development with Oracle + demo data
# - postgres.env: Production with PostgreSQL (minimal seed data)
# - oracle.env: Production with Oracle (minimal seed data)
#
# Docker Compose reads files in this order (last wins):
# .env → .env.local → Environment variables
#
# ============================================================================
# Quick Start
# ============================================================================
#
# Development (default):
# cp profiles/development-postgres.env .env
# docker compose up -d
#
# Production:
# cp profiles/postgres.env .env
# docker compose up -d
#
# Local customization:
# echo "PUBLIC_PORT=8080" >> .env.local
# docker compose up -d
#
# ============================================================================
# Default Configuration (from committed .env)
# ============================================================================
#
# Frontend:
# - ENVIRONMENT=development (shows "development", source maps enabled)
# - PUBLIC_PORT=9000 (http://localhost:9000)
#
# Backend:
# - DATABASE_TYPE=postgres
# - SITMUN_CONFIG_DIR=development/backend (42 changesets, extensive demo data)
# - COMPOSE_PROFILES=postgres,dev (PostgreSQL + example demo database)
#
# Databases:
# - PostgreSQL on port 9003 (docker host)
# - Example demo DB on port 9005 (docker host)
#
# ============================================================================
services:
front:
build:
context: .
dockerfile: front/Dockerfile
args:
- PUBLIC_BASE_PATH=${PUBLIC_BASE_PATH:-/}
- ENVIRONMENT=${ENVIRONMENT:-development}
- APP_VERSION=${APP_VERSION:-0.0.0}
restart: always
ports:
- "${LOCAL_PORT:-9000}:80"
environment:
- PUBLIC_URL_SCHEME=${PUBLIC_URL_SCHEME:-http}
- PUBLIC_HOSTNAME=${PUBLIC_HOSTNAME:-localhost}
- PUBLIC_PORT=${PUBLIC_PORT:-9000}
- PUBLIC_BASE_PATH=${PUBLIC_BASE_PATH:-/}
- LOCAL_BASE_PATH=${LOCAL_BASE_PATH:-/}
volumes:
- ./front/config:/etc/nginx/conf.d
- ./logs/front/nginx:/var/log/nginx
depends_on:
- backend
command: /bin/sh -c "envsubst '$${PUBLIC_URL_SCHEME},$${PUBLIC_HOSTNAME},$${PUBLIC_PORT},$${PUBLIC_BASE_PATH},$${LOCAL_BASE_PATH}' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost"]
interval: 30s
timeout: 30s
start_period: 5s
retries: 3
backend:
build: ./back/backend
ports:
- "9001:8080"
restart: always
environment:
- SPRING_PROFILES_ACTIVE=${SPRING_PROFILES_ACTIVE:-${DATABASE_TYPE:-postgres}}
- SPRING_DATASOURCE_URL=${DATABASE_URL:-jdbc:postgresql://postgres:5432/}${DATABASE:-sitmun3}
- SPRING_DATASOURCE_USERNAME=${DATABASE_USERNAME:-sitmun3}
- SPRING_DATASOURCE_PASSWORD=${DATABASE_PASSWORD:-sitmun3}
- SPRING_LIQUIBASE_URL=${DATABASE_URL:-jdbc:postgresql://postgres:5432/}${DATABASE:-sitmun3}
- SPRING_LIQUIBASE_USER=${DATABASE_USERNAME:-sitmun3}
- SPRING_LIQUIBASE_PASSWORD=${DATABASE_PASSWORD:-sitmun3}
- SPRING_LIQUIBASE_CHANGE_LOG=${SPRING_LIQUIBASE_CHANGE_LOG:-file:/usr/src/config/liquibase/master.xml}
- SPRING_LIQUIBASE_CONTEXTS=${SPRING_LIQUIBASE_CONTEXTS:-dev}
- SPRING_JPA_DATABASE_PLATFORM=org.hibernate.dialect.PostgreSQLDialect
- SITMUN_PROXY_FORCE=${FORCE_USE_OF_PROXY:-false}
- SITMUN_PROXY_MIDDLEWARE_URL=${PUBLIC_URL_SCHEME:-http}://${PUBLIC_HOSTNAME:-localhost}:${PUBLIC_PORT:-9000}${PUBLIC_BASE_PATH:-/}middleware
- SITMUN_PROXY_MIDDLEWARE_VALIDATE_USER_ACCESS=${SITMUN_PROXY_MIDDLEWARE_VALIDATE_USER_ACCESS:-true}
- SITMUN_BACKEND_URL=${PUBLIC_URL_SCHEME:-http}://${PUBLIC_HOSTNAME:-localhost}:${PUBLIC_PORT:-9000}${PUBLIC_BASE_PATH:-/}backend
- SECURITY_AUTHENTICATION_MIDDLEWARE_SECRET=${MIDDLEWARE_SECRET:-9ef80c644166846897f6a87d3cf6ab204d144229}
- LOGGING_LEVEL_ROOT=${LOGGING_LEVEL_ROOT:-INFO}
- LOGGING_LEVEL_ORG_SITMUN=${LOGGING_LEVEL_ORG_SITMUN:-DEBUG}
- SPRING_JPA_HIBERNATE_DDL_AUTO=${SPRING_JPA_HIBERNATE_DDL_AUTO:-none}
- SPRING_DATASOURCE_HIKARI_CONNECTION_TIMEOUT=${HIKARI_CONNECTION_TIMEOUT:-60000}
volumes:
- ./profiles/${SITMUN_CONFIG_DIR:-development/backend}:/usr/src/config
depends_on:
postgres:
condition: service_healthy
required: false
oracle:
condition: service_healthy
required: false
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost:8080/api/dashboard/health"]
interval: 30s
timeout: 30s
start_period: 60s
retries: 5
proxy:
build: ./back/proxy
restart: always
ports:
- "9002:8080"
depends_on:
- backend
environment:
- SITMUN_BACKEND_CONFIG_URL=http://backend:8080/api/config/proxy
- SITMUN_BACKEND_CONFIG_SECRET=${MIDDLEWARE_SECRET:-9ef80c644166846897f6a87d3cf6ab204d144229}
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost:8080/actuator/health"]
interval: 30s
timeout: 30s
start_period: 5s
retries: 3
postgres:
profiles:
- postgres
image: postgres:16-alpine
restart: always
ports:
- "9003:5432"
environment:
POSTGRES_DB: ${DATABASE:-sitmun3}
POSTGRES_USER: ${DATABASE_USERNAME:-sitmun3}
POSTGRES_PASSWORD: ${DATABASE_PASSWORD:-sitmun3}
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
# Test that PostgreSQL is accepting connections and can execute queries
test: ["CMD-SHELL", "pg_isready -U ${DATABASE_USERNAME:-sitmun3} -d ${DATABASE:-sitmun3} && psql -U ${DATABASE_USERNAME:-sitmun3} -d ${DATABASE:-sitmun3} -c 'SELECT 1' > /dev/null 2>&1"]
interval: 5s
timeout: 3s
start_period: 5s
retries: 5
oracle:
profiles:
- oracle
image: gvenzl/oracle-free:23-slim
restart: always
ports:
- "9004:1521"
environment:
ORACLE_PASSWORD: password
APP_USER: ${DATABASE_USERNAME:-sitmun3}
APP_USER_PASSWORD: ${DATABASE_PASSWORD:-sitmun3}
ORACLE_DATABASE: ${DATABASE:-sitmun3}
volumes:
- oradata:/opt/oracle/oradata
healthcheck:
# Test that the service is registered with the listener AND database accepts connections
test: |
bash -c '
lsnrctl status | grep -q "Service \"${DATABASE:-sitmun3}\"" &&
echo "SELECT 1 FROM DUAL;" | sqlplus -s ${DATABASE_USERNAME:-sitmun3}/${DATABASE_PASSWORD:-sitmun3}@//localhost:1521/${DATABASE:-sitmun3} | grep -q "1"
'
interval: 5s
timeout: 5s
start_period: 60s
retries: 20
example:
profiles:
- dev
image: postgres:16-alpine
restart: always
environment:
POSTGRES_DB: example
POSTGRES_USER: example
POSTGRES_PASSWORD: example
ports:
- "9005:5432"
volumes:
- example_data:/var/lib/postgresql/data
- ./profiles/development/demo-data:/docker-entrypoint-initdb.d
volumes:
pgdata:
oradata:
example_data: