Skip to content

Commit

Permalink
chore: add deployment to gcp
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinccbsg committed Aug 31, 2023
1 parent 58e26be commit bb5f9d8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ jobs:
GOOGLE_STG_CREDENTIAL: ${{ secrets.GOOGLE_STG_CREDENTIAL }}

- name: Build Docker image
run: docker build -t $IMAGE_NAME --build-arg "GOOGLE_CLIENT_ID=${{ secrets.VITE_GOOGLE_CLIENT_ID }}" .
run: docker build -t $IMAGE_NAME --build-arg "SUPABASE_ANON_KEY=${{ secrets.SUPABASE_ANON_KEY }}" --build-arg "SUPABASE_HOST=${{ secrets.SUPABASE_HOST }}" .
env:
VITE_GOOGLE_CLIENT_ID: ${{ secrets.VITE_GOOGLE_CLIENT_ID }}
VITE_SUPABASE_ANON_KEY: ${{ secrets.VITE_SUPABASE_ANON_KEY }}
VITE_SUPABASE_HOST: ${{ secrets.VITE_SUPABASE_HOST }}

- name: Push Docker image
run: docker push $IMAGE_NAME

- name: Deploy Docker image
run: gcloud run deploy ${{ secrets.GCP_APP_NAME }} --image $IMAGE_NAME --region europe-west1 --platform managed --set-env-vars "DATABASE_URL=${{ secrets.DATABASE_URL }}" --set-env-vars "JWT_SEED=${{ secrets.JWT_SEED }}" --set-env-vars "BUCKET_STORAGE=${{ secrets.BUCKET_STORAGE }}" --set-env-vars "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" --set-env-vars "OPEN_AI_ORGANIZATION=${{ secrets.OPEN_AI_ORGANIZATION }}" --set-env-vars "DIRECT_URL=${{ secrets.DIRECT_URL }}" --set-env-vars "WEAVIATE_HOST=${{ secrets.WEAVIATE_HOST }}" --set-env-vars "WEAVIATE_API_KEY=${{ secrets.WEAVIATE_API_KEY }}" --set-env-vars "REDIS_URL=${{ secrets.REDIS_URL }}" --set-env-vars "NODE_ENV=production" --set-env-vars "WEAVIATE_SCHEME=https" --allow-unauthenticated
run: gcloud run deploy ${{ secrets.GCP_APP_NAME }} --image $IMAGE_NAME --region europe-west1 --platform managed --set-env-vars "JWT_SECRET=${{ secrets.JWT_SECRET }}" --set-env-vars "SUPABASE_ANON_KEY=${{ secrets.SUPABASE_ANON_KEY }}" --set-env-vars "SUPABASE_HOST=${{ secrets.SUPABASE_HOST }}" --set-env-vars "REDIS_URL=${{ secrets.REDIS_URL }}" --set-env-vars "NODE_ENV=production" --allow-unauthenticated
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ npm run init:db

## TODOS

- [X] Fix bingo logic
- [ ] show winner
- [x] Fix bingo logic
- [x] show winner
- [ ] deploy
- [ ] frontend improvements bngo
- [ ] logout on finish
- [ ] frontend improvements create game
- [x] frontend improvements bngo
- [x] logout on finish
- [x] frontend improvements create game
- [ ] Testing backend
- [ ] testing frontend
18 changes: 18 additions & 0 deletions docs/deploy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Deploy

We are using Google cloud run to deploy this bot. We are also using Github actions. In order to create the Dockerfile and the Github action script we followed this [blog post](https://cloud.google.com/community/tutorials/cicd-cloud-run-github-actions).

## Setup service account

```
gcloud iam service-accounts create bngo-ci \
--description="Cloud Run deploy account for bngo" \
--display-name="bngo-Cloud-Run-Deploy"
gcloud projects add-iam-policy-binding brikev \
--member=serviceAccount:[email protected] \
--role=roles/run.admin
gcloud iam service-accounts keys create key.json \
--iam-account [email protected]
```

0 comments on commit bb5f9d8

Please sign in to comment.