{"id":15288817,"url":"https://github.com/mattes/google_cloud_run","last_synced_at":"2025-10-08T17:10:54.708Z","repository":{"id":56874907,"uuid":"338247426","full_name":"mattes/google_cloud_run","owner":"mattes","description":"Rails on Google Cloud Run","archived":false,"fork":false,"pushed_at":"2021-04-07T06:17:46.000Z","size":49,"stargazers_count":10,"open_issues_count":2,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-07T19:10:04.990Z","etag":null,"topics":["activejob","google-cloud","google-cloud-run","logging","rails","ruby-on-rails"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mattes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["mattes"]}},"created_at":"2021-02-12T07:08:21.000Z","updated_at":"2023-09-08T18:18:28.000Z","dependencies_parsed_at":"2022-08-20T10:11:10.235Z","dependency_job_id":null,"html_url":"https://github.com/mattes/google_cloud_run","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/mattes/google_cloud_run","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattes%2Fgoogle_cloud_run","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattes%2Fgoogle_cloud_run/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattes%2Fgoogle_cloud_run/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattes%2Fgoogle_cloud_run/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mattes","download_url":"https://codeload.github.com/mattes/google_cloud_run/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattes%2Fgoogle_cloud_run/sbom","scorecard":{"id":626352,"data":{"date":"2025-08-11","repo":{"name":"github.com/mattes/google_cloud_run","commit":"2c67e17e5716ee0ebe3e7cae8c2237ea0fac5010"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.5,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/10 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/main.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/mattes/google_cloud_run/main.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/mattes/google_cloud_run/main.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"80 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-h47h-mwp9-c6q6","Warn: Project is vulnerable to: GHSA-2rqw-v265-jf8c","Warn: Project is vulnerable to: GHSA-4g8v-vg43-wpgf","Warn: Project is vulnerable to: GHSA-5hq2-xf89-9jxq","Warn: Project is vulnerable to: GHSA-7wjx-3g7j-8584","Warn: Project is vulnerable to: GHSA-8xww-x3g3-6jcv","Warn: Project is vulnerable to: GHSA-fwhr-88qx-h9g7","Warn: Project is vulnerable to: GHSA-g8ww-46x2-2p65","Warn: Project is vulnerable to: GHSA-hjg4-8q5f-x6fm","Warn: Project is vulnerable to: GHSA-mm33-5vfq-3mm3","Warn: Project is vulnerable to: GHSA-p84v-45xj-wwqj","Warn: Project is vulnerable to: GHSA-qphc-hf5q-v8fc","Warn: Project is vulnerable to: GHSA-vfg9-r3fq-jvx4","Warn: Project is vulnerable to: GHSA-vfm5-rmrh-j26v","Warn: Project is vulnerable to: GHSA-wh98-p28r-vrc9","Warn: Project is vulnerable to: GHSA-x76w-6vjr-8xgj","Warn: Project is vulnerable to: GHSA-wwhv-wxv9-rpgw","Warn: Project is vulnerable to: GHSA-ch3h-j2vf-95pv","Warn: Project is vulnerable to: GHSA-xp5h-f8jf-rc8q","Warn: Project is vulnerable to: GHSA-3hhc-qp5v-9p2j","Warn: Project is vulnerable to: GHSA-579w-22j4-4749","Warn: Project is vulnerable to: GHSA-76r7-hhxj-r776","Warn: Project is vulnerable to: GHSA-hq7p-j377-6v63","Warn: Project is vulnerable to: GHSA-8h22-8cf7-hq6g","Warn: Project is vulnerable to: GHSA-r4mg-4433-c7g3","Warn: Project is vulnerable to: GHSA-w749-p3v6-hccq","Warn: Project is vulnerable to: GHSA-cr5q-6q9f-rq6q","Warn: Project is vulnerable to: GHSA-j6gc-792m-qgm2","Warn: Project is vulnerable to: GHSA-pj73-v5mw-pm9j","Warn: Project is vulnerable to: GHSA-jxhc-q857-3j6g","Warn: Project is vulnerable to: GHSA-23c2-gwp5-pxw9","Warn: Project is vulnerable to: GHSA-735f-pc8j-v9w8","Warn: Project is vulnerable to: GHSA-h4h5-3hr4-j3g2","Warn: Project is vulnerable to: GHSA-wrvw-hg22-4m67","Warn: Project is vulnerable to: GHSA-496j-2rq6-j6cc","Warn: Project is vulnerable to: GHSA-228g-948r-83gx","Warn: Project is vulnerable to: GHSA-3x8r-x6xp-q4vm","Warn: Project is vulnerable to: GHSA-486f-hjj9-9vhh","Warn: Project is vulnerable to: GHSA-286v-pcf5-25rc","Warn: Project is vulnerable to: GHSA-2qc6-mcvw-92cw","Warn: Project is vulnerable to: GHSA-2rr5-8q37-2w7h","Warn: Project is vulnerable to: GHSA-353f-x4gh-cqq8","Warn: Project is vulnerable to: GHSA-59gp-qqm7-cw4j","Warn: Project is vulnerable to: GHSA-5w6v-399v-w3cc","Warn: Project is vulnerable to: GHSA-7rrm-v45f-jp64","Warn: Project is vulnerable to: GHSA-cgx6-hpwq-fhv5","Warn: Project is vulnerable to: GHSA-crjr-9rc5-ghw8","Warn: Project is vulnerable to: GHSA-fq42-c5rg-92c2","Warn: Project is vulnerable to: GHSA-gx8x-g87m-h5q6","Warn: Project is vulnerable to: GHSA-jc36-42cf-vqwj","Warn: Project is vulnerable to: GHSA-jw9f-hh49-cvp9","Warn: Project is vulnerable to: GHSA-mrxw-mxhj-p664","Warn: Project is vulnerable to: GHSA-pxvg-2qj5-37jq","Warn: Project is vulnerable to: GHSA-r95h-9x8f-r3f7","Warn: Project is vulnerable to: GHSA-v4f8-2847-rwm7","Warn: Project is vulnerable to: GHSA-v6gp-9mmm-c6p5","Warn: Project is vulnerable to: GHSA-vvfq-8hwr-qm4m","Warn: Project is vulnerable to: GHSA-xc9x-jj77-9p9j","Warn: Project is vulnerable to: GHSA-xh29-r2w5-wx8m","Warn: Project is vulnerable to: GHSA-xxx9-3xcr-gjj3","Warn: Project is vulnerable to: GHSA-22f2-v57c-j9cx","Warn: Project is vulnerable to: GHSA-3h57-hmj3-gj3p","Warn: Project is vulnerable to: GHSA-54rr-7fvw-6x8f","Warn: Project is vulnerable to: GHSA-65f5-mfpf-vfhj","Warn: Project is vulnerable to: GHSA-7g2v-jj9q-g3rg","Warn: Project is vulnerable to: GHSA-7wqh-767x-r66v","Warn: Project is vulnerable to: GHSA-8cgq-6mh2-7j6v","Warn: Project is vulnerable to: GHSA-93pm-5p5f-3ghx","Warn: Project is vulnerable to: GHSA-c6qg-cjj8-47qp","Warn: Project is vulnerable to: GHSA-gjh7-p2fx-99vx","Warn: Project is vulnerable to: GHSA-hxqx-xwvh-44m2","Warn: Project is vulnerable to: GHSA-rqv2-275x-2jq5","Warn: Project is vulnerable to: GHSA-vpfw-47h7-xj4g","Warn: Project is vulnerable to: GHSA-wq4h-7r42-5hrr","Warn: Project is vulnerable to: GHSA-xj5v-6v4g-jfw6","Warn: Project is vulnerable to: GHSA-5x79-w82f-gw8w","Warn: Project is vulnerable to: GHSA-9h9g-93gc-623h","Warn: Project is vulnerable to: GHSA-mcvf-2q2m-x72m","Warn: Project is vulnerable to: GHSA-pg8v-g4xq-hww9","Warn: Project is vulnerable to: GHSA-rrfc-7g8p-99q8"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T06:35:38.513Z","repository_id":56874907,"created_at":"2025-08-21T06:35:38.513Z","updated_at":"2025-08-21T06:35:38.513Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278981518,"owners_count":26079640,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["activejob","google-cloud","google-cloud-run","logging","rails","ruby-on-rails"],"created_at":"2024-09-30T15:53:18.395Z","updated_at":"2025-10-08T17:10:54.690Z","avatar_url":"https://github.com/mattes.png","language":"Ruby","readme":"# Rails on Google Cloud Run \n\n* Logging\n* Error Reporting\n* Active Job Adapter via [Cloud Tasks](https://cloud.google.com/tasks)\n* Minor patches for better compatibility\n* Works with Ruby 3 and Rails 6\n\n\n## Usage\n\n```ruby\nlogger.info \"Hello World\"\n\nlogger.info do\n  \"Expensive logging operation, only run when logged\"\nend\n\nlogger.info \"Labels work, too!\", my_label: \"works\", another_one: \"great\"\n```\n\nAll Google Cloud Logging Severities are supported:\n\n```\nlogger.default (or logger.unknown) - The log entry has no assigned severity level.\nlogger.debug                       - Debug or trace information. \nlogger.info                        - Routine information, such as ongoing status or performance.\nlogger.notice                      - Normal but significant events, such as start up, shut down, or a configuration change.\nlogger.warning (or logger.warn)    - Warning events might cause problems.\nlogger.error                       - Error events are likely to cause problems.\nlogger.critical (or logger.fatal)  - Critical events cause more severe problems or outages.\nlogger.alert                       - A person must take an action immediately.\nlogger.emergency                   - One or more systems are unusable.\n```\n\n\n## Installation\n\nAdd the gem to your Gemfile and run `bundle install`.\n\n```ruby\n# Gemfile\ngroup :production do\n  gem 'google_cloud_run'\nend\n```\n\n\nIn your production config:\n\n```ruby\n# config/environments/production.rb\n\nconfig.log_level = :g_notice\nconfig.logger = GoogleCloudRun::Logger.new\n\nconfig.active_job.queue_adapter = :google_cloudrun_tasks\nconfig.google_cloudrun.job_queue_default_region = \"us-central1\"\nconfig.google_cloudrun.job_callback_url = \"https://your-domain.com/rails/google_cloudrun/job_callback\"\n```\n\nSet the default queue:\n\n```ruby\n# app/jobs/application_job.rb\nqueue_as \"my-queue\"\n\n# or if `config.google_cloudrun.job_queue_default_region` isn't set:\nqueue_as \"us-central1/my-queue\"\n```\n\n```ruby\n# config/environments/production.rb\nconfig.action_mailer.deliver_later_queue_name = \"my-queue\" # or \"us-central1/my-queue\"\n```\n\n---\n\nIn the default production config, the logger is wrapped around \na `ENV[\"RAILS_LOG_TO_STDOUT\"].present?` block. I usually just \nremove this block so I don't have to actually set this ENV var.\n\nYou can also remove `config.log_formatter` and `config.log_tags` as we don't need it anymore.\n\nI recommend logging `:g_notice` and higher. Rails logs a lot of noise when logging\n`:info` and higher.\n\n\n## Configuration\n\nYou can change more settings in `config/environments/production.rb`. See below\nfor the default configuration.\n\n```ruby\n# Enable Google Cloud Logging\nconfig.google_cloudrun.logger = true\n\n# Set output (STDERR or STDOUT)\nconfig.google_cloudrun.out = STDERR\n\n# Add source location (file, line number, method) to each log \nconfig.google_cloudrun.logger_source_location = true\n\n# Run Proc to assign current user as label to each log\nconfig.google_cloudrun.logger_user = nil\n\n\n# Enable Error Reporting\nconfig.google_cloudrun.error_reporting = true\n\n# Assign a default severity level to exceptions\nconfig.google_cloudrun.error_reporting_exception_severity = :critical\n\n# Run Proc to assign current user to Error Report\nconfig.google_cloudrun.error_reporting_user = nil\n\n# Turn logs into error reports for this severity and higher.\n# Set to nil to disable.\nconfig.google_cloudrun.error_reporting_level = :error\n\n# When log is turned into error report, discard the original\n# log and only report the error.\n# Set to false to log and report the error at the same time.\nconfig.google_cloudrun.error_reporting_discard_log = true\n\n\n# Don't log or error report the following exceptions,\n# because Cloud Run will create access logs for us already.\nconfig.google_cloudrun.silence_exceptions = [\n      ActionController::RoutingError,\n      ActionController::MethodNotAllowed,\n      ActionController::UnknownHttpMethod,\n      ActionController::NotImplemented,\n      ActionController::UnknownFormat,\n      ActionController::BadRequest,\n      ActionController::ParameterMissing,\n]\n\n\n# Set Rails' request id to the trace id from X-Cloud-Trace-Context header\n# as set by Cloud Run.\nconfig.google_cloudrun.patch_request_id = true\n\n\n# Enable Jobs via Cloud Tasks\nconfig.google_cloudrun.jobs = true\n\n# Set the default Google Cloud Task region, i.e. us-central1\nconfig.google_cloudrun.job_queue_default_region = nil\n\n# Google Cloud Tasks will call this url to execute the job\nconfig.google_cloudrun.job_callback_url = nil # required, see above\n\n# The default route for the callback url.\nconfig.google_cloudrun.job_callback_path = \"/rails/google_cloudrun/job_callback\"\n\n# Time for a job to run in seconds, default is 30min.\n# Use `timeout_after 5.minutes` to configure a job individually.\nconfig.google_cloudrun.job_timeout_sec = 1800 # (min 15s, max 30m)\n```\n\n---\n\nBoth `error_reporting_user` and `logger_user` expect a Proc like this:\n\n```ruby\nconfig.google_cloudrun.logger_user = Proc.new do |request|\n  # extract and return user id from request, example:\n  request.try { cookie_jar.encrypted[:user_id] }\nend\n```\n\n---\n\nAn example job:\n\n```ruby\nclass MyJob \u003c ApplicationJob\n  queue_as \"us-central1/urgent\"\n  timeout_after 1.minute # min 15s, max 30m, overrides config.google_cloudrun.job_timeout_sec\n\n  def perform(*args)\n    # Do something\n  end\nend\n```\n\n## Cloud Task considerations\n\n* Cloud Tasks are a better fit than Google Pub/Sub.\n  [Read more](https://cloud.google.com/pubsub/docs/choosing-pubsub-or-cloud-tasks#detailed-feature-comparison)\n* I'd recommend to create two different Cloud Run services.\n  One for HTTP requests (aka Heroku Dynos) and another service\n  for jobs (aka Heroku Workers). Set the `Request Timeout` for \n  the request-bound service to something like `15s`, and for workers\n  to `1800s` or match `config.google_cloudrun.job_timeout_sec`.\n* Cloud Task execution calls are authenticated with a Google-issued\n  OIDC token. So even though `/rails/google_cloudrun/job_callback` is publicly\n  available, without a valid token, no job will be executed.\n* Cloud Task job processing is async. It supports multiple queues. Delayed jobs\n  are natively supported through Cloud Task. Priority jobs are not supported, use\n  different queues for that, i.e. \"urgent\", or \"low-priority\". Timeouts can be set\n  globally or per job-basis (min 15s, max 30m). \n  Retries are natively supported by Cloud Tasks.\n\n","funding_links":["https://github.com/sponsors/mattes"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattes%2Fgoogle_cloud_run","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattes%2Fgoogle_cloud_run","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattes%2Fgoogle_cloud_run/lists"}