Bug 270098 - www/grafana9: Grafana wrongly reported as not running due to procname
Summary: www/grafana9: Grafana wrongly reported as not running due to procname
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Robert Clausecker
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-10 22:03 UTC by Dominik Banoviez
Modified: 2023-03-22 20:20 UTC (History)
2 users (show)

See Also:
drtr0jan: maintainer-feedback+
drtr0jan: merge-quarterly?


Attachments
[PATCH] www/grafana9: fix rc.d script procname (1.21 KB, patch)
2023-03-10 22:03 UTC, Dominik Banoviez
no flags Details | Diff
[PATCH] www/grafana9: fix rc.d script procname and bump PORTREVISION (1.77 KB, patch)
2023-03-11 22:41 UTC, Dominik Banoviez
no flags Details | Diff
www/grafana9: fix rc.d script procname and bump PORTREVISION (1.50 KB, patch)
2023-03-11 22:56 UTC, Dominik Banoviez
drtr0jan: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dominik Banoviez 2023-03-10 22:03:30 UTC
Created attachment 240733 [details]
[PATCH] www/grafana9: fix rc.d script procname

(Patch attached.)

After starting Grafana, running service grafana status or service grafana stop will say grafana is not running. 

This happens because rc.d checks that 

1) the pidfile exists
2) the process id in the pidfile is running
3) the proccess name matches either the command, or procname

After Grafana switched to a unified binary, grafana-server is a wrapper for "grafana server". The procname should therefore be set to %%PREFIX%%/bin/grafana instead of %%PREFIX%%/bin/grafana-server so rc.d process name check succeeds.
Comment 1 Boris Korzun 2023-03-11 09:15:05 UTC
Comment on attachment 240733 [details]
[PATCH] www/grafana9: fix rc.d script procname

(In reply to dominik from comment #0)

LGTM. Thx!
Also it's needed to bump PORTREVISION and merge to 2023Q1.
Comment 2 Dominik Banoviez 2023-03-11 22:41:08 UTC
Created attachment 240760 [details]
[PATCH] www/grafana9: fix rc.d script procname and bump PORTREVISION

Bumping PORTREVISION following maintainer's feedback. Rebased on current main.
Comment 3 Dominik Banoviez 2023-03-11 22:56:00 UTC
Created attachment 240761 [details]
www/grafana9: fix rc.d script procname and bump PORTREVISION

Same as the previous, but squashed to a single commit. It seems Bugzilla doesn't play nice with git format-patch files containing multiple commits (eg. created with git format-patch -2).
Comment 4 commit-hook freebsd_committer freebsd_triage 2023-03-22 20:18:15 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d2f15374931e8b5c5c360a2ecd7794ff492d8d56

commit d2f15374931e8b5c5c360a2ecd7794ff492d8d56
Author:     Dominik Banoviez <dominik@banoviez.com>
AuthorDate: 2023-03-10 21:28:28 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2023-03-22 20:15:29 +0000

    www/grafana9: fix rc.d script procname

    Grafana switched to a unified binary, changing `grafana-server` to be a
    wrapper script that executes `grafana server` in its place. This patch
    fixes `procname` in the rc.d script, so that rc.d's process name
    checking doesn't fail / the service gets properly reported as running.

    PR:             270098
    MFH:            2023Q1

 www/grafana9/Makefile         | 1 +
 www/grafana9/files/grafana.in | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
Comment 5 commit-hook freebsd_committer freebsd_triage 2023-03-22 20:19:16 UTC
A commit in branch 2023Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=889b2ceda43f9459cf339ede384eb744ce4f6075

commit 889b2ceda43f9459cf339ede384eb744ce4f6075
Author:     Dominik Banoviez <dominik@banoviez.com>
AuthorDate: 2023-03-10 21:28:28 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2023-03-22 20:19:06 +0000

    www/grafana9: fix rc.d script procname

    Grafana switched to a unified binary, changing `grafana-server` to be a
    wrapper script that executes `grafana server` in its place. This patch
    fixes `procname` in the rc.d script, so that rc.d's process name
    checking doesn't fail / the service gets properly reported as running.

    PR:             270098
    MFH:            2023Q1
    (cherry picked from commit d2f15374931e8b5c5c360a2ecd7794ff492d8d56)

 www/grafana9/Makefile         | 1 +
 www/grafana9/files/grafana.in | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
Comment 6 Robert Clausecker freebsd_committer freebsd_triage 2023-03-22 20:20:12 UTC
Thank you for your contribution.