Skip to content

Commit

Permalink
Deploy latest version to production (#340)
Browse files Browse the repository at this point in the history
* Deployment Workflow Update (#332)

* ci(workflow): moved ingress deployment to seprate workflows

* ci(deploy workflow): updated gcloud actions and removed ingress+cert from finalize steps

* ci(e2e workflow): now runs on changes to relevant paths and added allure generate step

* fix(e2e workflow): fixed trigger paths

* fix(server): added prisma seed path to jest ignore

* chore(dx): remove husky precommit; it's annoying

* Modify client arch to be more consistent with server & improve error handling on server (#328)

* feat(client): move src/features/core to src/core; more consistent with server arch

* feat(server): implement new ProtectedError class, integrate into accounts

* Client Fixes (#336)

* fix(client): re-added imgs removed by mistake

* fix(client): event form now displays correctly

* Dockerfile Optimizations + Workflow Trigger (#338)

* chore(dockerfiles): copy only nessisary files

* chore(client dockerfile): commens and cleanup

* fix(dockerfiles): typo

* ci(workflow): added relevant dockerfile as path trigger

* chore(graphql): removed deprecated queries and subscriptions

* ci(prod workflows): removed old unused if checks

Co-authored-by: DevelopmentByDavid <[email protected]>
Co-authored-by: DevelopmentByDavid <[email protected]>
  • Loading branch information
3 people authored Jul 6, 2022
1 parent 6e06046 commit 34b5505
Show file tree
Hide file tree
Showing 82 changed files with 509 additions and 554 deletions.
1 change: 1 addition & 0 deletions .github/workflows/client-build-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- staging
paths:
- 'app/client/**'
- 'docker/Dockerfile.client'

jobs:
build:
Expand Down
49 changes: 23 additions & 26 deletions .github/workflows/client-prod-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ on:
branches:
- prod
paths:
- 'app/client/**'
- 'app/client/**'
- 'docker/Dockerfile.client'
env:
PROJECT_ID: ${{ secrets.GKE_PROJECT_ID }}
GKE_CLUSTER: prytaneum-dev-cluster
Expand All @@ -24,28 +25,32 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- id: 'auth'
uses: 'google-github-actions/[email protected]'
with:
credentials_json: '${{ secrets.GKE_SA_KEY }}'

# Setup gcloud CLI
- uses: google-github-actions/[email protected]
- name: 'Set up Cloud SDK'
uses: google-github-actions/[email protected]
with:
service_account_key: ${{ secrets.GKE_SA_KEY }}
project_id: ${{ secrets.GKE_PROJECT_ID }}

# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- run: |-
gcloud --quiet auth configure-docker
# Get the GKE credentials so we can deploy to the cluster
- uses: google-github-actions/[email protected]
- id: 'get-credentials'
uses: google-github-actions/[email protected]
with:
cluster_name: ${{ env.GKE_CLUSTER }}
location: ${{ env.GKE_ZONE }}
credentials: ${{ secrets.GKE_SA_KEY }}

# Build the Client
- name: Build Client
if: steps.changes.outputs.client == 'true'
run: |-
docker build \
-f ./docker/Dockerfile.client \
Expand All @@ -59,19 +64,16 @@ jobs:
# Push the Client image to Google Container Registry
- name: Publish Client
if: steps.changes.outputs.client == 'true'
run: docker push "gcr.io/$PROJECT_ID/$CLIENT_IMAGE:$GITHUB_SHA"

# Set up kustomize
- name: Set up Kustomize
if: steps.changes.outputs.client == 'true'
run: |-
curl -sfLo kustomize https://github.com/kubernetes-sigs/kustomize/releases/download/v3.1.0/kustomize_3.1.0_linux_amd64
chmod u+x ./kustomize
# Deploy the Docker image to the GKE cluster
- name: Kustomize & Deploy Client
if: steps.changes.outputs.client == 'true'
run: |-
cd ./k8s/client/production
kustomize edit set image gcr.io/PROJECT_ID/CLIENT_IMAGE:TAG=gcr.io/$PROJECT_ID/$CLIENT_IMAGE:$GITHUB_SHA
Expand All @@ -86,34 +88,29 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- id: 'auth'
uses: 'google-github-actions/[email protected]'
with:
credentials_json: '${{ secrets.GKE_SA_KEY }}'

# Setup gcloud CLI
- uses: google-github-actions/[email protected]
- name: 'Set up Cloud SDK'
uses: google-github-actions/[email protected]
with:
service_account_key: ${{ secrets.GKE_SA_KEY }}
project_id: ${{ secrets.GKE_PROJECT_ID }}

# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- run: |-
gcloud --quiet auth configure-docker
# Get the GKE credentials so we can deploy to the cluster
- uses: google-github-actions/[email protected]
# Get the GKE credentials
- id: 'get-credentials'
uses: google-github-actions/[email protected]
with:
cluster_name: ${{ env.GKE_CLUSTER }}
location: ${{ env.GKE_ZONE }}
credentials: ${{ secrets.GKE_SA_KEY }}

- name: Kustomize & Deploy Ingress
run: |-
cd ./k8s/ingress/production
kubectl apply -f ./prytaneum-ingress.yml
- name: Deploy Certificate
run: |-
cd ./k8s/cert
kubectl apply -f ./prytaneum-managed-certificate-dev.yml

- name: Set kubectl context
run: |-
Expand Down
41 changes: 21 additions & 20 deletions .github/workflows/client-staging-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- staging
paths:
- 'app/client/**'
- 'docker/Dockerfile.client'

env:
PROJECT_ID: ${{ secrets.GKE_PROJECT_ID }}
Expand All @@ -27,22 +28,27 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- id: 'auth'
uses: 'google-github-actions/[email protected]'
with:
credentials_json: '${{ secrets.GKE_SA_KEY }}'

# Setup gcloud CLI
- uses: google-github-actions/[email protected]
- name: 'Set up Cloud SDK'
uses: google-github-actions/[email protected]
with:
service_account_key: ${{ secrets.GKE_SA_KEY }}
project_id: ${{ secrets.GKE_PROJECT_ID }}

# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- run: |-
gcloud --quiet auth configure-docker
# Get the GKE credentials so we can deploy to the cluster
- uses: google-github-actions/[email protected]
- id: 'get-credentials'
uses: google-github-actions/[email protected]
with:
cluster_name: ${{ env.GKE_CLUSTER }}
location: ${{ env.GKE_ZONE }}
credentials: ${{ secrets.GKE_SA_KEY }}

# Build the Client
- name: Build Client
Expand Down Expand Up @@ -83,34 +89,29 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- id: 'auth'
uses: 'google-github-actions/[email protected]'
with:
credentials_json: '${{ secrets.GKE_SA_KEY }}'

# Setup gcloud CLI
- uses: google-github-actions/[email protected]
- name: 'Set up Cloud SDK'
uses: google-github-actions/[email protected]
with:
service_account_key: ${{ secrets.GKE_SA_KEY }}
project_id: ${{ secrets.GKE_PROJECT_ID }}

# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- run: |-
gcloud --quiet auth configure-docker
# Get the GKE credentials so we can deploy to the cluster
- uses: google-github-actions/[email protected]
# Get the GKE credentials
- id: 'get-credentials'
uses: google-github-actions/[email protected]
with:
cluster_name: ${{ env.GKE_CLUSTER }}
location: ${{ env.GKE_ZONE }}
credentials: ${{ secrets.GKE_SA_KEY }}

- name: Kustomize & Deploy Ingress
run: |-
cd ./k8s/ingress/development
kubectl apply -f ./prytaneum-ingress.yml
- name: Deploy Certificate
run: |-
cd ./k8s/cert
kubectl apply -f ./prytaneum-managed-certificate-dev.yml

- name: Set kubectl context
run: |-
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches:
- staging
- prod
paths:
- 'app/client/**'
- 'app/server/**'
- 'app/e2e/**'

jobs:
e2e:
Expand Down Expand Up @@ -42,6 +46,9 @@ jobs:
- name: Run Playwright tests
run: yarn workspace @app/e2e run test:ci

- name: Generate Allure Report
run: yarn workspace @app/e2e run allure:generate-report

- uses: actions/upload-artifact@v2
if: always()
with:
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/ingress-prod-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Deploy prod ingress

on:
push:
branches:
- prod
paths:
- 'k8s/ingress/production/**'
- 'k8s/cert/**'

env:
GKE_CLUSTER: prytaneum-dev-cluster
GKE_ZONE: us-central1-a
NAMESPACE: development
GOOGLE_ANALYTICS_ID: ${{ secrets.DEV_GOOGLE_ANALYTICS_ID }}

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: development

steps:
- name: Checkout
uses: actions/checkout@v3

- id: 'auth'
uses: 'google-github-actions/[email protected]'
with:
credentials_json: '${{ secrets.GKE_SA_KEY }}'

# Setup gcloud CLI
- name: 'Set up Cloud SDK'
uses: google-github-actions/[email protected]
with:
project_id: ${{ secrets.GKE_PROJECT_ID }}

# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- run: |-
gcloud --quiet auth configure-docker
# Get the GKE credentials so we can deploy to the cluster
- id: 'get-credentials'
uses: google-github-actions/[email protected]
with:
cluster_name: ${{ env.GKE_CLUSTER }}
location: ${{ env.GKE_ZONE }}

- name: Kustomize & Deploy Ingress
run: |-
cd ./k8s/ingress/development
kubectl apply -f ./prytaneum-ingress.yml
- name: Deploy Certificate
run: |-
cd ./k8s/cert
kubectl apply -f ./prytaneum-managed-certificate-dev.yml
- name: Set kubectl context
run: |-
kubectl config set-context --current --namespace=$NAMESPACE
- name: Deployment Rollout Check
run: |-
kubectl get services -o wide
65 changes: 65 additions & 0 deletions .github/workflows/ingress-staging-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Deploy staging ingress

on:
push:
branches:
- staging
paths:
- 'k8s/ingress/development/**'
- 'k8s/cert/**'

env:
GKE_CLUSTER: prytaneum-dev-cluster
GKE_ZONE: us-central1-a
NAMESPACE: development
GOOGLE_ANALYTICS_ID: ${{ secrets.DEV_GOOGLE_ANALYTICS_ID }}

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: development

steps:
- name: Checkout
uses: actions/checkout@v3

- id: 'auth'
uses: 'google-github-actions/[email protected]'
with:
credentials_json: '${{ secrets.GKE_SA_KEY }}'

# Setup gcloud CLI
- name: 'Set up Cloud SDK'
uses: google-github-actions/[email protected]
with:
project_id: ${{ secrets.GKE_PROJECT_ID }}

# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- run: |-
gcloud --quiet auth configure-docker
# Get the GKE credentials so we can deploy to the cluster
- id: 'get-credentials'
uses: google-github-actions/[email protected]
with:
cluster_name: ${{ env.GKE_CLUSTER }}
location: ${{ env.GKE_ZONE }}

- name: Kustomize & Deploy Ingress
run: |-
cd ./k8s/ingress/development
kubectl apply -f ./prytaneum-ingress.yml
- name: Deploy Certificate
run: |-
cd ./k8s/cert
kubectl apply -f ./prytaneum-managed-certificate-dev.yml
- name: Set kubectl context
run: |-
kubectl config set-context --current --namespace=$NAMESPACE
- name: Deployment Rollout Check
run: |-
kubectl get services -o wide
1 change: 1 addition & 0 deletions .github/workflows/server-build-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- staging
paths:
- 'app/server/**'
- 'docker/Dockerfile.server'

jobs:
build:
Expand Down
Loading

0 comments on commit 34b5505

Please sign in to comment.