Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipeline setup prod #49

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions .github/workflows/deploy.yml

This file was deleted.

4 changes: 1 addition & 3 deletions .github/workflows/gcp_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: G-Cloud Authenticate
env:
SERVICE_CREDENTIALS: ${{ secrets.GCP_SERVICE_CREDENTIALS_DEV }}
SERVICE_ACCOUNT: ${{ secrets.GCP_SERVICE_ACCOUNT_DEV}}
SERVICE_ACCOUNT: ${{ secrets.GCP_SERVICE_ACCOUNT_DEV }}
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID_DEV }}
run: |-
echo "$SERVICE_CREDENTIALS" > ./credentials.json
Expand All @@ -36,5 +36,3 @@ jobs:
- name: Clean Env
if: always()
run: docker system prune --volumes -af


38 changes: 38 additions & 0 deletions .github/workflows/gcp_deploy_prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: gcp_deploy_backend_prod
on:
push:
branches:
- master

jobs:
deploy:
name: deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: G-Cloud Authenticate
env:
SERVICE_CREDENTIALS: ${{ secrets.GCP_SERVICE_CREDENTIALS_PROD }}
SERVICE_ACCOUNT: ${{ secrets.GCP_SERVICE_ACCOUNT_PROD }}
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID_PROD }}
run: |-
echo "$SERVICE_CREDENTIALS" > ./credentials.json
gcloud auth activate-service-account "$SERVICE_ACCOUNT" --key-file=./credentials.json --project="$PROJECT_ID"
gcloud auth configure-docker us-central1-docker.pkg.dev --quiet
- name: Docker Build
env:
IMAGE_NAME: ${{ secrets.GCP_IMAGE_NAME_PROD }}
run: docker build -t "$IMAGE_NAME" .
- name: Push to Container Registry
env:
IMAGE_NAME: ${{ secrets.GCP_IMAGE_NAME_PROD }}
run: sudo -u $USER docker push "$IMAGE_NAME"
- name: Deploy to Cloud Run
env:
IMAGE_NAME: ${{ secrets.GCP_IMAGE_NAME_PROD }}
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID_PROD }}
run: gcloud run deploy uwpath-backend-prod --image="$IMAGE_NAME" --project="$PROJECT_ID" --region=us-central1

- name: Clean Env
if: always()
run: docker system prune --volumes -af
3 changes: 2 additions & 1 deletion uwpath_backend/prod_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False

ALLOWED_HOSTS = ['api.uwpath.com']
ALLOWED_HOSTS = ['api.uwpath.com', 'uwpath-backend-prod-qtsbtvgvna-uc.a.run.app']


# Application definition
Expand Down Expand Up @@ -173,4 +173,5 @@

CORS_ORIGIN_WHITELIST = [
'https://uwpath.com',
'https://uwpath-frontend-prod-qtsbtvgvna-uc.a.run.app'
]