2022-08-02 18:02:50 +00:00
|
|
|
# Why we are running with network_mode: host
|
|
|
|
# Wow this has been awful. We run three things in docker: mysql, keycloak, and the backend server.
|
|
|
|
# The backend-server needs to talk to the other two.
|
|
|
|
#
|
|
|
|
# In order to talk to keycloak, it needs to go through localhost so that it can communicate with
|
|
|
|
# keycloak using the same url as the frontend so that tokens can be properly validated.
|
|
|
|
# If the domains are different, keycloak invalidates the token. There may be a way to change
|
|
|
|
# this but I didn't find it.
|
|
|
|
#
|
|
|
|
# In order for the backend server to talk to the mysql server, they need to be on the same network.
|
|
|
|
# I tried splitting it out where the mysql runs on a custom network and the backend runs on both
|
|
|
|
# the custom network AND with localhost. Nothing I tried worked and googling didn't help. They
|
|
|
|
# only ever mentioned one thing or using host.docker.internal which would cause the domains to
|
|
|
|
# be different.
|
|
|
|
#
|
|
|
|
# So instead we are running with both the mysql server and the backend server in host netowrk mode.
|
|
|
|
# There may be a better way to do this but if it works, then it works.
|
|
|
|
|
2022-06-01 18:50:44 +00:00
|
|
|
version: "3.8"
|
|
|
|
services:
|
|
|
|
db:
|
|
|
|
container_name: db
|
|
|
|
image: mysql:8.0.29
|
2022-07-01 14:30:01 +00:00
|
|
|
platform: linux/amd64
|
2022-06-01 18:50:44 +00:00
|
|
|
cap_add:
|
|
|
|
- SYS_NICE
|
2022-06-23 18:53:13 +00:00
|
|
|
restart: "${SPIFFWORKFLOW_BACKEND_DATABASE_DOCKER_RESTART_POLICY:-no}"
|
2022-06-01 18:50:44 +00:00
|
|
|
environment:
|
2022-06-23 18:53:13 +00:00
|
|
|
- MYSQL_DATABASE=${SPIFFWORKFLOW_BACKEND_DATABASE_NAME:-spiffworkflow_backend_development}
|
|
|
|
- MYSQL_ROOT_PASSWORD=${SPIFFWORKFLOW_BACKEND_MYSQL_ROOT_DATABASE:-my-secret-pw}
|
2022-08-02 18:02:50 +00:00
|
|
|
- MYSQL_TCP_PORT=7003
|
|
|
|
network_mode: host
|
2022-06-01 18:50:44 +00:00
|
|
|
ports:
|
2022-08-02 18:02:50 +00:00
|
|
|
- "7003"
|
2022-06-01 18:50:44 +00:00
|
|
|
volumes:
|
|
|
|
- spiffworkflow_backend:/var/lib/mysql
|
2022-06-01 19:49:05 +00:00
|
|
|
healthcheck:
|
2022-06-23 18:53:13 +00:00
|
|
|
test: mysql --user=root --password=${SPIFFWORKFLOW_BACKEND_MYSQL_ROOT_DATABASE:-my-secret-pw} -e 'select 1' ${SPIFFWORKFLOW_BACKEND_DATABASE_NAME:-spiffworkflow_backend_development}
|
2022-07-07 16:27:03 +00:00
|
|
|
interval: 10s
|
|
|
|
timeout: 5s
|
2022-07-11 20:36:34 +00:00
|
|
|
retries: 10
|
2022-06-01 18:50:44 +00:00
|
|
|
|
2022-08-02 18:02:50 +00:00
|
|
|
spiffworkflow-backend: &spiffworkflow-backend
|
2022-06-01 18:50:44 +00:00
|
|
|
container_name: spiffworkflow-backend
|
2022-08-02 18:02:50 +00:00
|
|
|
profiles:
|
|
|
|
- run
|
2022-06-01 18:50:44 +00:00
|
|
|
depends_on:
|
2022-06-10 21:19:20 +00:00
|
|
|
db:
|
|
|
|
condition: service_healthy
|
2022-06-01 18:50:44 +00:00
|
|
|
build:
|
|
|
|
context: .
|
|
|
|
environment:
|
|
|
|
- APPLICATION_ROOT=/
|
2022-06-23 18:53:13 +00:00
|
|
|
- FLASK_ENV=${FLASK_ENV:-development}
|
2022-07-07 16:27:03 +00:00
|
|
|
- FLASK_DEBUG=0
|
2022-06-23 18:53:13 +00:00
|
|
|
- FLASK_SESSION_SECRET_KEY=${FLASK_SESSION_SECRET_KEY:-super_secret_key}
|
2022-08-17 21:26:41 +00:00
|
|
|
- OPEN_ID_SERVER_URL=${OPEN_ID_SERVER_URL:-http://localhost:7002}
|
2022-08-17 21:56:38 +00:00
|
|
|
- SPIFFWORKFLOW_FRONTEND_URL=${SPIFFWORKFLOW_FRONTEND_URL:-http://localhost:7001}
|
|
|
|
- SPIFFWORKFLOW_BACKEND_URL=${SPIFFWORKFLOW_BACKEND_URL:-http://localhost:7000}
|
2022-06-23 18:53:13 +00:00
|
|
|
- SPIFFWORKFLOW_BACKEND_PORT=7000
|
|
|
|
- SPIFFWORKFLOW_BACKEND_UPGRADE_DB=true
|
2022-08-02 18:02:50 +00:00
|
|
|
- SPIFFWORKFLOW_BACKEND_DATABASE_URI=mysql+mysqlconnector://root:${SPIFFWORKFLOW_BACKEND_MYSQL_ROOT_DATABASE:-my-secret-pw}@localhost:7003/${SPIFFWORKFLOW_BACKEND_DATABASE_NAME:-spiffworkflow_backend_development}
|
2022-06-01 18:50:44 +00:00
|
|
|
- BPMN_SPEC_ABSOLUTE_DIR=/app/process_models
|
2022-06-23 20:35:02 +00:00
|
|
|
- SPIFFWORKFLOW_BACKEND_LOAD_FIXTURE_DATA=${SPIFFWORKFLOW_BACKEND_LOAD_FIXTURE_DATA:-false}
|
2022-06-01 18:50:44 +00:00
|
|
|
ports:
|
|
|
|
- "7000:7000"
|
2022-08-02 18:02:50 +00:00
|
|
|
network_mode: host
|
2022-06-01 18:50:44 +00:00
|
|
|
volumes:
|
2022-06-23 19:27:53 +00:00
|
|
|
- ${BPMN_SPEC_ABSOLUTE_DIR:-./../sample-process-models}:/app/process_models
|
2022-07-07 14:19:52 +00:00
|
|
|
- ./log:/app/log
|
2022-06-23 19:27:53 +00:00
|
|
|
healthcheck:
|
|
|
|
test: curl localhost:7000/v1.0/status --fail
|
2022-07-07 16:27:03 +00:00
|
|
|
interval: 10s
|
|
|
|
timeout: 5s
|
2022-07-11 20:36:34 +00:00
|
|
|
retries: 20
|
2022-06-01 18:50:44 +00:00
|
|
|
|
2022-08-02 18:02:50 +00:00
|
|
|
spiffworkflow-backend-local-debug:
|
|
|
|
<<: *spiffworkflow-backend
|
|
|
|
container_name: spiffworkflow-backend-local-debug
|
|
|
|
profiles:
|
|
|
|
- debug
|
|
|
|
volumes:
|
|
|
|
- ${BPMN_SPEC_ABSOLUTE_DIR:-./../sample-process-models}:/app/process_models
|
|
|
|
- ./:/app
|
|
|
|
command: /app/bin/boot_in_docker_debug_mode
|
|
|
|
|
|
|
|
# the docs say we can disable healthchecks with disable: true
|
|
|
|
# but it returns a bad exit code so setup one that doesn't matter
|
|
|
|
# since there is nothing to healthcheck in this case
|
|
|
|
# https://docs.docker.com/compose/compose-file/compose-file-v3/#healthcheck
|
|
|
|
healthcheck:
|
|
|
|
test: cat /etc/hosts
|
|
|
|
interval: 10s
|
|
|
|
timeout: 5s
|
|
|
|
retries: 20
|
|
|
|
|
2022-06-01 18:50:44 +00:00
|
|
|
volumes:
|
|
|
|
spiffworkflow_backend:
|
|
|
|
driver: local
|