spiff-arena/spiffworkflow-backend/bin/build_and_run_with_docker_compose
jasquat 4fc6b1a193 use carbon components when adding secrets (#312)
* use carbon components when adding secrets

* docker compose pull before running up w/ burnettk

* use all carbon on script task unit test modal w/ burnettk

* removed remaining references to bootstrap from frontend w/ burnettk

* updated usage of hidden to use the class instead of the bootstrap attribute w/ burnettk

* print out docker version for debugging

* docker pull with docker instead of compose

* added comment for docker pull in check docker start script

---------

Co-authored-by: jasquat <jasquat@users.noreply.github.com>
2023-06-08 14:26:14 -07:00

46 lines
1.8 KiB
Bash
Executable File

#!/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
SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR=$(./bin/find_sample_process_models)
export SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR
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
docker --version
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
# docker compose isn't automatically pulling the image in ci so do it explicitly with docker
docker pull mysql:8.0.29
docker compose --profile "$SPIFFWORKFLOW_BACKEND_DOCKER_COMPOSE_PROFILE" up --wait $additional_args