Skip to content

Commit 99d6d3a

Browse files
committed
Improve devops documentation
1 parent fde5f31 commit 99d6d3a

File tree

3 files changed

+61
-7
lines changed

3 files changed

+61
-7
lines changed

README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,15 @@ gcloud run jobs create sync-bird-metadata \
4343
Set the schedule
4444

4545
```r
46-
gcloud scheduler jobs create http sync-bird-metadata-scheduled \
47-
--project nunatsiavut-birds \
46+
gcloud scheduler jobs create http sync-data-gulls-scheduled \
47+
--project=nunatsiavut-birds \
4848
--oauth-service-account-email=run-scheduled-jobs@nunatsiavut-birds.iam.gserviceaccount.com \
4949
--schedule="0 9 1 * *" \
5050
--uri="https://us-central1-run.googleapis.com/apis/run.googleapis.com/v1/namespaces/nunatsiavut-birds/jobs/sync-data-gulls:run" \
5151
--http-method=POST \
5252
--headers="Content-Type=application/json" \
53-
--location=us-central1
53+
--location=us-east1 \
54+
--time-zone="America/Toronto"
5455
```
5556

5657
## Bird locations synchronization task
@@ -133,13 +134,14 @@ gcloud run jobs create sync-data-gulls \
133134

134135
```sh
135136
gcloud scheduler jobs create http sync-data-gulls-scheduled \
136-
--project nunatsiavut-birds \
137+
--project=nunatsiavut-birds \
137138
--oauth-service-account-email=run-scheduled-jobs@nunatsiavut-birds.iam.gserviceaccount.com \
138139
--schedule="0 9 1 * *" \
139140
--uri="https://us-central1-run.googleapis.com/apis/run.googleapis.com/v1/namespaces/nunatsiavut-birds/jobs/sync-data-gulls:run" \
140141
--http-method=POST \
141142
--headers="Content-Type=application/json" \
142-
--location=us-central1
143+
--location=us-east1 \
144+
--time-zone="America/Toronto"
143145
```
144146

145147
#### Declare Eiders sync job
@@ -160,15 +162,20 @@ gcloud run jobs create sync-data-eiders \
160162

161163
```sh
162164
gcloud scheduler jobs create http sync-data-eiders-scheduled \
163-
--project nunatsiavut-birds \
165+
--project=nunatsiavut-birds \
164166
--oauth-service-account-email=run-scheduled-jobs@nunatsiavut-birds.iam.gserviceaccount.com \
165167
--schedule="0 9 1 * *" \
166168
--uri="https://us-central1-run.googleapis.com/apis/run.googleapis.com/v1/namespaces/nunatsiavut-birds/jobs/sync-data-eiders:run" \
167169
--http-method=POST \
168170
--headers="Content-Type=application/json" \
169-
--location="us-central1"
171+
--location=us-east1 \
172+
--time-zone="America/Toronto"
170173
```
171174

175+
### DevOps sequence diagram
176+
177+
![](inst/puml/devops.puml)
178+
172179
### Contributing
173180

174181
Please follow the guidelines described [here](https://github.com/inSilecoInc/iseShinyTemplate?tab=readme-ov-file#code-convention).

inst/puml/devops.png

94.2 KB
Loading

inst/puml/devops.puml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
@startuml
2+
title CI/CD Workflow for Google Cloud Run, Scheduler, and Shiny App
3+
4+
actor Developer as Dev
5+
participant "GitHub Repository" as Repo
6+
participant "GitHub Actions" as Actions
7+
participant "Google Artifact Registry" as Artifactory
8+
participant "Google Cloud Run" as CloudRun
9+
participant "Google Cloud Scheduler" as CloudScheduler
10+
database "Bird Metadata Bucket\n(bird-metadata)" as MetadataBucket
11+
database "Bird Locations Bucket\n(bird-locations)" as LocationsBucket
12+
participant "Shiny App\nhttps://insileco-inc.shinyapps.io/nunatsiavutBirdTracker/" as ShinyApp
13+
14+
Dev -> Repo: Push code to main branch
15+
Repo -> Actions: Trigger CI/CD pipeline
16+
Actions -> Actions: Build Docker image
17+
Actions -> Actions: Inject secrets
18+
Actions -> Artifactory: Push Docker image
19+
20+
note over Artifactory, CloudRun
21+
Deploying the Docker image to Cloud Run
22+
is a **manual operation** triggered by the developer.
23+
end note
24+
25+
Artifactory -> CloudRun: Deploy Docker image (manual)
26+
CloudRun -> CloudScheduler: Configure scheduled tasks
27+
28+
note right of CloudScheduler
29+
Scheduling details:
30+
- sync-bird-metadata-scheduled: Every Monday at 9:00 AM
31+
- sync-data-gulls-scheduled: 1st of every month at 9:00 AM
32+
- sync-data-eiders-scheduled: 1st of every month at 9:00 AM
33+
end note
34+
35+
CloudScheduler -> CloudRun: Trigger Job: sync-bird-metadata-scheduled
36+
CloudRun -> MetadataBucket: Store metadata
37+
MetadataBucket -> ShinyApp: Expose metadata
38+
39+
CloudScheduler -> CloudRun: Trigger Job: sync-data-gulls-scheduled
40+
CloudRun -> LocationsBucket: Store locations
41+
LocationsBucket -> ShinyApp: Expose locations
42+
43+
CloudScheduler -> CloudRun: Trigger Job: sync-data-eiders-scheduled
44+
CloudRun -> LocationsBucket: Store locations
45+
LocationsBucket -> ShinyApp: Expose locations
46+
47+
@enduml

0 commit comments

Comments
 (0)