Skip to content

Open-source status page, incident response and uptime monitoring

🐳 trying depot build (#927)

Thibault Le Ouay013eb0953f86
diff --git a/.github/workflows/publish-checker.yml b/.github/workflows/publish-checker.yml
new file mode 100644
index 000000000..2510f0878
--- /dev/null
+++ b/.github/workflows/publish-checker.yml
@@ -0,0 +1,37 @@
+name: Publish Checker
+on:
+ push:
+ branches:
+ - main
+ paths:
+ - "apps/checker/**"
+env:
+ REGISTRY: ghcr.io
+ IMAGE_NAME: checker
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ # Permissions to use OIDC token authentication
+ permissions:
+ contents: read
+ id-token: write
+ # Allows pushing to the GitHub Container Registry
+ packages: write
+ steps:
+ - uses: actions/checkout@v3
+ - uses: depot/setup-action@v1
+ - name: Log in to the Container registry
+ uses: docker/login-action@v3
+ with:
+ registry: ${{ env.REGISTRY }}
+ username: ${{ github.repository_owner }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+ - name: Build and push
+ uses: depot/build-push-action@v1
+ with:
+ project: 9cknw183m8
+ context: apps/checker
+ tags: ghcr.io/openstatushq/checker:latest
+ push: true
+
diff --git a/apps/checker/README.md b/apps/checker/README.md
index 135f8a8f3..699665222 100644
--- a/apps/checker/README.md
+++ b/apps/checker/README.md
@@ -34,3 +34,5 @@ fly deploy
```bash
fly scale count 35 --region ams,arn,atl,bog,bom,bos,cdg,den,dfw,ewr,eze,fra,gdl,gig,gru,hkg,iad,jnb,lax,lhr,mad,mia,nrt,ord,otp,phx,qro,scl,sjc,sea,sin,syd,waw,yul,yyz
```
+
+## Build
diff --git a/apps/checker/cmd/main.go b/apps/checker/cmd/main.go
index a5750deb1..e7ccb9eba 100644
--- a/apps/checker/cmd/main.go
+++ b/apps/checker/cmd/main.go
@@ -54,10 +54,11 @@ func main() {
}()
// environment variables.
- flyRegion := env("FLY_REGION", "local")
+ flyRegion := env("FLY_REGION", env("REGION", "local"))
cronSecret := env("CRON_SECRET", "")
tinyBirdToken := env("TINYBIRD_TOKEN", "")
logLevel := env("LOG_LEVEL", "warn")
+ cloudProvider := env("CLOUD_PROVIDER", "fly")
logger.Configure(logLevel)
@@ -79,12 +80,14 @@ func main() {
return
}
- // if the request has been routed to a wrong region, we forward it to the correct one.
- region := c.GetHeader("fly-prefer-region")
- if region != "" && region != flyRegion {
- c.Header("fly-replay", fmt.Sprintf("region=%s", region))
- c.String(http.StatusAccepted, "Forwarding request to %s", region)
- return
+ if cloudProvider == "fly" {
+ // if the request has been routed to a wrong region, we forward it to the correct one.
+ region := c.GetHeader("fly-prefer-region")
+ if region != "" && region != flyRegion {
+ c.Header("fly-replay", fmt.Sprintf("region=%s", region))
+ c.String(http.StatusAccepted, "Forwarding request to %s", region)
+ return
+ }
}
var req request.CheckerRequest
@@ -275,10 +278,13 @@ func main() {
return
}
- if region != flyRegion {
- c.Header("fly-replay", fmt.Sprintf("region=%s", region))
- c.String(http.StatusAccepted, "Forwarding request to %s", region)
- return
+ if cloudProvider == "fly" {
+
+ if region != flyRegion {
+ c.Header("fly-replay", fmt.Sprintf("region=%s", region))
+ c.String(http.StatusAccepted, "Forwarding request to %s", region)
+ return
+ }
}
// We need a new client for each request to avoid connection reuse.
requestClient := &http.Client{