forked from epfl-si/rails.starterkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
233 lines (216 loc) · 7.37 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
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# This docker-compose.yml file is intended for development support. It
# is *not* meant for production.
# https://www.keycloak.org/server/reverseproxy
version: "3.9"
name: people2023
services:
atela:
build: [email protected]:epfl-si/atela-backend.git
environment:
- MOCK_ORACLE=1
- SITE_URL=atela.${DOMAIN:-dev.jkldsa.com}
profiles:
- atela
working_dir: /var/www/vhosts/app/private/tests
# Keycloak is an OpenID-Connect IdP (Identity Provider) that is easy
# to set up. It mocks out that feature in the Rails application,
# allowing testing with arbitrary users and groups. See further
# details on the startup sequence of Keycloak (and the
# --import-realm flag) in ./keycloak/README.md
keycloak:
image: quay.io/keycloak/keycloak:25.0.0
command:
- start-dev
environment:
KC_HOSTNAME: "https://keycloak.dev.jkldsa.com"
# KC_HOSTNAME_PORT: 443
KC_HTTP_ENABLED: false
KC_DB: mariadb
KC_DB_URL: jdbc:mariadb://mariadb:3306/keycloak
KC_DB_USERNAME: keycloak
KC_DB_PASSWORD: mariadb
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: admin
KC_LOG_LEVEL: INFO #DEBUG
labels:
# keycloak
- traefik.docker.network=traefik
- traefik.http.services.kc.loadbalancer.server.port=8080
- traefik.http.routers.kc.rule=Host("keycloak.${DOMAIN:-dev.jkldsa.com}")
- traefik.http.routers.kc.tls=true
networks:
- traefik
- default
mariadb:
image: mariadb:11.4.3
environment:
MARIADB_USER: keycloak
MARIADB_PASSWORD: mariadb
MARIADB_ROOT_PASSWORD: mariadb
volumes:
- mariadb:/var/lib/mysql
- ./db/initdb_dev.d:/docker-entrypoint-initdb.d
networks:
- default
# valkey opensource replacement of redis
# https://hub.docker.com/r/valkey/valkey/
cache:
image: valkey/valkey:7.2
command:
- --maxmemory 32mb
networks:
- default
webapp:
build:
context: .
dockerfile: Dockerfile
args:
- RAILS_ENV=development
- APP_HOME=/srv/app
- LIB_HOME=/srv/lib
env_file: .env
# command:
# - ./bin/dev
command: bin/rails server -p 3000 -b 0.0.0.0
environment:
# PORT: ${PORT:-3000}
# ADDR: ${ADDR:-127.0.0.1}
APP_HOSTNAME: "people.${DOMAIN:-dev.jkldsa.com}"
KILLPID: ${KILLPID:-no}
RAILS_ENV: development
RAILS_DEVELOPMENT_HOSTS: "people.${DOMAIN:-dev.jkldsa.com},api.${DOMAIN:-dev.jkldsa.com}"
ENABLE_API_CACHE: "${ENABLE_API_CACHE:-false}"
ENABLE_WEBMOCK: "${ENABLE_WEBMOCK:-false}"
# in dev cache is enabled only if the file "tmp/caching-dev.txt" exists
# if REDIS_CACHE is defined then redis is used otherwise default to memory
REDIS_CACHE: redis://cache:6379/0
# I set this to get rid of an warning msg but it does not work.
# https://www.oracle.com/database/technologies/faq-nls-lang.html
# NLS_LANG: "en_US.UTF-8"
CAMIPRO_PHOTO_KEY: ${CAMIPRO_PHOTO_KEY}
CAMIPRO_PHOTO_HOST: ${CAMIPRO_PHOTO_HOST:-camipro-photos.epfl.ch}
ORACOURS_PWD: ${ORACOURS_PWD}
ATELA_KEY: ${ATELA_KEY}
EPFLAPI_BACKEND_URL: ${EPFLAPI_BACKEND_URL:-https://api.epfl.ch/v1}
EPFLAPI_PASSWORD: ${EPFLAPI_PASSWORD}
OFFLINE_CACHEDIR: "/srv/filecache"
FORCE_AUDIENCE: ${FORCE_AUDIENCE:-4}
SHOW_ERROR_PAGES: ${SHOW_ERROR_PAGES:-no}
ADMIN_SCIPERS: ${ADMIN_SCIPERS}
OIDC_HOSTNAME: keycloak.${DOMAIN:-dev.jkldsa.com}
OIDC_REALM: rails
OIDC_IDENTIFIER: hello_rails
extra_hosts:
- "api.${DOMAIN:-dev.jkldsa.com}:${DOCKER_IP}"
- "keycloak.${DOMAIN:-dev.jkldsa.com}:${DOCKER_IP}"
volumes:
- ./:/srv/app
- storage:/srv/app/storage
- filecache:/srv/filecache
labels:
- traefik.http.middlewares.cgibin.replacepathregex.regex=^/cgi-bin/(.*)
- traefik.http.middlewares.cgibin.replacepathregex.replacement=/api/v0/$$1
- traefik.docker.network=traefik
- traefik.http.services.people2.loadbalancer.server.port=${PORT:-3000}
- traefik.http.routers.people2.rule=Host("people.${DOMAIN:-dev.jkldsa.com}")
- traefik.http.routers.people2.tls=true
- traefik.http.routers.people2.middlewares=cgibin
- traefik.http.middlewares.api.addPrefix.prefix=/fakeapi
- traefik.http.routers.epflapi.rule=Host("api.${DOMAIN:-dev.jkldsa.com}")
- traefik.http.routers.epflapi.middlewares=api
- traefik.http.routers.epflapi.tls=true
# - traefik.http.routers.peoplengrok.rule=Host("2.tcp.eu.ngrok.io")
# - traefik.http.routers.peoplengrok.tls=true
networks:
- traefik
- default
tty: true
stdin_open: true
# directus:
# image: directus/directus:11.0.0
# volumes:
# - directus_uploads:/directus/uploads
# - directus_extensions:/directus/extensions
# environment:
# PUBLIC_URL: "https://directus.${DOMAIN:-dev.jkldsa.com}"
# SECRET: "whatever"
# ADMIN_EMAIL: "[email protected]"
# ADMIN_PASSWORD: "1234"
# DB_CLIENT: "mysql"
# DB_HOST: mariadb
# DB_PORT: 3306
# DB_DATABASE: people
# DB_USER: people
# DB_PASSWORD: mariadb
# WEBSOCKETS_ENABLED: "true"
# LOG_LEVEL: debug
# LOG_STYLE: pretty
# labels:
# - traefik.docker.network=traefik
# - traefik.http.services.directus.loadbalancer.server.port=8055
# - traefik.http.routers.directus.rule=Host("directus.${DOMAIN:-dev.jkldsa.com}")
# - traefik.http.routers.directus.tls=true
# networks:
# - traefik
# - default
noc:
image: ${NOCIMAGE:-jonlabelle/network-tools}
stdin_open: true
tty: true
profiles:
- noc
networks:
- traefik
- default
phpmyadmin:
image: phpmyadmin/phpmyadmin
environment:
- PMA_HOST=mariadb
- PMA_ABSOLUTE_URI=https://peopledb.${DOMAIN:-dev.jkldsa.com}
- PMA_ARBITRARY=1
# volumes:
# - ./storage/phpmyadmin_sessions:/sessions
labels:
- traefik.docker.network=traefik
- traefik.http.routers.peodb2.rule=Host("peopledb.${DOMAIN:-dev.jkldsa.com}")
- traefik.http.routers.peodb2.tls=true
- traefik.http.services.peodb2.loadbalancer.server.port=80
networks:
- traefik
- default
# redis-commander:
# container_name: redis-commander
# hostname: redis-commander
# image: rediscommander/redis-commander:latest
# restart: always
# environment:
# - REDIS_HOSTS=cache:6379/0
# labels:
# - traefik.docker.network=traefik
# - traefik.http.routers.peodis.rule=Host("peopledis.${DOMAIN:-dev.jkldsa.com}")
# - traefik.http.routers.peodis.tls=true
# - traefik.http.services.peodis.loadbalancer.server.port=8081
# TODO: add also firefox as an option (see https://nicolasiensen.github.io/2022-03-11-running-rails-system-tests-with-docker/)
# https://github.com/SeleniumHQ/docker-selenium
selenium:
image: selenium/standalone-chrome:112.0
shm_size: "2gb"
profiles:
- test
labels:
- traefik.docker.network=traefik
- traefik.http.services.peoselen.loadbalancer.server.port=7900
- traefik.http.routers.peoselen.rule=Host("selenium.${DOMAIN:-dev.jkldsa.com}")
- traefik.http.routers.peoselen.tls=true
networks:
- traefik
- default
volumes:
mariadb: {}
filecache: {}
storage: {}
# directus_uploads: {}
# directus_extensions: {}
networks:
traefik:
external: true