diff --git a/examples/compose-with-grafana/README.md b/examples/compose-with-grafana/README.md index 1df20bb..c5ef4a5 100644 --- a/examples/compose-with-grafana/README.md +++ b/examples/compose-with-grafana/README.md @@ -6,26 +6,15 @@ This is a demo [Docker Compose](https://docs.docker.com/compose/) setup for [Res ## Quickstart -Build `rest-server` in Docker: +Bring up the Docker Compose stack (Optionally add `--build` to build image from repository instead of downloading): - cd ../.. - make docker_build - cd - - -Bring up the Docker Compose stack: - - docker-compose build - docker-compose up -d + docker compose up -d Check if everything is up and running: - docker-compose ps + docker compose ps -Grafana will be running on [http://localhost:8030/](http://localhost:8030/) with username "admin" and password "admin". The first time you access it you will be asked to setup a data source. Configure it like this (make sure you name it "prometheus", as this is hardcoded in the example dashboard): - -![Add data source](datasource.png) - -The Rest Server dashboard can be accessed on [http://localhost:8030/dashboard/file/rest-server.json](http://localhost:8030/dashboard/file/rest-server.json). +Grafana will be running on [http://localhost:8030/](http://localhost:8030/) with username "admin" and password "admin". When you login, you should be greeted by the dashboard, without any data. Prometheus can be accessed on [http://localhost:8020/](http://localhost:8020/). diff --git a/examples/compose-with-grafana/datasource.png b/examples/compose-with-grafana/datasource.png deleted file mode 100644 index ab6504f..0000000 Binary files a/examples/compose-with-grafana/datasource.png and /dev/null differ diff --git a/examples/compose-with-grafana/docker-compose.yml b/examples/compose-with-grafana/docker-compose.yml index a34427a..ee7b620 100644 --- a/examples/compose-with-grafana/docker-compose.yml +++ b/examples/compose-with-grafana/docker-compose.yml @@ -1,10 +1,9 @@ # Demo of rest-server with prometheus and grafana -version: '2' - services: restserver: - # NOTE: You must run `make docker_build` in the repo root first + # NOTE: Use `docker compose up --build -d` to build the image locally # If you want to run this in production, you want auth and tls! + image: restic/rest-server:latest build: context: ../.. dockerfile: Dockerfile @@ -34,11 +33,11 @@ services: image: grafana/grafana volumes: - grafanadata:/var/lib/grafana - - ./dashboards:/dashboards - - ./grafana.ini:/etc/grafana/grafana.ini + - ./grafana:/etc/grafana ports: - "127.0.0.1:8030:3000" environment: + GF_SECURITY_CSRF_TRUSTED_ORIGINS: grafana.example.com # Put your serving domain here GF_USERS_DEFAULT_THEME: light # GF_INSTALL_PLUGINS: grafana-clock-panel,grafana-simple-json-datasource depends_on: diff --git a/examples/compose-with-grafana/dashboards/rest-server.json b/examples/compose-with-grafana/grafana/dashboards/rest-server.json similarity index 98% rename from examples/compose-with-grafana/dashboards/rest-server.json rename to examples/compose-with-grafana/grafana/dashboards/rest-server.json index 6db6163..4ed9356 100644 --- a/examples/compose-with-grafana/dashboards/rest-server.json +++ b/examples/compose-with-grafana/grafana/dashboards/rest-server.json @@ -22,7 +22,7 @@ "name": "Graph", "version": "" }, - { + { "type": "datasource", "id": "prometheus", "name": "Prometheus", @@ -59,7 +59,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_PROMETHEUS-INFRA}", + "datasource": "prometheus", "fill": 1, "id": 1, "legend": { @@ -135,7 +135,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_PROMETHEUS-INFRA}", + "datasource": "prometheus", "fill": 1, "id": 4, "legend": { @@ -223,7 +223,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_PROMETHEUS-INFRA}", + "datasource": "prometheus", "fill": 1, "id": 2, "legend": { @@ -299,7 +299,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_PROMETHEUS-INFRA}", + "datasource": "prometheus", "fill": 1, "id": 5, "legend": { @@ -387,7 +387,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_PROMETHEUS-INFRA}", + "datasource": "prometheus", "fill": 1, "id": 3, "legend": { @@ -463,7 +463,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_PROMETHEUS-INFRA}", + "datasource": "prometheus", "fill": 1, "id": 6, "legend": { @@ -551,7 +551,7 @@ { "allValue": null, "current": {}, - "datasource": "${DS_PROMETHEUS-INFRA}", + "datasource": "prometheus", "hide": 0, "includeAll": false, "label": "Instance", @@ -634,4 +634,4 @@ "timezone": "", "title": "Restic Rest Server", "version": 8 -} +} \ No newline at end of file diff --git a/examples/compose-with-grafana/grafana.ini b/examples/compose-with-grafana/grafana/grafana.ini similarity index 99% rename from examples/compose-with-grafana/grafana.ini rename to examples/compose-with-grafana/grafana/grafana.ini index 823893a..2067814 100644 --- a/examples/compose-with-grafana/grafana.ini +++ b/examples/compose-with-grafana/grafana/grafana.ini @@ -311,3 +311,6 @@ path = /dashboards # Url used to to import dashboards directly from Grafana.net [grafana_net] url = https://grafana.net + +[dashboards] +default_home_dashboard_path = /etc/grafana/dashboards/rest-server.json diff --git a/examples/compose-with-grafana/grafana/provisioning/dashboards/dashboards.yml b/examples/compose-with-grafana/grafana/provisioning/dashboards/dashboards.yml new file mode 100644 index 0000000..29a0e39 --- /dev/null +++ b/examples/compose-with-grafana/grafana/provisioning/dashboards/dashboards.yml @@ -0,0 +1,13 @@ +apiVersion: 1 + +providers: + - name: 'default' + orgId: 1 + folder: '' + type: file + disableDeletion: false + editable: true + allowUiUpdates: true + options: + # Path to dashboard files on disk + path: /etc/grafana/dashboards diff --git a/examples/compose-with-grafana/grafana/provisioning/datasources/datasource.yml b/examples/compose-with-grafana/grafana/provisioning/datasources/datasource.yml new file mode 100644 index 0000000..369ea61 --- /dev/null +++ b/examples/compose-with-grafana/grafana/provisioning/datasources/datasource.yml @@ -0,0 +1,9 @@ +apiVersion: 1 + +datasources: + - name: Prometheus + type: prometheus + access: proxy + url: http://prometheus:9090 + isDefault: true + uid: prometheus diff --git a/examples/compose-with-grafana/screenshot.png b/examples/compose-with-grafana/screenshot.png deleted file mode 100644 index cbd6672..0000000 Binary files a/examples/compose-with-grafana/screenshot.png and /dev/null differ