2022-10-12 14:22:22 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
function error_handler() {
|
|
|
|
>&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}."
|
|
|
|
exit "$2"
|
|
|
|
}
|
|
|
|
trap 'error_handler ${LINENO} $?' ERR
|
|
|
|
set -o errtrace -o errexit -o nounset -o pipefail
|
|
|
|
|
2023-02-15 22:07:12 +00:00
|
|
|
SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR=$(./bin/find_sample_process_models)
|
|
|
|
export SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR
|
2022-10-12 14:22:22 +00:00
|
|
|
|
|
|
|
if [[ -z "${SPIFFWORKFLOW_BACKEND_DOCKER_COMPOSE_PROFILE:-}" ]]; then
|
|
|
|
export SPIFFWORKFLOW_BACKEND_DOCKER_COMPOSE_PROFILE=run
|
|
|
|
fi
|
|
|
|
|
|
|
|
additional_args=""
|
|
|
|
if [[ "${RUN_WITH_DAEMON:-}" != "false" ]]; then
|
|
|
|
additional_args="${additional_args} -d"
|
|
|
|
fi
|
|
|
|
|
2023-06-08 21:26:14 +00:00
|
|
|
docker --version
|
|
|
|
|
2022-10-12 14:22:22 +00:00
|
|
|
docker compose --profile "$SPIFFWORKFLOW_BACKEND_DOCKER_COMPOSE_PROFILE" build
|
|
|
|
docker compose --profile "$SPIFFWORKFLOW_BACKEND_DOCKER_COMPOSE_PROFILE" stop
|
|
|
|
|
|
|
|
if [[ "${SPIFFWORKFLOW_BACKEND_RECREATE_DATABASE:-}" == "true" ]]; then
|
|
|
|
docker stop db
|
|
|
|
docker rm db
|
|
|
|
docker volume rm spiffworkflow-backend_spiffworkflow_backend
|
|
|
|
|
|
|
|
# i observed a case locally where the db had a stale sqlalchemy revision which
|
|
|
|
# caused the backend to exit and when docker compose up was running with
|
|
|
|
# --wait, it just said waiting forever (like we have seen in CI). so removing
|
|
|
|
# the volume would work around that case, if the volumes are not cleaned up in
|
|
|
|
# CI. also removing the wait prevents it from hanging forever in the case where
|
|
|
|
# the backend crashes, so then we'll just wait for the timeout to happen in the
|
|
|
|
# bin/wait_for_server_to_be_up script.
|
|
|
|
docker volume rm spiffworkflow-backend_spiffworkflow_backend || echo 'docker volume not found'
|
|
|
|
fi
|
|
|
|
|
2023-06-08 21:26:14 +00:00
|
|
|
# docker compose isn't automatically pulling the image in ci so do it explicitly with docker
|
|
|
|
docker pull mysql:8.0.29
|
|
|
|
|
2022-10-12 14:22:22 +00:00
|
|
|
docker compose --profile "$SPIFFWORKFLOW_BACKEND_DOCKER_COMPOSE_PROFILE" up --wait $additional_args
|