[DEPRECATED] Promscale is a unified metric and trace observability backend for Prometheus, Jaeger and OpenTelemetry built on PostgreSQL and TimescaleDB.
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
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,