{"id":19727039,"url":"https://github.com/timtech4u/cloudrun_warmer","last_synced_at":"2026-03-14T22:04:33.948Z","repository":{"id":91625675,"uuid":"222328116","full_name":"Timtech4u/cloudrun_warmer","owner":"Timtech4u","description":"A warmer service that periodically makes requests to Cloud Run services.","archived":false,"fork":false,"pushed_at":"2019-11-21T06:42:47.000Z","size":23,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T20:34:54.454Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/Timtech4u.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":"2019-11-17T23:42:44.000Z","updated_at":"2022-08-07T04:17:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"0cfe22a9-c917-4a55-8ddd-cea8b7b963dd","html_url":"https://github.com/Timtech4u/cloudrun_warmer","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/Timtech4u%2Fcloudrun_warmer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Timtech4u%2Fcloudrun_warmer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Timtech4u%2Fcloudrun_warmer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Timtech4u%2Fcloudrun_warmer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Timtech4u","download_url":"https://codeload.github.com/Timtech4u/cloudrun_warmer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251607894,"owners_count":21616847,"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":[],"created_at":"2024-11-11T23:37:26.546Z","updated_at":"2026-03-14T22:04:28.929Z","avatar_url":"https://github.com/Timtech4u.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cloud Run Warmer\n\u003e A warmer service that periodically makes requests to Cloud Run services.\n\nCloud Run services often requires downloading the container image and starting the container before it is accessible. This is called a **cold start** and it occurs due to Cloud Run's scale to zero ability.\n\nThis tool prevents cold start by making scheduled requests that warms up Cloud Run services.\nYou can read more about how to minimize Cloud Run Cold Starts John's article [here](https://www.jhanley.com/google-cloud-run-minimizing-cold-starts/)\n\n*Note that this tool best fits when you have multiple Cloud Run services on a project and you do not want to setup individual Cloud Scheduler Jobs to warm each service.*\n\n## How to use\n- Set up a [Google Cloud account and project](https://cloud.google.com/gcp/getting-started/) and start [Cloud Shell](https://cloud.google.com/shell/).\n\n- Clone the source codes in the Cloud Shell Terminal: `git clone https://github.com/Timtech4u/cloudrun_warmer`\n\n- [Generate Service Account JSON Key](https://cloud.google.com/iam/docs/creating-managing-service-account-keys) and update [code](auth/auth.py#L72) OR *get values for enviroment variables labels*: \n\n    `gcloud auth application-default print-access-token`\n\n  - `ACCESS_TOKEN` [here](main.py#L7) (Required)\n    \n\n  - `PROJECT_ID` [here](main.py#L10) (Required)\n\n  - `REGION` (Optional/Default: \"us-central1\") [here](main.py#L13) \n\n  - `DISALLOWED_IMAGES` (Optional) [here](main.py#L17)\n\n  -  `DISALLOWED_SERVICES` (Optional) [here](main.py#L20) env vars.\n\n\n- Deploy this repo to Cloud Functions\n\n    `gcloud functions deploy cloudrun_warmer --set-env-vars PROJECT_ID=foo, ACCESS_TOKEN=bar,  --runtime python37 --trigger-http`\n\n- Set up Cloud Scheduler Job with Function's URL\n    ``` \n    gcloud scheduler jobs create http cloudrun_warmer_job --schedule \"0 * * * *\" --uri \"https://us-central1-myproject.cloudfunctions.net/cloudrun_warmer\" --http-method GET\n    ```\n\n\n## How it works\n\n- Attempts to retrieve access token, project ID, services to skip.\n\n- Fetches the list of all Cloud Run services based on configured project and region.\n\n- Makes peroidic requests to each service (while skipping disallowed services) with 5secs timeout.\n\n\n## Tools Used\n- [Cloud Function](https://cloud.google.com/functions)\n\n- [Cloud Scheduler](https://cloud.google.com/scheduler)\n\n- [Cloud Run API](https://cloud.google.com/run/docs/reference/rest/)\n\n- [Python Requests](https://github.com/psf/requests)\n\n- [GCP Access Token Auth](https://gist.github.com/Timtech4u/f38d53671ccbaf802820b2e1f0e3f6c8)\n\n\n\u003e If you want to complete this steps using a GUI or Cloud Console, check out my article on [Scheduling periodic jobs with Cloud Scheduler ⏰](https://fullstackgcp.com/scheduling-periodic-jobs-with-cloud-scheduler-alarm-clock-ck35lo6g3002eb6s13btat0n3)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimtech4u%2Fcloudrun_warmer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimtech4u%2Fcloudrun_warmer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimtech4u%2Fcloudrun_warmer/lists"}