Openstatus www.openstatus.dev

๐Ÿณ trying depot build (#927)

* ๐Ÿณ trying depot build

* ๐Ÿณ trying depot build

* ๐Ÿณ trying depot build

* ๐Ÿณ trying depot build

* ๐Ÿณ trying depot build

* ๐Ÿณ trying depot build

* ๐Ÿณ trying depot build

* ๐Ÿณ trying depot build

* ๐Ÿณ trying depot build

authored by

Thibault Le Ouay and committed by
GitHub
013eb095 f84a315a

+56 -11
+37
.github/workflows/publish-checker.yml
··· 1 + name: Publish Checker 2 + on: 3 + push: 4 + branches: 5 + - main 6 + paths: 7 + - "apps/checker/**" 8 + env: 9 + REGISTRY: ghcr.io 10 + IMAGE_NAME: checker 11 + 12 + jobs: 13 + build: 14 + runs-on: ubuntu-latest 15 + # Permissions to use OIDC token authentication 16 + permissions: 17 + contents: read 18 + id-token: write 19 + # Allows pushing to the GitHub Container Registry 20 + packages: write 21 + steps: 22 + - uses: actions/checkout@v3 23 + - uses: depot/setup-action@v1 24 + - name: Log in to the Container registry 25 + uses: docker/login-action@v3 26 + with: 27 + registry: ${{ env.REGISTRY }} 28 + username: ${{ github.repository_owner }} 29 + password: ${{ secrets.GITHUB_TOKEN }} 30 + - name: Build and push 31 + uses: depot/build-push-action@v1 32 + with: 33 + project: 9cknw183m8 34 + context: apps/checker 35 + tags: ghcr.io/openstatushq/checker:latest 36 + push: true 37 +
+2
apps/checker/README.md
··· 34 34 ```bash 35 35 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 36 36 ``` 37 + 38 + ## Build
+17 -11
apps/checker/cmd/main.go
··· 54 54 }() 55 55 56 56 // environment variables. 57 - flyRegion := env("FLY_REGION", "local") 57 + flyRegion := env("FLY_REGION", env("REGION", "local")) 58 58 cronSecret := env("CRON_SECRET", "") 59 59 tinyBirdToken := env("TINYBIRD_TOKEN", "") 60 60 logLevel := env("LOG_LEVEL", "warn") 61 + cloudProvider := env("CLOUD_PROVIDER", "fly") 61 62 62 63 logger.Configure(logLevel) 63 64 ··· 79 80 return 80 81 } 81 82 82 - // if the request has been routed to a wrong region, we forward it to the correct one. 83 - region := c.GetHeader("fly-prefer-region") 84 - if region != "" && region != flyRegion { 85 - c.Header("fly-replay", fmt.Sprintf("region=%s", region)) 86 - c.String(http.StatusAccepted, "Forwarding request to %s", region) 87 - return 83 + if cloudProvider == "fly" { 84 + // if the request has been routed to a wrong region, we forward it to the correct one. 85 + region := c.GetHeader("fly-prefer-region") 86 + if region != "" && region != flyRegion { 87 + c.Header("fly-replay", fmt.Sprintf("region=%s", region)) 88 + c.String(http.StatusAccepted, "Forwarding request to %s", region) 89 + return 90 + } 88 91 } 89 92 90 93 var req request.CheckerRequest ··· 275 278 return 276 279 } 277 280 278 - if region != flyRegion { 279 - c.Header("fly-replay", fmt.Sprintf("region=%s", region)) 280 - c.String(http.StatusAccepted, "Forwarding request to %s", region) 281 - return 281 + if cloudProvider == "fly" { 282 + 283 + if region != flyRegion { 284 + c.Header("fly-replay", fmt.Sprintf("region=%s", region)) 285 + c.String(http.StatusAccepted, "Forwarding request to %s", region) 286 + return 287 + } 282 288 } 283 289 // We need a new client for each request to avoid connection reuse. 284 290 requestClient := &http.Client{