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

fix: deploy weather service on update #206

Merged
merged 1 commit into from
Apr 18, 2023
Merged
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
29 changes: 27 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -60,7 +60,8 @@ jobs:
ALLOWED_HOSTS: 127.0.0.1
CSRF_TRUSTED_ORIGINS: http://127.0.0.1

deploy:
deploy-web-service:
name: Deploy Web Service
runs-on: ubuntu-20.04
needs: [migrate, gcr-push]
steps:
@@ -81,4 +82,28 @@ jobs:
uses: google-github-actions/deploy-cloudrun@v1
with:
region: europe-west1
metadata: ./service.yaml
metadata: ./services/web_service.yaml

deploy-weather-cron:
name: Deploy Weather Cron Job
runs-on: ubuntu-20.04
needs: [migrate, gcr-push]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Ubuntu packages
run: |
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
libgdal26
- id: auth
name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCLOUD_SERVICE_KEY }}

- id: deploy
name: Deploy to GCR
uses: google-github-actions/deploy-cloudrun@v1
with:
region: europe-west1
metadata: ./services/weather_service.yaml
4 changes: 2 additions & 2 deletions .releaserc.yaml
Original file line number Diff line number Diff line change
@@ -18,11 +18,11 @@ plugins:
numReplacements: 1
countMatches: true
- files:
- "service.yaml"
- "web_service.yaml"
from: "gcr.io/garden-server-381815/garden-server:.*"
to: "gcr.io/garden-server-381815/garden-server:${nextRelease.version}"
results:
- file: "service.yaml"
- file: "web_service.yaml"
hasChanged: true


95 changes: 95 additions & 0 deletions services/weather_service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
apiVersion: run.googleapis.com/v1
kind: Job
metadata:
name: garden-server
namespace: '400668159616'
selfLink: /apis/run.googleapis.com/v1/namespaces/400668159616/jobs/garden-server
uid: 28632f04-2e89-4236-b8b9-8576a54351f5
resourceVersion: AAX5lghBBZM
generation: 7
creationTimestamp: '2023-04-17T06:03:52.644269Z'
labels:
cloud.googleapis.com/location: europe-west1
run.googleapis.com/lastUpdatedTime: '2023-04-17T08:27:06.512391Z'
annotations:
run.googleapis.com/client-name: cloud-console
run.googleapis.com/lastModifier: oli.edmund.parker@gmail.com
client.knative.dev/user-image: gcr.io/garden-server-381815/garden-server:1.4.5 # x-release-please-version
run.googleapis.com/creator: oli.edmund.parker@gmail.com
run.googleapis.com/operation-id: f9c1acaa-196a-4913-9488-2a633a6ddebc
spec:
template:
metadata:
annotations:
run.googleapis.com/client-name: cloud-console
client.knative.dev/user-image: gcr.io/garden-server-381815/garden-server:1.4.5 # x-release-please-version
run.googleapis.com/execution-environment: gen2
spec:
parallelism: 1
taskCount: 1
template:
spec:
containers:
- image: gcr.io/garden-server-381815/garden-server:1.4.5 # x-release-please-version
command:
- ./manage.py
- populate_weather
env:
- name: DJANGO_SETTINGS_MODULE
valueFrom:
secretKeyRef:
key: latest
name: DJANGO_SETTINGS_MODULE
- name: DJANGO_DATABASE_PASSWORD
valueFrom:
secretKeyRef:
key: latest
name: DJANGO_DATABASE_PASSWORD
- name: DJANGO_DATABASE_HOST
valueFrom:
secretKeyRef:
key: latest
name: DJANGO_DATABASE_HOST
- name: DJANGO_DATABASE_NAME
valueFrom:
secretKeyRef:
key: latest
name: DJANGO_DATABASE_NAME
- name: CSRF_TRUSTED_ORIGINS
valueFrom:
secretKeyRef:
key: latest
name: CSRF_TRUSTED_ORIGINS
- name: ALLOWED_HOST
valueFrom:
secretKeyRef:
key: latest
name: ALLOWED_HOST
- name: SECRET_KEY
valueFrom:
secretKeyRef:
key: latest
name: SECRET_KEY
- name: DJANGO_DATABASE_USER
valueFrom:
secretKeyRef:
key: latest
name: DJANGO_DATABASE_USER
resources:
limits:
cpu: 1000m
memory: 512Mi
maxRetries: 0
timeoutSeconds: '600'
serviceAccountName: 400668159616-compute@developer.gserviceaccount.com
status:
observedGeneration: 7
conditions:
- type: Ready
status: 'True'
lastTransitionTime: '2023-04-17T06:03:53.219778Z'
executionCount: 27
latestCreatedExecution:
name: garden-server-mfm8r
completionTimestamp: '2023-04-18T06:01:01.535013Z'
creationTimestamp: '2023-04-18T06:00:00.769788Z'
File renamed without changes.