Skip to content
open-climate-techPublic

About

UI for checking potential wildfires

Resources

Stars

2 stars

Watchers

2 watching

Forks

Latest commit

 

History

374 Commits

Folders and files

Repository files navigation

checkfire

UI for checking potential wildfires generated by detection code in firecam repo.

Deployment

checkfire runs on Cloud Run as a single always-warm instance. The container is built from the Dockerfile, which builds the app inside the image — you do not need to run npm run build yourself before deploying.

Prerequisites

  • gcloud CLI authenticated against the target project (gcloud auth login)
  • Docker
  • Access to the project's container registry (gcr.io/<project-id>)

One-time setup

export PROJECT=oct-p1     # change if deploying to another project
export REGION=us-west1
gcloud auth configure-docker gcr.io

Deploy

Always deploy a tagged image (the git SHA). Deploying an untagged/latest image with the same tag as the running revision is a no-op — no new revision gets created.

export IMAGE=gcr.io/$PROJECT/checkfire:$(git rev-parse --short HEAD)

docker build -t $IMAGE .
docker push $IMAGE

sed "s|IMAGE_URL|$IMAGE|g" cloudrun.yaml | \
  gcloud run services replace - --region=$REGION

cloudrun.yaml is the source of truth for the service configuration: 1 warm instance (required for the long-lived SSE stream and the Pub/Sub pull subscription), gen2 execution environment, Cloud SQL Auth Proxy, CPU always allocated, 3000 s request timeout, and the OCT_FIRE_SETTINGS env var.

If you prefer not to use the YAML, gcloud run deploy is equivalent — the full one-liner is in the header comment of cloudrun.yaml.

Deploying to a different project

cloudrun.yaml hardcodes several oct-p1-specific values that sed does not substitute. Update these by hand:

  • run.googleapis.com/cloudsql-instances — Cloud SQL instance connection name
  • serviceAccountName — runtime service account
  • OCT_FIRE_SETTINGS — path to the config JSON in that project's bucket

Verify

gcloud run services describe checkfire --region=$REGION --format='value(status.url)'
curl -sS -o /dev/null -w '%{http_code}\n' "$(gcloud run services describe checkfire --region=$REGION --format='value(status.url)')/"

The root path (/) returns 200 and is also used as the liveness and startup probe.

Local development

Requires Node 24 (see .nvmrc).

npm install
npm run dev     # ts-node + Next.js dev server on :3141

npm run build compiles the server to dist/ and builds .next/. You need it for npm start (which runs node dist/server-main.js) and for npm test, but not for a Cloud Run deploy — the Dockerfile runs it in the builder stage.

Licenses

The code in this repository is released under Apache License 2.0.

About

UI for checking potential wildfires

Resources

Stars

2 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages