forked from zed-io/kolektivo-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·37 lines (27 loc) · 930 Bytes
/
deploy.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
#!/usr/bin/env bash
set -euo pipefail
# Deploys the blockchain api to App Engine
#
# Flags:
# -n: Name of the network, maps to App Engine 'service' (alfajores, mainnet, etc.)
NETWORK=""
while getopts 'n:p:' flag; do
case "${flag}" in
n) NETWORK="$OPTARG" ;;
*) echo "Unexpected option ${flag}" ;;
esac
done
[ -z "$NETWORK" ] && echo "Need to set the NETWORK via the -n flag" && exit 1;
PROJECT="kolektivo-backend"
echo "Starting blockchain api deployment."
echo 'Deploying to gcloud'
gcloud --project ${PROJECT} app deploy -q "app.${NETWORK}.yaml"
gcloud --project ${PROJECT} app deploy -q dispatch.yaml
gcloud --project ${PROJECT} app deploy -q cron.yaml
echo 'Hitting service url to trigger update'
if [ "$NETWORK" == "mainnet" ] then
curl "https://${PROJECT}.uc.r.appspot.com" > /dev/null 2>&1
else
curl "https://${NETWORK}-dot-${PROJECT}.uc.r.appspot.com" > /dev/null 2>&1
fi
echo "Done deployment."