Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update grafana view instructions #239

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions grafana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@ dokku$ dokku letsencrypt:enable grafana

### Configure user on postgresql db cluster

* create `grafanareader` user on cluster in DigitalOcean control panel for primary node
* by default `grafanareader` cannot connect to `jobserver` database
* connect to primary node with psql & allow connections:
* Create `grafanareader` user on db cluster in DigitalOcean control panel for primary node.
* By default `grafanareader` cannot connect to the `jobserver` database. Connect to primary node with psql and allow connections (via dokku4):

```sh
$ psql -h <primary node hostname> -p<primary node port> -Udoadmin -d defaultdb
```

```sql
GRANT CONNECT ON database jobserver TO grafanareader;
Expand All @@ -65,10 +68,14 @@ GRANT CONNECT ON database jobserver TO grafanareader;

```sql
GRANT SELECT ON applications_application, applications_cmoprioritylistpage, applications_commercialinvolvementpage, applications_datasetspage, applications_legalbasispage, applications_previousehrexperiencepage, applications_recordleveldatapage, applications_referencespage, applications_researcherregistration, applications_sharingcodepage, applications_shortdatareportpage, applications_sponsordetailspage, applications_studydatapage, applications_studyfundingpage, applications_studyinformationpage, applications_studypurposepage, applications_teamdetailspage, applications_typeofstudypage, interactive_analysisrequest, jobserver_backend, jobserver_backendmembership, jobserver_job, jobserver_jobrequest, jobserver_org, jobserver_orgmembership, jobserver_project, jobserver_projectcollaboration, jobserver_projectmembership, jobserver_publishrequest, jobserver_release, jobserver_releasefile, jobserver_releasefilereview, jobserver_repo, jobserver_report, jobserver_snapshot, jobserver_snapshot_files, jobserver_stats, jobserver_workspace, redirects_redirect TO grafanareader;
CREATE VIEW jobserver_user_grafana AS SELECT id,last_login,is_superuser,username,is_staff,is_active,date_joined,fullname,created_by_id,login_token_expires_at,pat_expires_at,roles FROM jobserver_user;

CREATE VIEW jobserver_user_grafana AS SELECT id,last_login,username,is_active,date_joined,fullname,created_by_id,login_token_expires_at,pat_expires_at,roles FROM jobserver_user;

GRANT SELECT ON jobserver_user_grafana TO grafanareader;
```

The `jobserver_user_grafana` view may need recreating if the underlying `jobserver_user` table changes.

### Connect from Grafana

Go to the DigitalOcean db cluster read-only node `Connection Details` & get some credentials (`Host`, `Database`, `User`, `Password`). Enter these into a new data source in the Grafana UI by following these links:
Expand Down