-
Notifications
You must be signed in to change notification settings - Fork 11
/
deploy-first-time.sh
42 lines (32 loc) · 1.24 KB
/
deploy-first-time.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
#!/bin/bash
bold() {
echo ". $(tput bold)" "$*" "$(tput sgr0)";
}
err() {
echo "$*" >&2;
}
bold "Set all vars..."
set -a
source .properties
set +a
bold "Create a cluster for project:" $PROJECT_ID
gcloud container clusters create $GKE_CLUSTER --region $REGION --num-nodes $TOTAL_NODES --min-nodes $MIN_NODES --max-nodes $MAX_NODES
bold "Download service account key"
gcloud iam service-accounts keys create master.json --iam-account=$SA_EMAIL
bold "Create Secrets & Config maps"
kubectl create configmap chatserver-config --from-env-file=backend/.env
kubectl create secret generic credentials --from-file=master.json
bold "Build container & push to registry"
gcloud builds submit --config _cloudbuilder/setup.yaml
bold "Eval the templates & deploy the containers..."
cat _cloudbuilder/chatserver-deployment.yaml | envsubst | kubectl apply -f -
cat _cloudbuilder/web-deployment.yaml | envsubst | kubectl apply -f -
bold "Create services..."
kubectl apply -f _cloudbuilder/services.yaml
bold "SSL Domain"
gcloud compute addresses create $GKE_CLUSTER \
--global \
--ip-version IPV4
cat _cloudbuilder/domain.yaml | envsubst | kubectl apply -f -
bold "Create loadbalancer / Ingress..."
cat _cloudbuilder/loadbalancer.yaml | envsubst | kubectl apply -f -