-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanage-server.sh
executable file
·33 lines (32 loc) · 1.26 KB
/
manage-server.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
#!/bin/bash
if [ "$1" = "loadandrun" ]
then
docker volume create --name=mongodb_data_volume
docker-compose up -d
sleep 3
mongoimport --host localhost --port 27018 \
--username mongouser --password supersecretpassword \
--authenticationDatabase admin \
--db paranuara --collection people --file resources/people.json --jsonArray
mongoimport --host localhost --port 27018 \
--username mongouser --password supersecretpassword \
--authenticationDatabase admin \
--db paranuara --collection companies --file resources/companies.json --jsonArray
mongoimport --host localhost --port 27018 \
--username mongouser --password supersecretpassword \
--authenticationDatabase admin \
--db paranuara --collection food --file resources/food.json --jsonArray
echo "--- API Server ready to accept connections ---"
elif [ "$1" = "test" ]
then
docker-compose run --rm -e DB=TEST app sh -c 'python manage.py test && flake8'
elif [ "$1" = "startapp" ]
then
docker-compose run --rm app sh -c "python manage.py startapp $2"
elif [ "$1" = "run" ]
then
docker-compose up -d
elif [ "$1" = "down" ]
then
docker-compose down
fi