-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathsentry_run
executable file
·43 lines (34 loc) · 1.65 KB
/
sentry_run
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
SENTRY_CONF_FILE=${SENTRY_CONF_FILE:-/conf/sentry_docker_conf.py}
# export env var for other scripts to work
export SENTRY_CONF=$SENTRY_CONF_FILE
SCRIPTS_DIR=${SENTRY_SCRIPTS_DIR:-/conf}
# if starting the web worker then try to initialize DB and superuser
if [ "$1" == "start" ] || [ "$1" == "prepare" ]; then
# check DB health if "SENTRY_DOCKER_DO_DB_CHECK" is set
if [ -n "$SENTRY_DOCKER_DO_DB_CHECK" ]; then
python $SCRIPTS_DIR/check_db_isalive.py 10 3
if [ "$?" != "0" ]; then
echo "couldn't establish DB connection. exiting..."
exit 1
fi
fi
sentry --config=$SENTRY_CONF_FILE upgrade --noinput
# create superuser
python $SCRIPTS_DIR/create_team_or_project.py admin "${SENTRY_ADMIN_USERNAME:-admin}" "${SENTRY_ADMIN_EMAIL:-root@localhost}" "${SENTRY_ADMIN_PASSWORD:-admin}"
if [ -n "$SENTRY_INITIAL_TEAM" ]; then
python $SCRIPTS_DIR/create_team_or_project.py team ${SENTRY_ADMIN_USERNAME:-admin} $SENTRY_INITIAL_TEAM
if [ -n "$SENTRY_INITIAL_PROJECT" ]; then
python $SCRIPTS_DIR/create_team_or_project.py project $SENTRY_INITIAL_TEAM $SENTRY_INITIAL_PROJECT
if [ -n "$SENTRY_INITIAL_KEY" ]; then
python $SCRIPTS_DIR/create_team_or_project.py key $SENTRY_INITIAL_TEAM $SENTRY_INITIAL_PROJECT $SENTRY_INITIAL_KEY
fi
if [ -n "$SENTRY_INITIAL_DOMAINS" ]; then
python $SCRIPTS_DIR/create_team_or_project.py origins $SENTRY_INITIAL_TEAM $SENTRY_INITIAL_PROJECT "$SENTRY_INITIAL_DOMAINS"
fi
fi
fi
fi
if [ "$1" != "prepare" ]; then
exec sentry --config=$SENTRY_CONF_FILE $@
fi