diff --git a/.gitignore b/.gitignore index 4a86daa0ee..e1dbcd6c9e 100644 --- a/.gitignore +++ b/.gitignore @@ -69,6 +69,9 @@ target/ # https://docs.docker.com/compose/extends/ docker-compose.override.yml +# https://docs.docker.com/compose/environment-variables/#using-the---env-file--option +.env.custom + *.tar data/ .vscode/tags diff --git a/README.md b/README.md index 5c93853f16..7265016f90 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,16 @@ Official bootstrap for running your own [Sentry](https://sentry.io/) with [Docke ## Setup +### Customize DotEnv (.env) file + +Environment specific configurations can be done in the `.env.custom` file. It will be located in the root directory of the Sentry installation. + +By default, there exists no `.env.custom` file. In this case, you can manually add this file by copying the `.env` file to a new `.env.custom` file and adjust your settings in the `.env.custom` file. + +Please keep in mind to check the `.env` file for changes, when you perform an upgrade of Sentry, so that you can adjust your `.env.custom` accordingly, if required. + +### Installation + To get started with all the defaults, simply clone the repo and run `./install.sh` in your local check-out. Sentry uses Python 3 by default since December 4th, 2020 and Sentry 21.1.0 is the last version to support Python 2. During the install, a prompt will ask if you want to create a user account. If you require that the install not be blocked by the prompt, run `./install.sh --no-user-prompt`. diff --git a/install/_lib.sh b/install/_lib.sh index 06bfcbb5e3..a957e96c63 100644 --- a/install/_lib.sh +++ b/install/_lib.sh @@ -12,7 +12,12 @@ else cd "$(dirname $0)" # assume we're a test script or some such fi -_ENV="$(realpath ../.env)" +# Allow `.env` overrides using the `.env.custom` file +if [[ -f "../.env.custom" ]]; then + _ENV="$(realpath ../.env.custom)" +else + _ENV="$(realpath ../.env)" +fi # Read .env for default values with a tip o' the hat to https://stackoverflow.com/a/59831605/90297 t=$(mktemp) && export -p > "$t" && set -a && . $_ENV && set +a && . "$t" && rm "$t" && unset t @@ -26,7 +31,7 @@ else fi dc_base="$(docker compose version &> /dev/null && echo 'docker compose' || echo 'docker-compose')" -dc="$dc_base --ansi never" +dc="$dc_base --ansi never --env-file ${_ENV}" dcr="$dc run --rm" # A couple of the config files are referenced from other subscripts, so they diff --git a/install/wrap-up.sh b/install/wrap-up.sh index 6f1128befa..91638cad95 100644 --- a/install/wrap-up.sh +++ b/install/wrap-up.sh @@ -19,7 +19,11 @@ else echo "" echo "You're all done! Run the following command to get Sentry running:" echo "" + if [[ "${_ENV}" =~ ".env.custom" ]]; then + echo " $dc_base --env-file ${_ENV} up -d" + else echo " $dc_base up -d" + fi echo "" echo "-----------------------------------------------------------------" echo ""