You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.
I'm running Promscale together with Grafana and a bunch of other things via docker-compose. For that, I'd like to have a database role with read-only access to timeseries data to use with Grafana. (as the docs point out)
I can easily create a user and GRANT some permissions on the database in the timescale container, by mounting a script to /docker-entrypoint-initdb.d/. However, if I got this right, I'd need to grant permissions on schema prom_metric, which is created by Promscale, i.e., doesn't exist at this point.
Basically, I think this is what happens:
Database starts, does a bunch of setup
My user-creation script runs after all those setup steps, creates a role and attempts to GRANT SELECT ON ALL TABLES IN SCHEMA prom_metric, which fails
The promscale container starts and creates said schema, I think.
#!/bin/bash -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER"<<-EOSQL CREATE USER grafana WITH ENCRYPTED PASSWORD 'grafana'; GRANT USAGE ON SCHEMA prom_metric TO grafana; GRANT SELECT ON ALL TABLES IN SCHEMA prom_metric TO grafana; GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public TO grafana; ALTER DEFAULT PRIVILEGES IN SCHEMA prom_metric GRANT SELECT ON TABLES TO grafana; ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT EXECUTE ON FUNCTIONS TO grafana;EOSQL
Some way to create a non-privileged user that can read all metrics data (and probably execute some functions and whatnot).
Thanks! Best,
The text was updated successfully, but these errors were encountered:
mrd0ll4r
changed the title
Unclear how to create a role with minimal privileges to read timeseries data
Unclear how/when/where to create a role with minimal privileges to read timeseries data in docker-compose setup
Dec 17, 2022
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the bug
I'm running Promscale together with Grafana and a bunch of other things via docker-compose. For that, I'd like to have a database role with read-only access to timeseries data to use with Grafana. (as the docs point out)
I can easily create a user and
GRANT
some permissions on the database in the timescale container, by mounting a script to/docker-entrypoint-initdb.d/
. However, if I got this right, I'd need to grant permissions on schemaprom_metric
, which is created by Promscale, i.e., doesn't exist at this point.Basically, I think this is what happens:
GRANT SELECT ON ALL TABLES IN SCHEMA prom_metric
, which failsTo Reproduce
docker-compose.yml
:setup-grafana-db-user.sh
:datasources.yml
:Expected behavior
Some way to create a non-privileged user that can read all metrics data (and probably execute some functions and whatnot).
Thanks! Best,
The text was updated successfully, but these errors were encountered: