nk20/entrypoint.sh

33 lines
1.0 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-03-11 16:51:42 +00:00
sed -i -e "s/example.com/$DOMAIN/g" /code/apps/member/fixtures/initial.json
sed -i -e "s/localhost/$NOTE_URL/g" /code/note_kfet/fixtures/initial.json
2020-03-19 15:12:52 +00:00
sed -i -e "s/\"\.\*\"/\"https?:\/\/$NOTE_URL\/.*\"/g" /code/note_kfet/fixtures/cas.json
sed -i -e "s/REPLACEME/La Note Kfet \\\\ud83c\\\\udf7b/g" /code/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 makemigrations
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
# FIXME: serve static files
uwsgi --http 0.0.0.0:8080 --master --module note_kfet.wsgi --processes 4
else
python3 manage.py runserver 0.0.0.0:8080;
fi
2020-06-21 18:27:42 +00:00
fi