IzakMarais / reporter

Service that generates a PDF report from a Grafana dashboard
Apache License 2.0
947 stars 307 forks source link

Templating with reporter as a service #300

Open fntkg opened 3 years ago

fntkg commented 3 years ago

Hello, I have created a custom template and it works fine when I start grafana-reporter from command line:

/root/go/bin/./grafana-reporter &

However, I created a system service file in order to launch grafana reporter as a service which is using exactly the same command:

ExecStart=/root/go/bin/./grafana-reporter &

In that case, grafana reporter is started, but I get the following error:

Error reading template file: "open templates/logoTemplate.tex: no such file or directory"

What is the issue here ? When I start grafana-reporter from command line it finds the template but when started via systemctl as a service, it doesn't find it.....

Originally posted by @sanemogi in https://github.com/IzakMarais/reporter/issues/50#issuecomment-804010121

fntkg commented 3 years ago

Update

I've discovered that launching the program from a different working directory that $GOPATH/bin makes the program to not get the templates.

So is not about using the reporter as a service, is about launching it from the correct place. However, creating the service with WorkingDirectory still doesn't works

fntkg commented 3 years ago

I found a work around using the param --templates $GOPATH/bin/templates/ but the bug is still there

I think maybe it's related to Go version but i'm not sure about that