Skip to content

Bump rate limiter by 10x and up to 2.0.1 for prod rerelease #167

Bump rate limiter by 10x and up to 2.0.1 for prod rerelease

Bump rate limiter by 10x and up to 2.0.1 for prod rerelease #167

Workflow file for this run

# This workflow will build a docker container, publish it to Google Container Registry, and deploy it to GKE when a release is created
#
# To configure this workflow:
#
# 1. Ensure that your repository contains the necessary configuration for your Google Kubernetes Engine cluster, including deployment.yml, kustomization.yml, service.yml, etc.
#
# 2. Set up secrets in your workspace: GKE_PROJECT with the name of the project and GKE_SA_KEY with the Base64 encoded JSON service account key (https://github.com/GoogleCloudPlatform/github-actions/tree/docs/service-account-key/setup-gcloud#inputs).
#
# 3. Change the values for the GKE_ZONE, GKE_CLUSTER, IMAGE, and DEPLOYMENT_NAME environment variables (below).
#
# For more support on how to run the workflow, please visit https://github.com/google-github-actions/setup-gcloud/tree/master/example-workflows/gke
name: Build and deploy to staging
on:
push:
branches:
- master
env:
PROJECT_ID: ${{ secrets.GKE_PROJECT }}
GKE_CLUSTER: kipr
GKE_ZONE: us-central1-a
IMAGE: kipr/simulator
concurrency: ${{ github.workflow }}
jobs:
build-publish:
name: Build and publish
runs-on: ubuntu-latest
outputs:
image_version: ${{ steps.image_tag.outputs.IMAGE_TAG }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
lfs: true
- name: Pull LFS
run: git lfs pull
# Calculate image tag name from commit hash
- name: Set image tag output
id: image_tag
run: |-
echo "::set-output name=IMAGE_TAG::${GITHUB_SHA::8}"
# Setup gcloud CLI
- name: Set up gcloud CLI
uses: google-github-actions/[email protected]
with:
service_account_key: ${{ secrets.GCR_SA_KEY }}
project_id: ${{ secrets.GKE_PROJECT }}
# Ensure there isn't already a Docker image for this version
- name: Ensure Docker image does not exist
run: |-
NUM_IMAGES=$(gcloud container images list-tags gcr.io/kipr-321905/kipr/simulator --filter="tags:${{ steps.image_tag.outputs.IMAGE_TAG }}" --format=json | jq '. | length')
if (( NUM_IMAGES > 0 )); then exit 1; fi
# Configure Docker to use the gcloud command-line tool as a credential helper for authentication
- name: Configure Docker with gcloud
run: |-
gcloud --quiet auth configure-docker
# Build the Docker image
- name: Build Docker image
run: |-
docker build \
--tag "gcr.io/$PROJECT_ID/$IMAGE:${{ steps.image_tag.outputs.IMAGE_TAG }}" \
.
# Push the Docker image to Google Container Registry
- name: Publish Docker image to GCR
run: |-
docker push "gcr.io/$PROJECT_ID/$IMAGE:${{ steps.image_tag.outputs.IMAGE_TAG }}"
deploy-to-staging:
name: Deploy to staging
runs-on: ubuntu-latest
needs: build-publish
steps:
- name: Checkout deployment repo
uses: actions/checkout@v2
with:
repository: 'kipr/kipr-yamls'
ssh-key: ${{ secrets.KIPR_YAMLS_REPO_KEY }}
# Get the GKE credentials so we can deploy to the cluster
- name: Get GKE credentials
uses: google-github-actions/[email protected]
with:
cluster_name: ${{ env.GKE_CLUSTER }}
location: ${{ env.GKE_ZONE }}
credentials: ${{ secrets.GCR_SA_KEY }}
- name: Deploy to GKE
run: |-
helm upgrade \
--install \
--namespace prerelease \
--values ./simulator/values.prerelease.yaml \
--set imageVersion=${{ needs.build-publish.outputs.image_version }} \
--set secrets.serviceAccountKeyString=$FIRESTORE_SERVICE_ACCOUNT \
--set secrets.mailgunApiKey=$MAILGUN_API_KEY \
--set secrets.mailgunDomain=$MAILGUN_DOMAIN \
--set apiUrl=http://database.prerelease.svc.cluster.local:4000 \
simulator-prerelease ./simulator
shell: bash
env:
FIRESTORE_SERVICE_ACCOUNT: ${{ secrets.FIRESTORE_SERVICE_ACCOUNT }}
MAILGUN_API_KEY: ${{ secrets.MAILGUN_API_KEY }}
MAILGUN_DOMAIN: ${{ secrets.MAILGUN_DOMAIN }}