From 8bb37dc3ccccfeac40558ca442edc26cac49d25d Mon Sep 17 00:00:00 2001 From: Denis Gukov Date: Wed, 5 Oct 2022 22:40:30 +0500 Subject: [PATCH] fix(docker): bolt support --- cli/cmd/setup.go | 14 +++----------- deployment/docker/common/semaphore-wrapper | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/cli/cmd/setup.go b/cli/cmd/setup.go index 274da252..ee2ce000 100644 --- a/cli/cmd/setup.go +++ b/cli/cmd/setup.go @@ -27,17 +27,9 @@ var setupCmd = &cobra.Command{ //nolint: gocyclo func doSetup() int { var config *util.ConfigType - for { - config = &util.ConfigType{} - config.GenerateSecrets() - setup.InteractiveSetup(config) - - if setup.AskConfigConfirmation(config) { - break - } - - fmt.Println() - } + config = &util.ConfigType{} + config.GenerateSecrets() + setup.InteractiveSetup(config) configPath := setup.SaveConfig(config) util.Config = config diff --git a/deployment/docker/common/semaphore-wrapper b/deployment/docker/common/semaphore-wrapper index 3dc7ffcb..51043910 100755 --- a/deployment/docker/common/semaphore-wrapper +++ b/deployment/docker/common/semaphore-wrapper @@ -4,12 +4,13 @@ set -e echoerr() { printf "%s\n" "$*" >&2; } -SEMAPHORE_CONFIG_PATH="${SEMAPHORE_CONFIG_PATH:-/etc/semaphore}" +SEMAPHORE_CONFIG_PATH="${SEMAPHORE_CONFIG_PATH:-/tmp/semaphore}" SEMAPHORE_TMP_PATH="${SEMAPHORE_TMP_PATH:-/tmp/semaphore}" # Semaphore database env config SEMAPHORE_DB_DIALECT="${SEMAPHORE_DB_DIALECT:-mysql}" -SEMAPHORE_DB_HOST="${SEMAPHORE_DB_HOST:-0.0.0.0}" +SEMAPHORE_DB_HOST="${SEMAPHORE_DB_HOST:-127.0.0.1}" +SEMAPHORE_DB_PATH="${SEMAPHORE_DB_PATH:-/tmp/semaphore/database}" SEMAPHORE_DB_PORT="${SEMAPHORE_DB_PORT:-}" SEMAPHORE_DB="${SEMAPHORE_DB:-semaphore}" SEMAPHORE_DB_USER="${SEMAPHORE_DB_USER:-semaphore}" @@ -81,12 +82,22 @@ esac # Create a config if it does not exist in the current config path if [ ! -f "${SEMAPHORE_CONFIG_PATH}/config.json" ]; then echoerr "Generating ${SEMAPHORE_TMP_PATH}/config.stdin ..." - cat << EOF > "${SEMAPHORE_TMP_PATH}/config.stdin" + if [ "${SEMAPHORE_DB_DIALECT}" = "bolt" ]; then + cat << EOF > "${SEMAPHORE_TMP_PATH}/config.stdin" +${SEMAPHORE_DB_DIALECT_ID} +${SEMAPHORE_DB_PATH} +EOF + else + cat << EOF >> "${SEMAPHORE_TMP_PATH}/config.stdin" ${SEMAPHORE_DB_DIALECT_ID} ${SEMAPHORE_DB_HOST} ${SEMAPHORE_DB_USER} ${SEMAPHORE_DB_PASS} ${SEMAPHORE_DB} +EOF + fi + + cat << EOF >> "${SEMAPHORE_TMP_PATH}/config.stdin" ${SEMAPHORE_TMP_PATH} ${SEMAPHORE_WEB_ROOT} no @@ -111,7 +122,6 @@ EOF fi; cat << EOF >> "${SEMAPHORE_TMP_PATH}/config.stdin" -yes ${SEMAPHORE_CONFIG_PATH} ${SEMAPHORE_ADMIN} ${SEMAPHORE_ADMIN_EMAIL}