Skip to content

Commit

Permalink
Add support for custom DotEnv file
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Krätzig committed Nov 23, 2021
1 parent 5b7ab52 commit 9240b3f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
9 changes: 7 additions & 2 deletions install/_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions install/wrap-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down

0 comments on commit 9240b3f

Please sign in to comment.