install 951 Bytes
Newer Older
Lukas Burgey's avatar
Lukas Burgey committed
1 2
#!/bin/bash

3
config_dir=${config_dir-~/config}
4
logs_dir=${logs_dir-~/logs}
5
secret_key=${secret_key-./.secret.key}
6

7
echo "Using config dir: $config_dir"
Lukas Burgey's avatar
Lukas Burgey committed
8
echo "Using logs dir: $logs_dir"
9

10 11
mkdir -p $logs_dir $config_dir
cp ./example-config/home/feudal/config/* $config_dir/
12 13 14
mkdir -p ~/.config
cp ./example-config/home/feudal/.config/systemd $config_dir/

Lukas Burgey's avatar
Lukas Burgey committed
15
ln -s $config_dir/django_settings.py ./feudal/settings.py
16 17 18
echo

echo "Generating secret at ./.secret.key"
19 20
[[ ! -f $secret_key ]] && \
	dd if=/dev/urandom bs=64 count=1 | base64 > $secret_key
21
echo
Lukas Burgey's avatar
Lukas Burgey committed
22

23
virtualenv -p /usr/bin/python3 ./env
Lukas Burgey's avatar
Lukas Burgey committed
24
source env/bin/activate
25 26

# TODO check dependencies
27
pip install Django django-cors-headers djangorestframework django-mysql mysqlclient oic urllib3 pika
Lukas Burgey's avatar
Lukas Burgey committed
28

29 30 31

echo "Starting database migration (is your database configured?)"

Lukas Burgey's avatar
Lukas Burgey committed
32 33
./manage.py makemigrations backend
./manage.py migrate
34
./manage.py collectstatic
Lukas Burgey's avatar
Lukas Burgey committed
35

36
echo "Creating django super user"
Lukas Burgey's avatar
Lukas Burgey committed
37
./manage.py createsuperuser