@mayurajs/deploy-cloudrun
v1.2.0
Published
Google Cloud Run as a mayura deploy target: a migration job, then the server and an always-on worker as services.
Readme
@mayurajs/deploy-cloudrun
Google Cloud Run as a mayura deploy target. A migration job runs to completion,
then the server and an always-on worker deploy as services, all from one image, with gcloud.
npm install --save-dev @mayurajs/deploy-cloudrun
mayura deploy init --target cloudrun --apply
# In mayura.deploy.json: "image" is an Artifact Registry repository and targets.cloudrun.project is the project id.
mayura deploy --target cloudrun # prints the plan and its digest
mayura deploy --target cloudrun --apply --confirm <digest>A release runs these steps, stopping at the first failure:
gcloud projects describe, so a missing login or project stops it.- The image is built with Cloud Build, or with your Docker and pushed (
build: "local"). - The
<name>-migratejob is updated to the release's image, then run and waited for (--execute-now --wait, no retries). A failed migration stops the release. <name>-serverdeploys with CPU always allocated and at least one instance, since agent runs continue after a response. It gets a/readyzstartup probe and a one-hour request timeout for streams.<name>-workerdeploys as an internal, non-public service that serves only its probes, also always running.
Notes:
- Secrets come from Secret Manager with
--set-secrets. By default,DATABASE_URLand every name inenvread a secret of the same name atlatest; map others withsecrets, such as{ "OPENAI_API_KEY": "openai-key:3" }. Values never appear in a plan. - Settings in
mayura.deploy.jsonundertargets.cloudrun:project, andregion(us-central1);build(cloud-buildorlocal) andsecrets;cloudSqlInstance(project:region:instance, for the Cloud SQL connector) andserviceAccount;public(true: the server authenticates requests itself);serverMinInstancesandworkerInstances(1 each).
- Credentials: gcloud uses its own login (
gcloud auth login, or a service account in CI); Mayura reads neither. On Windows gcloud is a.cmdscript, whichmayura deployruns through cmd.exe with checked, quoted arguments.
See Deploy with mayura deploy. Apache-2.0.
