arthur-mdn / ExportGrafanaDashboardToPDF

Free PDF Export Tool in Grafana Community version - Using Puppeteer
16 stars 1 forks source link

curl error and app not running on with docker-compose #7

Open eilimrib opened 1 month ago

eilimrib commented 1 month ago

docker-compose up -d --build seemingly does not have app run on port 3001 despite it being set in .env and console stating it's running.

eileen:/ExportGrafanaDashboardToPDF > docker compose up -d --build
[+] Building 1.8s (15/15) FINISHED                                                                                                                                                                    docker:default
 => [grafana-export-to-pdf internal] load build definition from Dockerfile                                                                                                                                      0.0s
 => => transferring dockerfile: 963B                                                                                                                                                                            0.0s
 => [grafana-export-to-pdf internal] load metadata for docker.io/library/node:20-bookworm                                                                                                                       1.6s
 => [grafana-export-to-pdf internal] load .dockerignore                                                                                                                                                         0.0s
 => => transferring context: 2B                                                                                                                                                                                 0.0s
 => [grafana-export-to-pdf 1/9] FROM docker.io/library/node:20-bookworm@sha256:48db4f6ea21d134be744207225753a1730c4bc1b4cdf836d44511c36bf0e34d7                                                                 0.0s
 => [grafana-export-to-pdf internal] load build context                                                                                                                                                         0.0s
 => => transferring context: 194B                                                                                                                                                                               0.0s
 => CACHED [grafana-export-to-pdf 2/9] WORKDIR /usr/src/app                                                                                                                                                     0.0s
 => CACHED [grafana-export-to-pdf 3/9] COPY package*.json ./                                                                                                                                                    0.0s
 => CACHED [grafana-export-to-pdf 4/9] RUN apt-get update && apt-get install -y     gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 li  0.0s
 => CACHED [grafana-export-to-pdf 5/9] RUN npm install                                                                                                                                                          0.0s
 => CACHED [grafana-export-to-pdf 6/9] COPY grafana_pdf.js .                                                                                                                                                    0.0s
 => CACHED [grafana-export-to-pdf 7/9] COPY server.js .                                                                                                                                                         0.0s
 => CACHED [grafana-export-to-pdf 8/9] COPY .env ./                                                                                                                                                             0.0s
 => CACHED [grafana-export-to-pdf 9/9] COPY generate-pdf.sh ./                                                                                                                                                  0.0s
 => [grafana-export-to-pdf] exporting to image                                                                                                                                                                  0.0s
 => => exporting layers                                                                                                                                                                                         0.0s
 => => writing image sha256:2858fa352cd20324d9d2160028ba9a7923c36efbe8958304b4efae73ce693be9                                                                                                                    0.0s
 => => naming to docker.io/library/exportgrafanadashboardtopdf-grafana-export-to-pdf                                                                                                                            0.0s
 => [grafana-export-to-pdf] resolving provenance for metadata file                                                                                                                                              0.0s
[+] Running 1/1
 ✔ Container exportgrafanadashboardtopdf-grafana-export-to-pdf-1  Started

I had to set node from node:latest to node:20-bookworm to avoid npm not being able to run.

Felt that, running the curl also has some errors, is the syntax wrong?

eileen:/home > curl \ -H "Content-Type: application/json" -X POST -d '{ "url": "https://localhost:443/d/d06eb3325bd05b54a341eb85a3a67e7a/orgId=1&kiosk"}' http://localhost:3001/generate-pdf
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (7) Failed to connect to localhost port 3001 after 0 ms: Connection refused
eilimrib commented 1 month ago

OK, the curl issue was just the random '\'. The issue with failing to start with docker-compose persists still.

eilimrib commented 1 month ago

Upon further inspection and running docker compose up it throws an error saying 'dotenv' cannot be found. Somewhere along the Dockerfile it doesn't seem to be running the npm install using the local packages for some reason.