-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose-tls.yml
More file actions
152 lines (146 loc) · 4.15 KB
/
Copy pathdocker-compose-tls.yml
File metadata and controls
152 lines (146 loc) · 4.15 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
# Proton OCaml Driver Test Environment with TLS Support
#
# Usage:
# Generate certificates first:
# ./docker/generate-certs.sh
#
# Run both TLS and non-TLS services:
# docker-compose -f docker-compose-tls.yml up -d
#
# Run tests:
# docker-compose -f docker-compose-tls.yml exec ocaml-env dune test
#
# Services:
# - proton: Standard Proton database (no TLS, for compatibility)
# - proton-tls: Proton with mTLS enabled
# - ocaml-env: OCaml development environment
services:
# Standard Proton Database (no TLS)
proton:
image: ghcr.io/timeplus-io/proton:latest
container_name: proton-ocaml-test
ports:
- "8123:8123" # HTTP port
- "8463:8463" # Native TCP port
volumes:
- proton-data:/var/lib/proton
- ./docker/proton-config.xml:/etc/proton-server/config.xml:ro
- ./docker/users.xml:/etc/proton-server/users.xml:ro
environment:
- PROTON_LOG_LEVEL=error
- PROTON_MAX_MEMORY_USAGE_RATIO=0.8
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:8123/?query=SELECT%201 || exit 1"]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s
networks:
- proton-net
restart: unless-stopped
# Proton Database with TLS
proton-tls:
build:
context: .
dockerfile: docker/Dockerfile.proton-tls
container_name: proton-ocaml-test-tls
ports:
- "8124:8123" # HTTP port (different from non-TLS)
- "8464:8463" # Native TCP port (different from non-TLS)
- "8443:8443" # HTTPS port (with TLS)
- "9440:9440" # Native TCP secure port (with TLS)
volumes:
- proton-tls-data:/var/lib/proton
# Mount certificates
- ./docker/certs:/etc/proton-server/certs:ro
environment:
- PROTON_LOG_LEVEL=error
- PROTON_MAX_MEMORY_USAGE_RATIO=0.8
depends_on:
- cert-generator
healthcheck:
test: ["CMD-SHELL", "proton-client --host localhost --port 8463 --query 'SELECT 1' || exit 1"]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s
networks:
- proton-net
restart: unless-stopped
# Certificate generator service (runs once)
cert-generator:
image: alpine:latest
container_name: proton-cert-generator
volumes:
- ./docker:/docker
command: |
sh -c "
apk add --no-cache openssl bash &&
cd /docker &&
if [ ! -f /docker/certs/ca.pem ]; then
echo 'Generating certificates...' &&
bash /docker/generate-certs.sh
else
echo 'Certificates already exist'
fi
"
networks:
- proton-net
# OCaml development and testing environment
ocaml-env:
build:
context: .
dockerfile: docker/Dockerfile.ocaml
container_name: proton-ocaml-env
volumes:
# Mount source code for development
- .:/app
- opam-cache:/home/opam/.opam
- dune-cache:/home/opam/.cache/dune
# Mount certificates for client
- ./docker/certs:/app/certs:ro
environment:
# Non-TLS configuration
- PROTON_HOST=proton
- PROTON_PORT=8463
- PROTON_HTTP_PORT=8123
- PROTON_DATABASE=default
- PROTON_USER=default
- PROTON_PASSWORD=
# TLS configuration
- PROTON_TLS_HOST=proton-tls
- PROTON_TLS_PORT=9440
- PROTON_TLS_HTTP_PORT=8443
- PROTON_TLS_USER=proton_user
- PROTON_TLS_PASSWORD=proton_ocaml_test
- PROTON_TLS_CA_CERT=/app/certs/ca.pem
- PROTON_TLS_CLIENT_CERT=/app/certs/client.pem
- PROTON_TLS_CLIENT_KEY=/app/certs/client-key.pem
# Development settings
- OPAMROOT=/home/opam/.opam
- OCAML_VERSION=5.1
working_dir: /app
depends_on:
proton:
condition: service_healthy
proton-tls:
condition: service_healthy
networks:
- proton-net
# Keep container running for development
command: ["tail", "-f", "/dev/null"]
restart: unless-stopped
networks:
proton-net:
driver: bridge
driver_opts:
com.docker.network.bridge.name: proton-ocaml-br
volumes:
proton-data:
driver: local
proton-tls-data:
driver: local
opam-cache:
driver: local
dune-cache:
driver: local