grafana/oncall

Developing using docker-compose currently doesn't work

Opened this issue · 0 comments

What went wrong?

What happened:

  • Tried to use the docker-compose method however changes for pnpm and mage prevent developing
  • Received error
#6 [oncall_ui] exporting to image
#6 exporting layers 0.0s done
#6 writing image sha256:5ecb86c7914a93e44f25e8ef4a0507b6d61415cc299ed81a306e2e21bce1e785 done
#6 naming to docker.io/library/oncall-oncall_ui 0.0s done
#6 DONE 0.0s
sh: pnpm: not found
make: *** [init] Error 127

during the container make

  • Received error
logger=plugins.backend.start t=2024-11-19T02:29:55.216037779Z level=error msg="Could not start plugin backend" pluginId=grafana-oncall-app error="fork/exec /var/lib/grafana/plugins/grafana-plugin/dist/gpx_grafana_oncall_app_linux_arm64: no such file or directory"

during engine start

What did you expect to happen:

  • environment starts up and runs ready for dev

How do we reproduce it?

Use docker-compose steps in README.md

Grafana OnCall Version

dev

Product Area

Helm/Kubernetes/Docker

Grafana OnCall Platform?

Docker

User's Browser?

No response

Anything else to add?

I unfortunately don't have access to a Docker licence and as such I'm using rancher. Ctlptl used for tilt does not support rancher backend : tilt-dev/ctlptl#153

I think I have a workable solution with the following changes but haven't fully tested them. I thought it was worth at least documenting them in a n issue even if the long term goal is to switch to Tilt so that others using docker-compose can benefit.

diff --git a/Makefile b/Makefile
index 9498a0f4..cc2f636c 100644
--- a/Makefile
+++ b/Makefile
@@ -141,7 +141,7 @@ init:  ## build the frontend plugin code then run make start
 # this makes sure that it will be available when the grafana container starts up without the need to
 # restart the grafana container initially
 ifeq ($(findstring $(UI_PROFILE),$(COMPOSE_PROFILES)),$(UI_PROFILE))
-       $(call run_ui_docker_command,pnpm install && pnpm build:dev)
+       $(call run_ui_docker_command,pnpm install && pnpm build:dev && pnpm mage:build-dev)
 endif
 
 stop:  # stop all of the docker containers
diff --git a/grafana-plugin/Dockerfile.dev b/grafana-plugin/Dockerfile.dev
index 03a79c08..576df71d 100644
--- a/grafana-plugin/Dockerfile.dev
+++ b/grafana-plugin/Dockerfile.dev
@@ -2,5 +2,10 @@ FROM node:20.15.1-alpine
 
 WORKDIR /etc/app
 ENV PATH /etc/app/node_modules/.bin:$PATH
+RUN npm install -g pnpm
+RUN apk add go git && git clone https://github.com/magefile/mage && \
+    cd mage && mkdir /root/go/ && \
+    go run bootstrap.go
 
+ENV PATH="/root/go/bin/:$PATH" 
 CMD ["pnpm", "start"]
\ No newline at end of file
diff --git a/grafana-plugin/package.json b/grafana-plugin/package.json
index a9609049..b4f9ba11 100644
--- a/grafana-plugin/package.json
+++ b/grafana-plugin/package.json
@@ -30,7 +30,7 @@
     "serve": "serve -p 3001 ./dist",
     "dev:serve": "concurrently --names \"serve,dev\" --prefix-colors \"blue,green\" \"pnpm serve\" \"pnpm dev\"",
     "sign": "npx --yes @grafana/sign-plugin@latest",
-    "start": "pnpm watch",
+    "start": "pnpm mage:build-dev; pnpm dev:serve",
     "setversion": "setversion",
     "type-check": "tsc --noEmit",
     "type-check:watch": "pnpm type-check --watch --preserveWatchOutput false",