Skip to content

Commit

Permalink
feat: document drive (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
froid1911 authored Feb 5, 2024
2 parents fba28b4 + d4220d6 commit 6cbdcc9
Show file tree
Hide file tree
Showing 50 changed files with 11,372 additions and 13,482 deletions.
139 changes: 36 additions & 103 deletions .github/workflows/build-and-deploy-staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,115 +2,48 @@ name: Deploy Switchboard Staging

on:
push:
branches: [ main ]
branches: [main]
jobs:
build:
name: build and push to ghcr
runs-on: ubuntu-latest
permissions: write-all

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

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Packages
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.GH_SIDSTRM_BUILD_AND_DEPLOY_USER }}
password: ${{ secrets.GH_SIDSTRM_BUILD_AND_DEPLOY_TOKEN }}

- name: Set outputs
id: vars
run: echo "git_hash_short=$(git rev-parse --short ${GITHUB_SHA})" >> $GITHUB_OUTPUT
# Check-out your repository.
- name: Checkout
uses: actions/checkout@v2

- name: Build and Push switchboard-api
uses: docker/build-push-action@v3
with:
context: ./api
platforms: linux/amd64
push: true
tags: |
ghcr.io/sidestream-tech/switchboard/api:main
ghcr.io/sidestream-tech/switchboard/api:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build and Push switchboard-wundergraph
uses: docker/build-push-action@v3
with:
context: ./wundergraph
platforms: linux/amd64
push: true
tags: |
ghcr.io/sidestream-tech/switchboard/wundergraph:main
ghcr.io/sidestream-tech/switchboard/wundergraph:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build and Push switchboard-frontend
uses: docker/build-push-action@v3
with:
context: .
file: ./frontend/Dockerfile
platforms: linux/amd64
push: true
tags: |
ghcr.io/sidestream-tech/switchboard/frontend:main
ghcr.io/sidestream-tech/switchboard/frontend:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max

deploy:
name: deploy staging to sidestream cluster
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout k8s-projects Repo
uses: actions/checkout@v3
with:
repository: sidestream-tech/k8s-projects
token: ${{ secrets.GH_SIDSTRM_BUILD_AND_DEPLOY_TOKEN }}
path: k8s-projects
ref: main

- uses: benjlevesque/[email protected]
id: short-sha
with:
length: 6

- name: Update Value File API
uses: mikefarah/yq@master
- name: Build, Push and Release API to Heroku. # Your custom step name
uses: gonuit/[email protected]
with:
cmd: yq -i '(.image.tag ="${{ github.sha }}") | (.commitShortSHA ="${{ github.sha }}") | (.releaseTag ="${{ github.ref_name }}")' $VALUES_FILE
env:
VALUES_FILE: "k8s-projects/switchboard-api/staging/values-api.yml"

- name: Update Value File Wundergraph
uses: mikefarah/yq@master
email: ${{ secrets.HEROKU_EMAIL }}
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: ${{ secrets.HEROKU_API_NAME }}
dockerfile_directory: ./api
dockerfile_name: Dockerfile
process_type: web
- name: Build, Push and Release Frontend to Heroku. # Your custom step name
uses: gonuit/[email protected]
with:
cmd: yq -i '(.image.tag ="${{ github.sha }}") | (.commitShortSHA ="${{ github.sha }}") | (.releaseTag ="${{ github.ref_name }}")' $VALUES_FILE
env:
VALUES_FILE: "k8s-projects/switchboard-api/staging/values-wundergraph.yml"

- name: Update Value File Frontend
uses: mikefarah/yq@master
email: ${{ secrets.HEROKU_EMAIL }}
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: ${{ secrets.HEROKU_FRONTEND_NAME }}
dockerfile_directory: ./
dockerfile_name: frontend/Dockerfile
process_type: web
- name: Build, Push and Release Wundergraph to Heroku. # Your custom step name
uses: gonuit/[email protected]
with:
cmd: yq -i '(.image.tag ="${{ github.sha }}") | (.commitShortSHA ="${{ github.sha }}") | (.releaseTag ="${{ github.ref_name }}")' $VALUES_FILE
env:
VALUES_FILE: "k8s-projects/switchboard-api/staging/values-frontend.yml"

- name: Commit & Push changes
uses: actions-js/push@master
email: ${{ secrets.HEROKU_EMAIL }}
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: ${{ secrets.HEROKU_WGRAPH_NAME }}
dockerfile_directory: ./wundergraph
dockerfile_name: Dockerfile
process_type: web
- name: Build, Push and Release NGINX to Heroku. # Your custom step name
uses: gonuit/[email protected]
with:
github_token: ${{ secrets.GH_SIDSTRM_BUILD_AND_DEPLOY_TOKEN }}
repository: sidestream-tech/k8s-projects
branch: main
message: "[ArgoCD]: ${{ github.workflow }} to `${{ steps.short-sha.outputs.sha }}` :rocket:"
directory: k8s-projects
email: ${{ secrets.HEROKU_EMAIL }}
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: ${{ secrets.HEROKU_NGINX_NAME }}
dockerfile_directory: ./nginx
dockerfile_name: Dockerfile
process_type: web
File renamed without changes.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ coverage

# system-related
.DS_Store

.vscode
6 changes: 0 additions & 6 deletions .vscode/extensions.json

This file was deleted.

24 changes: 0 additions & 24 deletions .vscode/settings.json

This file was deleted.

6 changes: 4 additions & 2 deletions api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ COPY . .
# Run in production mode
ENV NODE_ENV=production
RUN sed --in-place 's/sqlite/postgresql/g' ./prisma/schema.prisma
ENV PORT=3000
RUN npx prisma generate

# initialize db and start the app
CMD npx prisma db push && npm run start
RUN useradd -m myuser
USER myuser
CMD npm start
Loading

0 comments on commit 6cbdcc9

Please sign in to comment.