This repository has been archived by the owner on Jun 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge to master for deployment (#189)
Infrastructure rollout
- Loading branch information
JohannesGuenther
authored
Apr 11, 2020
1 parent
62e3b7d
commit 34a8945
Showing
280 changed files
with
11,167 additions
and
4,655 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# | ||
# https://help.github.com/articles/dealing-with-line-endings/ | ||
# | ||
# These are explicitly windows files and should use crlf | ||
*.bat text eol=crlf | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
name: Production | ||
name: Deploy | ||
|
||
on: | ||
release: | ||
types: [published] | ||
push: | ||
branches: | ||
- dev | ||
- jib-integration | ||
|
||
# Environment variables available to all jobs and steps in this workflow | ||
env: | ||
|
@@ -11,13 +15,9 @@ env: | |
CLOUD_SQL_SERVICE_ACCOUNT: ${{ secrets.CLOUD_SQL_SERVICE_ACCOUNT }} | ||
CLOUD_STORE_SERVICE_ACCOUNT: ${{ secrets.CLOUD_STORE_SERVICE_ACCOUNT }} | ||
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | ||
SENTRY_BACKEND_DSN: ${{ secrets.SENTRY_BACKEND_DSN }} | ||
SENTRY_FRONTEND_DSN: ${{ secrets.SENTRY_FRONTEND_DSN }} | ||
GITHUB_SHA: ${{ github.sha }} | ||
GKE_ZONE: europe-west3-b | ||
GKE_CLUSTER: cluster-1 | ||
CLIENT_IMAGE: imis-client | ||
SERVER_IMAGE: imis-server | ||
REGISTRY_HOSTNAME: eu.gcr.io | ||
|
||
jobs: | ||
|
@@ -29,39 +29,45 @@ jobs: | |
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
|
||
- uses: actions/cache@v1 | ||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
# Setup gcloud CLI | ||
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master | ||
with: | ||
version: '270.0.0' | ||
service_account_email: ${{ secrets.GKE_EMAIL }} | ||
service_account_key: ${{ secrets.GKE_KEY }} | ||
project_id: ${{ secrets.GKE_PROJECT_ID }} | ||
- uses: actions/[email protected] | ||
with: | ||
java-version: 1.11 | ||
|
||
# Configure docker to use the gcloud command-line tool as a credential helper | ||
- run: | | ||
# Set up docker to authenticate | ||
# via gcloud command-line tool. | ||
gcloud auth configure-docker | ||
# Build the Docker image | ||
- name: Build client | ||
run: | | ||
(cd client && docker build -f Dockerfile.prod -t "$REGISTRY_HOSTNAME"/"$GKE_PROJECT_ID"/"$CLIENT_IMAGE":"$GITHUB_SHA" \ | ||
--build-arg SENTRY_FRONTEND_DSN="${SENTRY_FRONTEND_DSN}" \ | ||
--build-arg DEPLOY_ENV=production \ | ||
--build-arg GITHUB_SHA="${GITHUB_SHA}" \ | ||
--build-arg GITHUB_REF="${GITHUB_REF}" .) | ||
- name: Build server | ||
run: | | ||
docker build -f Dockerfile.prod -t "$REGISTRY_HOSTNAME"/"$GKE_PROJECT_ID"/"$SERVER_IMAGE":"$GITHUB_SHA" \ | ||
--build-arg GITHUB_SHA="${GITHUB_SHA}" \ | ||
--build-arg GITHUB_REF="${GITHUB_REF}" . | ||
# Push the Docker image to Google Container Registry | ||
- name: Publish | ||
run: | | ||
docker push "$REGISTRY_HOSTNAME/$GKE_PROJECT_ID/$CLIENT_IMAGE:$GITHUB_SHA" | ||
docker push "$REGISTRY_HOSTNAME/$GKE_PROJECT_ID/$SERVER_IMAGE:$GITHUB_SHA" | ||
# Build and push image to Google Container Registry | ||
- name: Build | ||
run: |- | ||
gradle jib --image "$REGISTRY_HOSTNAME/$GKE_PROJECT_ID/imis:$GITHUB_SHA" | ||
# Deploy the Docker image to the GKE cluster | ||
- name: Prepare Helm | ||
|
@@ -74,12 +80,14 @@ jobs: | |
gcloud container clusters get-credentials "$GKE_CLUSTER" --zone "$GKE_ZONE" --project "$GKE_PROJECT_ID" | ||
echo -n "${CLOUD_SQL_SERVICE_ACCOUNT}" > chart/cloudsql.base64.json | ||
echo -n "${CLOUD_STORE_SERVICE_ACCOUNT}" > chart/cloudstore.base64.json | ||
helm repo add stable https://kubernetes-charts.storage.googleapis.com | ||
helm dependency build chart | ||
helm upgrade --install imis chart \ | ||
--set gitSha=${GITHUB_SHA} --set "secrets.postgres=$(echo -n ${POSTGRES_PASSWORD} | base64)" \ | ||
--set "secrets.sentry.backend=${SENTRY_BACKEND_DSN}" \ | ||
--set "secrets.sentry.frontend=${SENTRY_FRONTEND_DSN}" | ||
kubectl rollout status deployment/imis-client | ||
kubectl rollout status deployment/imis-server | ||
kubectl get services -o wide | ||
helm repo add stable "https://kubernetes-charts.storage.googleapis.com" | ||
helm upgrade --install traefik stable/traefik -f chart/traefik.values.yaml | ||
if [[ "$GITHUB_REF" == "refs/heads/master" ]]; then | ||
helm upgrade --install imis-production chart \ | ||
--set gitSha=${GITHUB_SHA} --set "secrets.postgres=$(echo -n ${POSTGRES_PASSWORD} | base64)" | ||
kubectl rollout status deployment/imis-production | ||
else | ||
helm upgrade --install imis-staging chart -f chart/values.staging.yml \ | ||
--set gitSha=${GITHUB_SHA} --set "secrets.postgres=$(echo -n ${POSTGRES_PASSWORD} | base64)" | ||
kubectl rollout status deployment/imis-staging | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.