Giter Club home page Giter Club logo

try_grafana's Introduction

try_grafana

see: https://www.tsuyukimakoto.com/blog/2024/06/30/cloudrun-and-litestream/

What is this repository?

Grafana is a visualization tool commonly used in the field of Monitoring/Observability.

By default, it uses SQLite, so we will try to start Grafana using Litestream.

Set up the environment with Terraform

Note: It is simplified, so we recommend creating a dedicated Google Cloud project. Proceed at your own risk.

Here's the Terraform. Comment out the google_cloud_run_service and google_cloud_run_service_iam_member resources, and run Terraform in the Terraform folder.

You will encounter an error message asking to enable the service. Manually enable Cloud Run from the console and try again several times.

$ terraform init
$ TF_VAR_project_id=<Google Cloud Project_id> TF_VAR_grafana_settings_bucket_name=<gcs bucket name> TF_VAR_google_artifact_registry_repository_name=<Artifact Registry Repository name> TF_VAR_image_name=<Docker image name> terraform apply

Four resources will be created.

Creating the Container Image

Modify the Litestream configuration file

Change the GCS bucket name to the bucket name created with Terraform.

Modify <GRAFANA_SETTINGS_BUCKET_NAME>.

url: gcs://<GRAFANA_SETTINGS_BUCKET_NAME>/grafana.db
Build and push the Docker image
Run the following commands in the directory containing the Dockerfile.

Since I am using an Apple Silicon Mac, I add --platform linux/amd64, but this is not necessary for Intel Macs or Linux.

$ docker build --platform linux/amd64 . -t <Docker image name>
$ docker tag <Docker image name> asia-northeast1-docker.pkg.dev/<Google Cloud Project_id>/<Repository name created in Artifact Registry>/<Docker image name>
$ docker push asia-northeast1-docker.pkg.dev/<Google Cloud Project_id>/<Repository n

Starting the Cloud Run Service with Terraform

Enable the previously commented out resources and run terraform apply again using the same commands as before.

$ TF_VAR_project_id=<Google Cloud Project_id> TF_VAR_grafana_settings_bucket_name=<GCS bucket name> TF_VAR_google_artifact_registry_repository_name=<Repository name created in Artifact Registry> TF_VAR_image_name=<Docker image name> terraform apply

Verify the operation

Check the URL of the Cloud Run service from the Google Cloud console and access the URL.

try_grafana's People

Contributors

tsuyukimakoto avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.