forked from wustl-oncology/cloud-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
infra.sh
executable file
·49 lines (45 loc) · 1.84 KB
/
infra.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
VM_NAME=cromwell
DB_INSTANCE=cromwell1
DEPLOY_NAME=cromwell
DOCKER_IMAGE=mgibio/cloudize-workflow
SRC_DIR="$(dirname "$0")"
case $1 in
"start")
echo "Starting database $DB_INSTANCE"
gcloud sql instances patch $DB_INSTANCE --activation-policy ALWAYS
echo "Starting compute VM $VM_NAME"
gcloud compute instances start $VM_NAME
;;
"stop")
echo "Stopping compute VM $VM_NAME"
gcloud compute instances stop $VM_NAME
echo "Stopping database $DB_INSTANCE"
gcloud sql instances patch $DB_INSTANCE --activation-policy NEVER
;;
"create-deploy")
echo "Creating new deployment"
gcloud deployment-manager deployments create $DEPLOY_NAME --config $SRC_DIR/central-server/jinja/deployment.yaml
;;
"update-deploy")
echo "Updating previous deployment"
gcloud deployment-manager deployments update $DEPLOY_NAME --config $SRC_DIR/central-server/jinja/deployment.yaml
;;
"redeploy")
echo "Deleting previous deployment"
gcloud deployment-manager deployments delete $DEPLOY_NAME
echo "Creating new deployment"
gcloud deployment-manager deployments create $DEPLOY_NAME --config $SRC_DIR/central-server/jinja/deployment.yaml
;;
"build-and-tag")
VERSION=$(head -n 1 "$SRC_DIR/VERSION")
echo "Building container image tagged latest"
docker build $SRC_DIR -t $DOCKER_IMAGE:latest
# this one will be cached, basically just doing a tag without having to find image ID
echo "Building container image tagged $VERSION"
docker build $SRC_DIR -t $DOCKER_IMAGE:$VERSION
echo "Pushing container image tagged latest"
docker push $DOCKER_IMAGE:latest
echo "Pushing container image tagged $VERSION"
docker push $DOCKER_IMAGE:$VERSION
;;
esac