Skip to content

Commit

Permalink
Merge pull request #39 from ebmdatalab/timescale-setup
Browse files Browse the repository at this point in the history
Configure the timescaledb image with our grafanareader user by default
  • Loading branch information
ghickman authored Nov 21, 2023
2 parents e1cb148 + 6e6f445 commit 10779e2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
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;
ALTER USER grafanareader WITH PASSWORD 'grafana';
GRANT CONNECT ON DATABASE metrics TO grafanareader;
GRANT USAGE ON SCHEMA public TO grafanareader;

0 comments on commit 10779e2

Please sign in to comment.