forked from Elastic-Suite/gally
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
164 lines (155 loc) · 4.97 KB
/
docker-compose.yml
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
version: "3.4"
services:
php:
build:
context: ./api
target: gally_php
depends_on:
- database
- elasticsearch
- redis
restart: unless-stopped
volumes:
- php_socket:/var/run/php
healthcheck:
interval: 10s
timeout: 3s
retries: 10
start_period: 120s
environment:
DATABASE_URL: postgresql://${POSTGRES_USER:-api-platform}:${POSTGRES_PASSWORD:-!ChangeMe!}@database:5432/${POSTGRES_DB:-api}?serverVersion=${POSTGRES_VERSION:-13}
TRUSTED_PROXIES: ${TRUSTED_PROXIES:-127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16}
TRUSTED_HOSTS: ^${SERVER_NAME:-example\.com|localhost}|caddy$$
# MERCURE_URL: ${CADDY_MERCURE_URL:-http://caddy/.well-known/mercure}
# MERCURE_PUBLIC_URL: https://${SERVER_NAME:-localhost}/.well-known/mercure
# MERCURE_JWT_SECRET: ${CADDY_MERCURE_JWT_SECRET:-!ChangeMe!}
pwa:
build:
context: ./front
target: gally_pwa_prod
environment:
API_PLATFORM_CLIENT_GENERATOR_ENTRYPOINT: https://caddy
NEXT_PUBLIC_ENTRYPOINT: https://caddy
healthcheck:
test: test $$(curl --connect-timeout 2 -s -o /dev/null -w ''%{http_code}'' http://localhost:3000) -eq 200
interval: 10s
timeout: 5s
retries: 10
caddy:
build:
context: api/
target: gally_caddy
depends_on:
- php
- pwa
environment:
PWA_UPSTREAM: pwa:3000
# EXAMPLE_UPSTREAM: example:3001
# SERVER_NAME: ${SERVER_NAME:-localhost, caddy:80}
SERVER_NAME: ${SERVER_NAME:-localhost}
# VARNISH_UPSTREAM: varnish:80
VARNISH_UPSTREAM: varnish:80
# MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeMe!}
# MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeMe!}
CADDY_TRUSTED_PROXIES: ${CADDY_TRUSTED_PROXIES:-127.0.0.0/8 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16}
restart: unless-stopped
volumes:
- php_socket:/var/run/php
- caddy_data:/data
- caddy_config:/config
ports:
# HTTP
- target: 80
published: ${HTTP_PORT:-80}
protocol: tcp
# HTTPS
- target: 443
published: ${HTTPS_PORT:-443}
protocol: tcp
# HTTP/3
- target: 443
published: ${HTTP3_PORT:-443}
protocol: udp
- target: 8080
published: 8080
protocol: tcp
varnish:
# image: varnish:fresh-alpine
image: varnish:7.2.1
depends_on:
- caddy
restart: unless-stopped
volumes:
- './api/docker/varnish/default.vcl:/etc/varnish/default.vcl:ro,z'
environment:
- VARNISH_SIZE=512M
# - SERVERNAME=${SERVER_NAME:-localhost, caddy:80}
# If http2 not already supported out of the box
# command: "-p default_keep=300 -p feature=+http2"
command: "-p default_keep=300 -p http_resp_hdr_len=65k"
# restart: unless-stopped
# ports:
# - target: 80
# published: 8080
# protocol: tcp
database:
image: postgres:${POSTGRES_VERSION:-13}-alpine
environment:
- POSTGRES_DB=${POSTGRES_DB:-api}
# You should definitely change the password in production
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-!ChangeMe!}
- POSTGRES_USER=${POSTGRES_USER:-api-platform}
volumes:
- db_data:/var/lib/postgresql/data:rw,z
# you may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
# - ./api/docker/db/data:/var/lib/postgresql/data:rw,z
redis:
image: docker.io/bitnami/redis:6.2
environment:
# ALLOW_EMPTY_PASSWORD is recommended only for development.
- ALLOW_EMPTY_PASSWORD=yes
# - REDIS_DISABLE_COMMANDS=FLUSHDB,FLUSHALL
ports:
- '6379:6379'
volumes:
- 'redis_data:/bitnami/redis/data'
elasticsearch:
build:
context: api/
target: gally_elasticsearch
# restart: unless-stopped
environment:
- cluster.name=es-docker-cluster
- bootstrap.memory_lock=true
- discovery.type=single-node
- "ES_JAVA_OPTS=-Xms512m -Xmx512m" # 512 Mo HEAP
- cluster.routing.allocation.disk.threshold_enabled=false # Avoid ES going read-only because low disk space availability
volumes:
- es_data:/usr/share/elasticsearch/data:rw,z
ulimits:
memlock:
soft: -1
hard: -1
ports:
- 9200:9200
# - 9300:9300
healthcheck:
test: test $$(curl --write-out %{http_code} --fail --silent --output /dev/null http://localhost:9200/_cluster/health?wait_for_status=green&timeout=5s) -eq 200
interval: 10s
timeout: 5s
retries: 10
# Mercure is installed as a Caddy module, prevent the Flex recipe from installing another service
###> symfony/mercure-bundle ###
###< symfony/mercure-bundle ###
volumes:
php_socket:
caddy_data:
caddy_config:
###> doctrine/doctrine-bundle ###
db_data:
###< doctrine/doctrine-bundle ###
es_data:
###> symfony/mercure-bundle ###
###< symfony/mercure-bundle ###
redis_data:
driver: local