Skip to content
Hunter edited this page Sep 16, 2022 · 2 revisions

documents

  • Setup

    • Enable the Cloud Run Admin API
    • 设置默认地区 gcloud config set run/region asia-east1
  • 快速入門

    • 使用 source code deploy: gcloud run deploy 相當於 ==>

      gcloud builds submit --tag [IMAGE] /home/wmh/workspaces/kryptogo/kg-wallet-backend/go gcloud run deploy helloworld --image [IMAGE]

分兩種可以這樣做

gcloud run deploy api     --allow-unauthenticated    --set-env-vars=ENV=dev,VER=0.1.0,MODE=API
gcloud run deploy cronjob --no-allow-unauthenticated --set-env-vars=ENV=dev,VER=0.1.0,MODE=CRONJOB  --timeout=60m
gcloud builds submit --tag [IMAGE] /home/wmh/workspaces/kryptogo/kg-wallet-backend/go
gcloud run deploy helloworld --image [IMAGE]

搭配本地 firestore

export FIRESTORE_EMULATOR_HOST="localhost:8080"

switch projects

gcloud projects list
gcloud config set project [project-id]

gcloud run deploy

gcloud run deploy
    [[SERVICE] --namespace=NAMESPACE]
    [--args=[ARG,…]]
    [--async]
    [--command=[COMMAND,…]]
    [--concurrency=CONCURRENCY]
    [--cpu=CPU]
    [--ingress=INGRESS; default="all"]
    [--max-instances=MAX_INSTANCES]
    [--memory=MEMORY]
    [--min-instances=MIN_INSTANCES]
    [--platform=PLATFORM; default="managed"]
    [--port=PORT]
    [--service-account=SERVICE_ACCOUNT]
    [--tag=TAG]
    [--timeout=TIMEOUT]
    [--no-traffic]
    [--[no-]use-http2]
    [--clear-env-vars
        | --set-env-vars=[KEY=VALUE,…]
        | --remove-env-vars=[KEY,…] --update-env-vars=[KEY=VALUE,…]]
    [--clear-labels
        | --remove-labels=[KEY,…] --labels=[KEY=VALUE,…]
        | --update-labels=[KEY=VALUE,…]]
    [--clear-secrets
        | --set-secrets=[KEY=VALUE,…]
        | --remove-secrets=[KEY,…] --update-secrets=[KEY=VALUE,…]]
    [--connectivity=CONNECTIVITY --clear-config-maps
        | --set-config-maps=[KEY=VALUE,…]
        | --remove-config-maps=[KEY,…] --update-config-maps=[KEY=VALUE,…]]
    [--image=IMAGE
        | --source=SOURCE]
    [--[no-]allow-unauthenticated --breakglass=JUSTIFICATION --clear-vpc-connector --[no-]cpu-throttling
            --revision-suffix=REVISION_SUFFIX --vpc-connector=VPC_CONNECTOR --vpc-egress=VPC_EGRESS
            --add-cloudsql-instances=[CLOUDSQL-INSTANCES,…]
        | --clear-cloudsql-instances
        | --remove-cloudsql-instances=[CLOUDSQL-INSTANCES,…]
        | --set-cloudsql-instances=[CLOUDSQL-INSTANCES,…] --binary-authorization=POLICY
        | --clear-binary-authorization --clear-key
        | --key=KEY --clear-post-key-revocation-action-type
        | --post-key-revocation-action-type=POST_KEY_REVOCATION_ACTION_TYPE]
    [--region=REGION
        | --cluster=CLUSTER --cluster-location=CLUSTER_LOCATION
        | --context=CONTEXT --kubeconfig=KUBECONFIG]
    [GCLOUD_WIDE_FLAG …]

env

CNB_GROUP_ID=1000
CNB_STACK_ID=google
CNB_USER_ID=1000
DEBIAN_FRONTEND=noninteractive
HOME=/home/cnb
K_CONFIGURATION=api
K_REVISION=api-00023-div
K_SERVICE=api
PATH=/layers/google.go.build/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PORT=8080
PWD=/workspace
Clone this wiki locally