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

Configure the timescaledb image with our grafanareader user by default #39

Merged
merged 2 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ services:
- grafana:/var/lib/grafana

timescaledb:
image: timescale/timescaledb-ha:pg14-latest
build:
dockerfile: timescaledb/Dockerfile
environment:
POSTGRES_DB: metrics
POSTGRES_PASSWORD: pass
Expand Down
3 changes: 3 additions & 0 deletions timescaledb/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM timescale/timescaledb:pg14-latest@sha256:c453fa2d290d578a5983b5823e9ffbf16f478735d8c121620436c4a9c6e55df5

COPY timescaledb/init.sql /docker-entrypoint-initdb.d/
6 changes: 6 additions & 0 deletions timescaledb/init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- set up the grafanareader role with select permissions by default
CREATE ROLE grafanareader;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO grafanareader;
ghickman marked this conversation as resolved.
Show resolved Hide resolved
ALTER USER grafanareader WITH PASSWORD 'grafana';
GRANT CONNECT ON DATABASE metrics TO grafanareader;
GRANT USAGE ON SCHEMA public TO grafanareader;