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

Add GCP deployment #152

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
27 changes: 0 additions & 27 deletions .ebextensions/tls.config

This file was deleted.

68 changes: 68 additions & 0 deletions .github/workflows/deploy-app-engine.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Deploy to GCP App Engine

on: [push]

concurrency:
group: "ae"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [latest]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Build
run: npm test
- name: Generate deployment package
run: zip -r deploy.zip . -x '*.git'
- name: Upload deployment package artifact
uses: actions/upload-artifact@v3
with:
name: app-engine
path: deploy.zip

deploy:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
needs: build
environment:
name: gcp-app-engine
url: https://descent.live
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Authenticate to GCP
uses: google-github-actions/auth@v1
with:
workload_identity_provider: ${{ vars.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ vars.GCP_SERVICE_ACCOUNT }}
project_id: ${{ vars.GCP_PROJECT_ID }}
- name: Download deployment package artifact
uses: actions/download-artifact@v3
with:
name: app-engine
- name: Unzip deployment package
run: unzip deploy.zip
- name: Cleanup build files
run: rm -rf deploy.zip .git
- name: Deploy to GCP App Engine
uses: google-github-actions/deploy-appengine@v1
with:
env_vars: |-
HUE_CLIENT=${{ vars.HUE_CLIENT }}
HUE_ID=${{ vars.HUE_ID }}
HUE_SECRET=${{ secrets.HUE_SECRET }}
LASTFM_POLL_INTERVAL=${{ vars.LASTFM_POLL_INTERVAL }}
OPENWEATHERMAP_KEY=${{ secrets.OPENWEATHERMAP_KEY }}
SPOTIFY_CLIENT=${{ vars.SPOTIFY_CLIENT }}
SPOTIFY_SECRET=${{ secrets.SPOTIFY_SECRET }}
54 changes: 0 additions & 54 deletions .github/workflows/deploy-elastic-beanstalk.yml

This file was deleted.

44 changes: 0 additions & 44 deletions .platform/nginx/conf.d/proxy.conf

This file was deleted.

5 changes: 5 additions & 0 deletions app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
runtime: nodejs20
instance_class: F1
automatic_scaling:
max_instances: 1
min_instances: 1
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -566,4 +566,4 @@ async function getWeatherOpenweathermap(key, lat, lon, units, callback) {

/* Application runtime */

app.listen(process.env.DESCENT_PORT || 3000);
app.listen(process.env.DESCENT_PORT || process.env.PORT || 3000);
Loading