Skip to content

Commit f18e957

Browse files
committed
Update deployment to GKE
1 parent 8ff4f39 commit f18e957

File tree

4 files changed

+21
-11
lines changed

4 files changed

+21
-11
lines changed

auth-gcloud.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#! /bin/bash
2+
3+
echo $GCLOUD_KEY | base64 --decode > gcloud.p12
4+
gcloud auth activate-service-account 484500905059-bb55pm9ophqkbhkd1vrront20ati766f@developer.gserviceaccount.com --key-file gcloud.p12
5+
ssh-keygen -f ~/.ssh/google_compute_engine -N ""

circle.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ machine:
55
CLOUDSDK_COMPUTE_ZONE: us-central1-a
66
CLOUDSDK_CORE_PROJECT: circle-docker-hello
77
CLOUDSDK_CONTAINER_CLUSTER: cluster-1
8+
PATH: $PATH:/home/ubuntu/google-cloud-sdk/bin
89
python:
910
version: 2.7.3
1011

@@ -13,27 +14,21 @@ dependencies:
1314
- ~/kubernetes
1415
- ~/google-cloud-sdk
1516
pre:
16-
- pip install pyopenssl
17-
- ssh-keygen -f ~/.ssh/google_compute_engine -N ""
18-
- if [ ! -d ~/google-cloud-sdk ]; then curl https://sdk.cloud.google.com | bash; fi
19-
- ~/google-cloud-sdk/bin/gcloud components update preview
20-
- echo $GCLOUD_KEY | base64 --decode > gcloud.p12
21-
- ~/google-cloud-sdk/bin/gcloud auth activate-service-account 484500905059-bb55pm9ophqkbhkd1vrront20ati766f@developer.gserviceaccount.com --key-file gcloud.p12
22-
- ~/google-cloud-sdk/bin/gcloud preview container pods list
23-
- ./ensure-kubernetes-installed.sh
17+
- ./ensure-gcloud-installed.sh
2418
- sudo docker -d -D -e lxc -s btrfs --insecure-registry $EXTERNAL_REGISTRY_ENDPOINT:
2519
background: true
2620
- docker build -t $EXTERNAL_REGISTRY_ENDPOINT/hello:$CIRCLE_SHA1 .
2721

2822
test:
2923
post:
30-
- docker run -d -p 3000:3000 -e "SECRET_KEY_BASE=abcd1234" $EXTERNAL_REGISTRY_ENDPOINT/hello:$CIRCLE_SHA1; sleep 10
24+
- docker run -d -p 3000:3000 -e "SECRET_KEY_BASE=abcd1234" $EXTERNAL_REGISTRY_ENDPOINT/hello:$CIRCLE_SHA1
3125
- curl --retry 10 --retry-delay 5 -v http://localhost:3000
3226

3327
deployment:
3428
prod:
3529
branch: master
3630
commands:
3731
# - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS $EXTERNAL_REGISTRY_ENDPOINT
38-
- envsubst < .kubernetes_auth.template > ~/.kubernetes_auth
39-
- ./deploy.sh
32+
- docker push $EXTERNAL_REGISTRY_ENDPOINT/hello:$CIRCLE_SHA1
33+
- ./auth-gcloud.sh
34+
- ./rolling-update.sh

ensure-gcloud-installed.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#! /bin/bash
2+
3+
pip install pyopenssl
4+
if [ ! -d ~/google-cloud-sdk ]; then
5+
curl https://sdk.cloud.google.com | bash;
6+
~/google-cloud-sdk/bin/gcloud components update preview
7+
fi
8+

rolling-update.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#! /bin/bash
2+
13
set -eu
24

35
CTRL_BASENAME=railscontroller

0 commit comments

Comments
 (0)