From 1ec0046145dd402ee4dbdeaf0930db5695d930d9 Mon Sep 17 00:00:00 2001 From: Tom Ward Date: Wed, 15 Nov 2023 15:53:34 +0000 Subject: [PATCH] fixup! feat: CI build process for grafana --- .github/workflows/grafana.yml | 2 +- grafana/docker-compose.yml | 33 +++++++++++++++++++++++++++++++++ grafana/justfile | 5 +++-- 3 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 grafana/docker-compose.yml diff --git a/.github/workflows/grafana.yml b/.github/workflows/grafana.yml index 8d9d0e26..b4509fd0 100644 --- a/.github/workflows/grafana.yml +++ b/.github/workflows/grafana.yml @@ -95,7 +95,7 @@ jobs: - name: Test image we imported from previous job works run: | SKIP_BUILD=1 just grafana/serve - sleep 5 + sleep 10 just grafana/smoke-test || { docker logs grafana_1; exit 1; } - name: Publish image diff --git a/grafana/docker-compose.yml b/grafana/docker-compose.yml new file mode 100644 index 00000000..f273fce6 --- /dev/null +++ b/grafana/docker-compose.yml @@ -0,0 +1,33 @@ +services: + db: + image: "postgres:16" + environment: + POSTGRES_USER: user + POSTGRES_PASSWORD: pass + POSTGRES_DB: grafana + ports: + - "6543:5432" + volumes: + - postgres:/var/lib/postgresql/data/ + + grafana: + # use Dockerfile so that version matches production + build: + dockerfile: Dockerfile + environment: + GF_DATABASE_TYPE: postgres + GF_DATABASE_HOST: db:5432 + GF_DATABASE_NAME: grafana + GF_DATABASE_USER: user + GF_DATABASE_PASSWORD: pass + GF_DATABASE_SSL_MODE: disable + depends_on: + - db + ports: + - 3000:3000 + volumes: + - grafana:/var/lib/grafana + +volumes: + postgres: + grafana: diff --git a/grafana/justfile b/grafana/justfile index c1418e40..3e68f10d 100644 --- a/grafana/justfile +++ b/grafana/justfile @@ -13,11 +13,12 @@ build: export GITREF=$(git rev-parse --short HEAD) # build the thing - docker build . + docker compose build grafana serve: # Do a basic test with built-in sqlitedb - docker run -p 3000:3000 sha256:c9af59530625894c962e8516cfd44f61161c8dee70fa7e5a7fd78d971c4429b5 + # this should use the Dockerfile version, or this test is pointless + docker compose up grafana -d # run a basic functional smoke test against a running server smoke-test host="http://localhost:3000/login":