-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·66 lines (53 loc) · 2.12 KB
/
run.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
#!/bin/bash
export HOST=${LEAKY_HOST:="0.0.0.0"}
export LEAKY_DOMAIN_NAME=${LEAKY_DOMAIN_NAME:="leaky.com"}
export DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE:="leaky.settings"}
export LEAKY_DEBUG=${LEAKY_DEBUG:="1"}
export LEAKY_SYSTEM_EMAIL=${LEAKY_SYSTEM_EMAIL:="[email protected]"}
export LEAKY_ADMIN_EMAIL=${LEAKY_ADMIN_EMAIL:="[email protected]"}
export LEAKY_ADMIN_PASSWORD=${LEAKY_ADMIN_PASSWORD:="password"}
export LEAKY_DATABASE_NAME=${LEAKY_DATABASE_NAME:="postgres"}
export LEAKY_DATABASE_USER=${LEAKY_DATABASE_USER:="postgres"}
export LEAKY_DATABASE_PASSWORD=${LEAKY_DATABASE_PASSWORD:="postgres"}
export LEAKY_DATABASE_HOST=${LEAKY_DATABASE_HOST:="localhost"}
export LEAKY_DATABASE_PORT=${LEAKY_DATABASE_PORT:="5432"}
export LEAKY_DEFAULT_FROM_EMAIL=${LEAKY_DEFAULT_FROM_EMAIL:="[email protected]"}
export LEAKY_STATIC_ROOT=${LEAKY_STATIC_ROOT:="/srv/leaky-app/static/"}
export LEAKY_MEDIA_ROOT=${LEAKY_MEDIA_ROOT:="/srv/leaky-app/media/"}
export LEAKY_PORT=${LEAKY_PORT:="8000"}
export LEAKY_TESTS=${LEAKY_TESTS:="0"}
# postgres
docker stop leaky-postgres
docker run -d --rm=true --name leaky-postgres -p 5432:5432 -e POSTGRES_PASSWORD=postgres postgres
# we don't need migrations until we have the first stable release
rm -rf ./customers/migrations
rm -rf ./warehouses/migrations
# creating a tmp virtualenv for testing
virtualenv --clear /tmp/leaky_venv -p python3.6
. /tmp/leaky_venv/bin/activate
pip install -r ./requirements.txt
RC=1
while [ $RC -eq 1 ]
do
echo 'Testing database connection...'
python check_db.py
RC=$?
done
# Perform the initial schema migrations
python manage.py makemigrations --noinput
# generate migrations for apps
python manage.py makemigrations customers --noinput
python manage.py makemigrations warehouses --noinput
# generate empty migrations for apps
#python manage.py makemigrations --empty customers --noinput
# applying migrations
python manage.py migrate_schemas
python manage.py migrate_schemas --shared
# create new apps
# python manage.py startapp <app_name>
if [ $LEAKY_TESTS == "1" ]; then
python manage.py test -v 2
fi
python init_db.py
# Start the server
python manage.py runserver ${HOST}:8000