{"id":19317811,"url":"https://github.com/queeniecplusplus/cloudrun","last_synced_at":"2025-11-15T05:27:09.843Z","repository":{"id":104588158,"uuid":"310739698","full_name":"QueenieCplusplus/CloudRun","owner":"QueenieCplusplus","description":"An Easy way to deploy app (alternative of GKE)","archived":false,"fork":false,"pushed_at":"2020-11-08T06:56:29.000Z","size":589,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-06T04:26:07.527Z","etag":null,"topics":["cloudrun","docker-image","serverless","serverless-architectures","serverless-examples"],"latest_commit_sha":null,"homepage":"https://github.com/QueenieCplusplus/QuickGoThru/blob/master/README.md#serverless-devops","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/QueenieCplusplus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-07T01:03:53.000Z","updated_at":"2020-11-08T06:56:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"07a2b0d9-538e-418a-812d-1fabe1ed4079","html_url":"https://github.com/QueenieCplusplus/CloudRun","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QueenieCplusplus%2FCloudRun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QueenieCplusplus%2FCloudRun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QueenieCplusplus%2FCloudRun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QueenieCplusplus%2FCloudRun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QueenieCplusplus","download_url":"https://codeload.github.com/QueenieCplusplus/CloudRun/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240420940,"owners_count":19798501,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloudrun","docker-image","serverless","serverless-architectures","serverless-examples"],"created_at":"2024-11-10T01:16:19.486Z","updated_at":"2025-11-15T05:27:04.789Z","avatar_url":"https://github.com/QueenieCplusplus.png","language":null,"readme":"# CloudRun\nAn Easy way to deploy app (alternative of GKE)\n\nCloud Run brings \"serverless\" development to containers and can be run either on your own Google Kubernetes Engine (GKE) clusters or on a fully managed PaaS solution provided by Cloud Run. You will be running the latter scenario in this lab.\n\nGAE see https://github.com/QueenieCplusplus/GAE\n\n![architecture](https://cdn.qwiklabs.com/Ry1hidHMw9wjyWNTvENYln0NxFFyBJQyt1bPC%2Fdp0Qc%3D)\n\n# Core Steps\n\n(1) create a Docker Image for App\n\n(2) move the Image to Cloud Storage Bucket for Cloud Build.\n\n(3) deploy/pull the container image to CloudRun\n\n(4) update Website -\u003e rebuild -\u003e push again with new tag, and roll out new version of Website without Downtime (CI/CD)\n\n(5) GKE\n\n# Core Cmd Line\n\n     gcloud auth configure-docker\n\n     gcloud services enable []\n     \n     gcloud builds submit --image=[] --plateform managed\n     \n     gcloud run deploy --image=[] --plateform managed\n     \n     ctrl+c\n\n-----------\n\n# Nodejs Web Server\n\nfrom Step 0\n\n* prework-1, clone a existing website code from Github\n\n       git clone https://github.com/googlecodelabs/monolith-to-microservices.git\n       \n       cd monolith-to-microservices\n       \n       cd ./setup.sh\n       \n* prework-2, test app by starting the web server\n\n      cd ~/monolith-to-microservices/monolith\n      npm start\n      \n      [output]\n      \n      Monolith listening on port 8080!\n      \n      [output in UI]\n      \n     ![](https://raw.githubusercontent.com/QueenieCplusplus/CloudRun/main/web%20preview.png)\n     \n* prework-3, stop the Web server\n\n       pressing CTRL+C in Cloud Shell.\n       \n# Docker \n\n\u003e Dockerize App use Docker cmd line\n\n* 1.1, in cloud shell, log in Docker\n\n       sudo usermod -a -G docker ${USER}\n       \n       //If you're using a Linux-based operating system, such as Ubuntu or Debian, add your username to the docker group so that you can run Docker without using sudo.\n       \n       // Caution: The docker group is equivalent to the root user. See Docker's documentation for details on how this affects the security of your system.\n       \n       // Log out and log back in for group membership changes to take effect. If you are using a virtual machine, you may need to restart the virtual machine for membership changes to take effect.\n \n* 1.2, test Docker run within output of Date\n\n       docker run busybox date\n       \n* 1.3, log in the repo\n\n       gcloud auth configure-docker\n       \n* 1.4, pull the docker image to repo\n\n      docker pull gcr.io/google-samples/hello-app:1.0\n      \n* 1.5, tag the docker image and push it to repo\n\n      docker tag gcr.io/google-samples/hello-app:1.0 gcr.io/PROJECT_ID/[tag name]\n\n      docker tag gcr.io/google-samples/hello-app:1.0 gcr.io/PROJECT_ID/quickstart-image:tag1\n      \n      docker push gcr.io/PROJECT_ID/quickstart-image:tag1\n      \n* 1.6, on contrast, we pull back the app from remote to local.\n\n      docker pull gcr.io/PROJECT_ID/quickstart-image:tag1\n      \n* 1.7, delete docker image in repo\n\n     gcloud container images delete gcr.io/PROJECT_ID/quickstart-image:tag1 --force-delete-tags\n     \n     // in project id includes : colons symbol, then check out the doc https://cloud.google.com/container-registry/docs/overview#domain-scoped_projects\n     \n* 1.8, sum up doc\n\n    https://cloud.google.com/container-registry/docs/quickstart\n       \n# Cloud Build\n\nfrom step 3\n\n\u003e Dockerize App use Cloud Build\n\n* 2.1, in cloud shell, compress and move docker file to Cloud Sorage Bucket. \n\n* 2.2, enable google cloud api called cloudbuild\n\n      gcloud services enable cloudbuild.googleapis.com\n\n* 2.3, use Cloud Build to create container, and push it to container registry.\n\n      gcloud builds submit --tag gcr.io/${GOOGLE_CLOUD_PROJECT}/monolith:1.0.0 .\n        \n      [output]\n      -----------------------------------------------------------------------------------------------------    ------------------------------------------------------------------------------------------------------\n       ID                                    CREATE_TIME                DURATION  SOURCE                                                                                  IMAGES                              STATUS\n       1ae295d9-63cb-482c-959b-bc52e9644d53  2019-08-29T01:56:35+00:00  33S       gs://\u003cPROJECT_ID\u003e_cloudbuild/source/1567043793.94-abfd382011724422bf49af1558b894aa.tgz  gcr.io/\u003cPROJECT_ID\u003e/monolith:1.0.0  SUCCESS\n       \n* 2.4, in cloud concole, navigation bar \u003e Cloud Build \u003e history\n    \n    ![](https://raw.githubusercontent.com/QueenieCplusplus/CloudRun/main/cloud%20built%20history.png)\n\n\n# Cloud Run\n\nfrom step 3\n\n\u003e Deploy a Container\n\n* 3.1, enalbe cloud run service\n\n      gcloud services enable run.googleapis.com\n\n* 3.2, deploy it to Cloud Run PaaS\n\n       gcloud run deploy --image=gcr.io/${GOOGLE_CLOUD_PROJECT}/monolith:1.0.0 --platform managed\n\n* 3.3, mgmt the Deployment\n\n       // 1. choose the managed version of Cloud Run by specifying --platform managed.\n       \n       // 2. specify which region you'd like to run in. Type the number for the region closest to you.\n       \n       // 3. accept the default suggested service name (it will be \"monolith\") by pressing Enter.\n       \n* 3.4, check the deployment \n\n       gcloud run services list\n       \n       Type \"1\" to choose the first option: [1] Cloud Run (fully managed)\n       \n       [the pod is running now]\n       \n        SERVICE    REGION    URL       LAST DEPLOYED BY          LAST DEPLOYED AT\n      ✔  monolith  us-east1 \u003cyour url\u003e  \u003cyour email\u003e             [time]\n\n* 3.5, setup Endpoint for App in Cloud Run\n        \n        gcloud run deploy --image=gcr.io/${GOOGLE_CLOUD_PROJECT}/monolith:1.0.0 --platform managed --concurrency 1\n        \n        // change the concurrency val as 1\n        \n* 3.6, in cloud console, check the result by navigating to Cloud Run \u003e [Service Name] \u003e revsion tab.\n\n    ![](https://raw.githubusercontent.com/QueenieCplusplus/CloudRun/main/cloud%20run%20revsion.png)\n        \n* tips \u0026 attentions:\n\nBy default, a Cloud Run application will have a concurrency value of 80, meaning that each container instance will serve up to 80 requests at a time. This is a big departure from the Functions-as-a-Service model, where one instance handles one request at a time.\n\n# CI/CD, Revision\n\nfrom step 4\n\n\u003e Modify code of website, and deploy it again \n\nprework, \n\n      cd ~/monolith-to-microservices/react-app/src/pages/Home\n      \n      mv index.js.new index.js\n      \n      cat ~/monolith-to-microservices/react-app/src/pages/Home/index.js\n      \n      cd ~/monolith-to-microservices/react-app\n      \n      npm run build:monolith \n      // copy it to monolith dir\n      \n* 4.1 rebuild the Docker container and publish it to Container Registry. You can use the same command as before, except this time you will update the version label.\n\n       cd ~/monolith-to-microservices/monolith\n       \n       npm start // feel free to do this execution\n       \n       gcloud builds submit --tag gcr.io/${GOOGLE_CLOUD_PROJECT}/monolith:2.0.0 .\n       // with new version name this time\n\n* 4.2, deploy the new version of service.\n\n       gcloud run deploy --image=gcr.io/${GOOGLE_CLOUD_PROJECT}/monolith:2.0.0 --platform managed\n\n# GKE\n\nfrom step 5\n\nsince the docker image is saved in the private registry, GKE can pull from it to do GKE-style deployment.\n\nsee https://github.com/QueenieCplusplus/GKE\n\n# Ref Code\n\n66(container), 10445, 14743(go)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqueeniecplusplus%2Fcloudrun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqueeniecplusplus%2Fcloudrun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqueeniecplusplus%2Fcloudrun/lists"}