-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun
More file actions
executable file
·54 lines (46 loc) · 2.18 KB
/
run
File metadata and controls
executable file
·54 lines (46 loc) · 2.18 KB
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
if [[ "$1" == "install" ]];
then
python3 -m venv venv
echo "Created Virtual Environment"
source venv/bin/activate
echo "Installing Dependencies"
venv/bin/pip install --upgrade pip
venv/bin/pip install --upgrade --force-reinstall --ignore-installed --no-cache-dir -r requirements.txt
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-366.0.0-linux-x86_64.tar.gz
tar -xf google-cloud-sdk-366.0.0-linux-x86_64.tar.gz
./google-cloud-sdk/install.sh -q
./google-cloud-sdk/bin/gcloud config set compute/zone us-east1-c
./google-cloud-sdk/bin/gcloud init
bash -c "venv/bin/pip freeze -l | sed 's/==.*//g'" > requirements.txt
echo "Dependencies Installed"
deactivate
elif [[ "$1" == "pylint" ]];
then
source venv/bin/activate
bash -c "find . \( -name venv -prune \) -o \( -name google-cloud-sdk -prune \) -o -name "*.py" -print | xargs pylint" >> pylintOut.txt
deactivate
elif [[ "$1" == "deploy" ]];
then
source venv/bin/activate
bash -c "TZ=UTC date +'/%Y-%m-%d %H:%M:/,\$p' > date.txt"
sed 's/"title": "ECE 461 - Fall 2021 - Project 2.paw",/"title": "ECE 461 - Fall 2021 - Project 2",/' apiImported.json | sed '8,9d' | sed 's/"version": "v0\.0\.0"/"version": "v1\.0\.0"/' | sed 's/"schemes": \[/"host": "ece461-p2-t3.appspot.com",/' | sed 's/"basePath": "\/",/"basePath": "\/",/' > api/api.json
bash -c "./google-cloud-sdk/bin/gcloud endpoints services deploy api/api.json" 2> deployLogapiout.txt 1> deployLogapisuccess.txt
awk '{gsub(/\\n/,"\n")}1' deployLogapiout.txt > deployLogapioutpretty.txt
./google-cloud-sdk/bin/gcloud app deploy ./package_moduleshelf/app.yaml ./api/apiAppEngine.yaml --promote --quiet --stop-previous-version
./google-cloud-sdk/bin/gcloud app logs read --limit=100 > deployLog.txt
sed -f date.txt -n deployLog.txt > deployLogRecent.txt
deactivate
elif [[ "$1" == "deployLog" ]];
then
./google-cloud-sdk/bin/gcloud app logs read --limit=100 > deployLog.txt
sed -f date.txt -n deployLog.txt > deployLogRecent.txt
elif [[ "$1" == "clean" ]];
then
rm date.txt
rm deployLog*
rm -rf venv
rm -rf packageTemp
rm -rf google-cloud-sdk
rm -rf google-cloud-sdk-*.tar.*
rm -rf ./api/api.json
fi