{"id":20338389,"url":"https://github.com/alerta/gcloud-api-alerta","last_synced_at":"2025-09-07T06:35:11.512Z","repository":{"id":145808212,"uuid":"104522821","full_name":"alerta/gcloud-api-alerta","owner":"alerta","description":"Deploy Alerta API to Google Cloud","archived":false,"fork":false,"pushed_at":"2020-04-12T17:41:56.000Z","size":5,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-07T06:33:49.110Z","etag":null,"topics":["alerta","cloud-sql","engine","gcloud","google-cloud"],"latest_commit_sha":null,"homepage":null,"language":null,"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/alerta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2017-09-22T22:09:45.000Z","updated_at":"2024-11-07T15:51:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"02e560b6-9f99-4d7a-bb88-04b6003ef38b","html_url":"https://github.com/alerta/gcloud-api-alerta","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alerta/gcloud-api-alerta","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alerta%2Fgcloud-api-alerta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alerta%2Fgcloud-api-alerta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alerta%2Fgcloud-api-alerta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alerta%2Fgcloud-api-alerta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alerta","download_url":"https://codeload.github.com/alerta/gcloud-api-alerta/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alerta%2Fgcloud-api-alerta/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274005336,"owners_count":25205934,"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-09-07T02:00:09.463Z","response_time":67,"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":["alerta","cloud-sql","engine","gcloud","google-cloud"],"created_at":"2024-11-14T21:12:58.884Z","updated_at":"2025-09-07T06:35:11.491Z","avatar_url":"https://github.com/alerta.png","language":null,"readme":"Alerta API on Google Cloud\n==========================\n\n[Alerta](https://alerta.io) is a monitoring tool used for alert\nconsolidation, de-duplication and correlation.\n\nTo deploy Alerta API to [Google Cloud](https://cloud.google.com) use the\n[Google App Engine Flexible Environment](https://cloud.google.com/appengine/docs/flexible/)\nwith [Cloud SQL for PostgreSQL](https://cloud.google.com/appengine/docs/flexible/python/using-cloud-sql-postgres)\nfor a fully managed service.\n\n**Note: The following steps will incur costs. See https://cloud.google.com/sql/pricing#pg-pricing**\n\nInstallation\n------------\n\nRun the Alerta API in Google Cloud by cloning this repo, creating a\nCloud SQL instance and deploying the application to Google App Engine.\n\nTo create an PostgreSQL instance either use the Google Cloud Console\nor install the `gcloud` SDK and run:\n    $ gcloud config set project [PROJECT_NUMBER]\n\n    $ gcloud sql instances create [INSTANCE_NAME] \\\n    --database-version=POSTGRES_11 --storage-type=SSD --tier=db-f1-micro --region \"us-central\"\n\n    $ gcloud sql users set-password postgres \\\n    --instance [INSTANCE_NAME] --password [PASSWORD]\n\nNote: Change the `--storage-type`,  `--tier` and --region as appropriate.\n\nLog in to `psql` to create a database using [GCloud Shell](https://cloud.google.com/shell/docs/)\nor `gcloud` (you will be prompted for the password set above):\n\n    $ gcloud sql connect [INSTANCE_NAME] --user postgres\n\n    Password for user postgres:\n    *******\n    psql (9.6.2, server 9.6.1)\n    SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES128-GCM-SHA256, bits: 128, compression: off)\n    Type \"help\" for help.\n\n    postgres=\u003e CREATE DATABASE monitoring;\n    CREATE DATABASE\n\nConfiguration\n-------------\n\nCopy the `app.yaml.example` file to `app.yaml` and set the `DATABASE_URL`\nand `beta_settings` for the PostgreSQL instance using the *INSTANCE_CONNECTION_NAME*\ngenerated above:\n\n```\nenv_variables:\n  DATABASE_URL: postgres://USER:PASSWORD@/DATABASE?host=/cloudsql/INSTANCE_CONNECTION_NAME\n  CORS_ORIGINS: [\n    'http://localhost',\n    'http://localhost:8000'\n    ]\n\nbeta_settings:\n    cloud_sql_instances: INSTANCE_CONNECTION_NAME\n```\n\n**Example**\n\n```\nenv_variables:\n  DATABASE_URL: postgres://postgres:p0stgr3s@/monitoring?host=/cloudsql/alerta5:europe-west2:monitoring\n  CORS_ORIGINS: [\n    'http://localhost',\n    'http://localhost:8000',\n    'https://myaltertagui.com'\n    ]\n\nbeta_settings:\n    cloud_sql_instances: alerta5:europe-west2:monitoring\n```\n\nDeploy\n------\n\nTo deploy the Alerta API and lauch a browser to view the API index page run:\n\n    $ gcloud app deploy\n    $ gcloud app browse\n\nNote: Add `--verbosity=info` to any `gcloud` command to get more verbose logging.\n\nAdd the service account of your flex app to the Cloud SQL Client role\nhttps://cloud.google.com/sql/docs/mysql/connect-app-engine\n\nHousekeeping\n------------\n\nAn [App Engine Cron schedule](https://cloud.google.com/appengine/docs/flexible/python/scheduling-jobs-with-cron-yaml)\ncan be configured to run a housekeeping job every minute which expires alerts\nwhich have timed-out and deletes expired and closed alerts.\n\nTo enable the cron job run:\n\n    $ gcloud app deploy cron.yaml\n\nScaling Down\n------------\n\nTo scale down the app deploy using `--version dev` then it can be stopped\nand started easily:\n\n    $ gcloud app deploy --version dev\n    $ gcloud app versions stop dev\n    $ gcloud app versions start dev\n\nTesting\n-------\n\nCreate a [Service Account]() for remote access and download the Cloud SQL Proxy.\n\n    $ cloud_sql_proxy ...\n    \nTBC\n\n\nTroubleshooting\n---------------\n\nAll `gcloud` commands take `--verbosity` which can be used to output more verbose\nlogging like so:\n\n    $ gcloud app deploy --verbosity=info\n\nTo tail the application logs run:\n\n    $ gcloud app logs tail -s default\n\n```\n2017-09-23 10:57:59 default[20170923t115438]  2017/09/23 10:57:59 Ready for new connections\n2017-09-23 10:57:59 default[20170923t115438]  2017/09/23 10:57:59 errors parsing config:\n2017-09-23 10:57:59 default[20170923t115438]  \tgoogleapi: Error 403: Access Not Configured.\nCloud SQL Administration API has not been used in project 465218335446 before or it is disabled.\nEnable it by visiting https://console.developers.google.com/apis/api/sqladmin.googleapis.com/overview?project=465218335446\nthen retry. If you enabled this API recently, wait a few minutes for the action to propagate\nto our systems and retry., accessNotConfigured\n```\n\nTo connect to the database instance using `psql` run:\n\n    $ gcloud sql connect [INSTANCE_NAME] --user postgres\n\nReferences\n----------\n\n  * App Engine Flexible Environment: https://cloud.google.com/appengine/docs/flexible/\n  * Quickstart for Python in the App Engine Flexible Environment: https://cloud.google.com/appengine/docs/flexible/python/quickstart\n  * Using Cloud SQL with Python: https://cloud.google.com/python/getting-started/using-cloud-sql\n  * Using Cloud SQL for PostgreSQL: https://cloud.google.com/appengine/docs/flexible/python/using-cloud-sql-postgres\n  * Connect to Cloud SQL from App Engine https://cloud.google.com/sql/docs/mysql/connect-app-engine\n\nLicense\n-------\n\nCopyright (c) 2017 Nick Satterly. Available under the MIT License.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falerta%2Fgcloud-api-alerta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falerta%2Fgcloud-api-alerta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falerta%2Fgcloud-api-alerta/lists"}