-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·52 lines (39 loc) · 1.42 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
#!/bin/bash
# exit immediately if a command exits with a non-zero status
set -e
# Migrate the database
mkdir -p /workspaces/vespadb/logs
touch /workspaces/vespadb/logs/django.log
chmod -R 755 /workspaces/vespadb/logs
# Ensure static directory exists
mkdir -p /workspaces/vespadb/static
mkdir -p /workspaces/vespadb/collected_static
echo "Applying database migrations..."
python manage.py migrate --noinput
# Collect static files
echo "Collecting static files..."
python manage.py collectstatic --noinput
# Load initial data if required
echo "Loading municipalities, provinces and anb areas..."
python manage.py load_municipalities
python manage.py load_provinces
python manage.py load_anb
echo "Assign provinces to municipalities..."
python manage.py assign_provinces_to_municipalities
echo "Create django admin user with python manage.py createsuperuser"
echo "Load waarnemingen observation data via: python manage.py load_waarnemingen_observations"
# Start Gunicorn
echo "Starting Gunicorn..."
gunicorn --workers 3 --bind 0.0.0.0:8000 vespadb.wsgi:application &
# Wait for Gunicorn to start
sleep 5
# Start Celery worker
echo "Starting Celery worker..."
celery -A vespadb worker --loglevel=info &
# Start Celery beat scheduler
echo "Starting Celery beat scheduler..."
celery -A vespadb beat --loglevel=info --scheduler django_celery_beat.schedulers:DatabaseScheduler &
# Start Nginx
echo "Starting Nginx..."
nginx -g "daemon off;"
exec "$@"