forked from civitaspo/superset-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·54 lines (42 loc) · 1.53 KB
/
entrypoint.sh
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
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env bash
# function to initialize apache-superset
initialize_superset () {
USER_COUNT=$(fabmanager list-users --app superset | awk '/email/ {print}' | wc -l)
if [ "$?" == 0 ] && [ $USER_COUNT == 0 ]; then
# Create an admin user (you will be prompted to set username, first and last name before setting a password)
fabmanager create-admin --username superset \
--firstname superset \
--lastname apache \
--email superset@gunosy.com \
--password superset \
--app superset
# Initialize the database
superset db upgrade
# Load some data to play with
#superset load_examples
# Create default roles and permissions
superset init
echo Initialized Apache-Superset. Happy Superset Exploration!
else
echo Apache-Superset Already Initialized.
fi
}
if [ "$#" -ne 0 ]; then
exec "$@"
else
num_retries=0
until psql -c "select 1" postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST/$POSTGRES_DB > /dev/null 2>&1; do
echo "Waiting for postgres server...($((num_retries++))s)"
sleep 1
done
set -ex
initialize_superset
celery worker --app=superset.sql_lab:celery_app --pool=gevent -Ofair &
celery beat --app=superset.tasks.celery_app:app &
gunicorn --bind 0.0.0.0:8088 \
--workers $((2 * $(getconf _NPROCESSORS_ONLN) + 1)) \
--timeout 60 \
--limit-request-line 0 \
--limit-request-field_size 0 \
superset:app
fi