-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·58 lines (46 loc) · 1.34 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
#!/bin/bash
function DeployApp() {
set -x
gcloud app deploy app.yaml --project ${GCP_PROJECT_NAME}
exit
}
function ListApp() {
set -x
gcloud app services list --filter=SERVICE:${GAE_SERVICE_NAME}
exit
}
function BrowseApp() {
set -x
gcloud app browse -s ${GAE_SERVICE_NAME} --project ${GCP_PROJECT_NAME}
exit
}
function RunApp() {
echo ""
echo "1. Create a virtual Python Environment - (python3 -m venv env-tgen)"
echo "2. Activate the environment - (source env-tgen/bin/activate)"
echo "3. Install the required packages - (pip install -r requirements.txt)"
echo "4. Run the app - (python main.py)"
echo "5. Connect to the app with a browser - (http://localhost:8080/)"
echo ""
exit
}
function RemoveApp() {
set -x
gcloud app services delete ${GAE_SERVICE_NAME}
exit
}
source config.conf
[ "$1" == "-d" ] && DeployApp
[ "$1" == "-l" ] && ListApp
[ "$1" == "-b" ] && BrowseApp
[ "$1" == "-r" ] && RunApp
[ "$1" == "-del" ] && RemoveApp
cat << EOF
Usage: $0 <OPTION>
Where OPTION is ONE of:
-r Run app locally
-d Deploy app ${GAE_SERVICE_NAME} to ${GCP_PROJECT_NAME}
-l List app ${GAE_SERVICE_NAME} and version info
-b Browse app ${GAE_SERVICE_NAME} on ${GCP_PROJECT_NAME}
-del Delete app ${GAE_SERVICE_NAME} from ${GCP_PROJECT_NAME}
EOF