nk20/entrypoint.sh

34 lines
1.2 KiB
Bash
Raw Normal View History

2020-06-21 18:27:42 +00:00
#!/bin/sh
2020-02-18 20:30:26 +00:00
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
if [ -z ${NOTE_URL+x} ]; then
echo "Warning: your env files are not configurated."
else
2020-09-01 12:16:18 +00:00
sed -i -e "s/example.com/$DOMAIN/g" /var/www/note_kfet/apps/member/fixtures/initial.json
sed -i -e "s/localhost/$NOTE_URL/g" /var/www/note_kfet/note_kfet/fixtures/initial.json
sed -i -e "s/\"\.\*\"/\"https?:\/\/$NOTE_URL\/.*\"/g" /var/www/note_kfet/note_kfet/fixtures/cas.json
sed -i -e "s/REPLACEME/La Note Kfet \\\\ud83c\\\\udf7b/g" /var/www/note_kfet/note_kfet/fixtures/cas.json
fi
2020-09-01 11:52:28 +00:00
# Set up Django project
python3 manage.py collectstatic --noinput
python3 manage.py compilemessages
python3 manage.py compilejsmessages
2020-09-01 11:52:28 +00:00
python3 manage.py migrate
2020-02-03 10:50:42 +00:00
2020-09-01 11:52:28 +00:00
if [ "$1" ]; then
# Command passed
echo "Running $@..."
$@
2020-06-21 18:27:42 +00:00
else
2020-09-01 11:52:28 +00:00
# Launch server
if [ "$DJANGO_APP_STAGE" = "prod" ]; then
2020-09-01 12:16:18 +00:00
uwsgi --http-socket 0.0.0.0:8080 --master --plugins python3 \
--module note_kfet.wsgi:application --env DJANGO_SETTINGS_MODULE=note_kfet.settings \
--processes 4 --static-map /static=/var/www/note_kfet/static --harakiri=20 --max-requests=5000 --vacuum
2020-09-01 11:52:28 +00:00
else
python3 manage.py runserver 0.0.0.0:8080;
fi
2020-06-21 18:27:42 +00:00
fi