forked from GeoNode/geonode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·109 lines (84 loc) · 3.55 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
# Exit script in case of error
set -e
# Start cron && memcached services
service cron restart
service memcached restart
echo $"\n\n\n"
echo "-----------------------------------------------------"
echo "STARTING DJANGO ENTRYPOINT $(date)"
echo "-----------------------------------------------------"
/usr/local/bin/invoke update > /usr/src/geonode/invoke.log 2>&1
source $HOME/.bashrc
source $HOME/.override_env
echo DOCKER_API_VERSION=$DOCKER_API_VERSION
echo POSTGRES_USER=$POSTGRES_USER
echo POSTGRES_PASSWORD=$POSTGRES_PASSWORD
echo DATABASE_URL=$DATABASE_URL
echo GEODATABASE_URL=$GEODATABASE_URL
echo SITEURL=$SITEURL
echo ALLOWED_HOSTS=$ALLOWED_HOSTS
echo GEOSERVER_PUBLIC_LOCATION=$GEOSERVER_PUBLIC_LOCATION
echo MONITORING_ENABLED=$MONITORING_ENABLED
echo MONITORING_HOST_NAME=$MONITORING_HOST_NAME
echo MONITORING_SERVICE_NAME=$MONITORING_SERVICE_NAME
echo MONITORING_DATA_TTL=$MONITORING_DATA_TTL
/usr/local/bin/invoke waitfordbs > /usr/src/geonode/invoke.log 2>&1
echo "waitfordbs task done"
echo "running migrations"
/usr/local/bin/invoke migrations > /usr/src/geonode/invoke.log 2>&1
echo "migrations task done"
cmd="$@"
echo DOCKER_ENV=$DOCKER_ENV
if [ -z ${DOCKER_ENV} ] || [ ${DOCKER_ENV} = "development" ]
then
/usr/local/bin/invoke prepare > /usr/src/geonode/invoke.log 2>&1
echo "prepare task done"
/usr/local/bin/invoke fixtures > /usr/src/geonode/invoke.log 2>&1
echo "fixture task done"
if [ ${IS_CELERY} = "true" ] || [ ${IS_CELERY} = "True" ]
then
echo "Executing Celery server $cmd for Development"
else
echo "install requirements for development"
/usr/local/bin/invoke devrequirements > /usr/src/geonode/invoke.log 2>&1
echo "refresh static data"
/usr/local/bin/invoke statics > /usr/src/geonode/invoke.log 2>&1
echo "static data refreshed"
echo "Executing standard Django server $cmd for Development"
fi
else
if [ ${IS_CELERY} = "true" ] || [ ${IS_CELERY} = "True" ]
then
echo "Executing Celery server $cmd for Production"
else
/usr/local/bin/invoke prepare > /usr/src/geonode/invoke.log 2>&1
echo "prepare task done"
if [ ${FORCE_REINIT} = "true" ] || [ ${FORCE_REINIT} = "True" ] || [ ! -e "/mnt/volumes/statics/geonode_init.lock" ]; then
/usr/local/bin/invoke updategeoip > /usr/src/geonode/invoke.log 2>&1
echo "updategeoip task done"
/usr/local/bin/invoke fixtures > /usr/src/geonode/invoke.log 2>&1
echo "fixture task done"
/usr/local/bin/invoke monitoringfixture > /usr/src/geonode/invoke.log 2>&1
echo "monitoringfixture task done"
/usr/local/bin/invoke initialized > /usr/src/geonode/invoke.log 2>&1
echo "initialized"
fi
echo "refresh static data"
/usr/local/bin/invoke statics > /usr/src/geonode/invoke.log 2>&1
echo "static data refreshed"
/usr/local/bin/invoke waitforgeoserver > /usr/src/geonode/invoke.log 2>&1
echo "waitforgeoserver task done"
/usr/local/bin/invoke geoserverfixture > /usr/src/geonode/invoke.log 2>&1
echo "geoserverfixture task done"
/usr/local/bin/invoke updateadmin > /usr/src/geonode/invoke.log 2>&1
echo "updateadmin task done"
echo "Executing UWSGI server $cmd for Production"
fi
fi
echo "-----------------------------------------------------"
echo "FINISHED DJANGO ENTRYPOINT --------------------------"
echo "-----------------------------------------------------"
# Run the CMD
echo "got command $cmd"
exec $cmd