-
Notifications
You must be signed in to change notification settings - Fork 1
/
develop.sh
executable file
·40 lines (32 loc) · 961 Bytes
/
develop.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
#!/bin/bash
SQLALCHEMY_DATABASE_URI="postgresql://aam_aadmi_aspataal:aam_aadmi_aspataal@db:5432/aam_aadmi_aspataal"
if [[ ! -d "docker" ]]; then
echo "This script must be run from the top level directory of the aam_aadmi_aspataal source."
exit -1
fi
function invoke_docker_compose {
docker-compose -f docker/docker-compose.yml \
-p aam_aadmi_aspataal \
"$@"
}
function invoke_manage {
invoke_docker_compose run --rm api_server \
python3 manage.py \
"$@"
}
function open_psql_shell {
invoke_docker_compose run --rm api_server psql \
$SQLALCHEMY_DATABASE_URI
}
if [ "$1" == "manage" ]; then shift
echo "Invoking manage.py..."
invoke_manage "$@"
exit
elif [ "$1" == "psql" ]; then
echo "Entering into PSQL shell to query DB..."
open_psql_shell
exit
else
echo "Running docker-compose with the given command..."
invoke_docker_compose "$@"
fi