Bug 215468 - www/grafana3 install phantomjs binaries wrong architecture
Summary: www/grafana3 install phantomjs binaries wrong architecture
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-21 13:56 UTC by slw
Modified: 2017-01-30 15:27 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (jhixson)


Attachments
patch (1.59 KB, patch)
2017-01-09 06:28 UTC, Brad Davis
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description slw 2016-12-21 13:56:27 UTC
# file /usr/local/share/grafana/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs
/usr/local/share/grafana/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: Mach-O 64-bit x86_64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|BINDS_TO_WEAK|PIE>
Comment 1 Brad Davis freebsd_committer freebsd_triage 2017-01-06 01:29:41 UTC
I see this as well, but it does not seem to affect Grafana.  Are you seeing a negative impact?
Comment 2 slw 2017-01-06 10:24:35 UTC
(In reply to Brad Davis from comment #1)

yes, this is prevent to share image graph: "Direct link rendered image" don't work
Comment 3 Vick Khera 2017-01-06 18:57:17 UTC
I don't think the problem is that this mach-o binary exists. According to https://github.com/grafana/grafana/issues/2662 and the updated documentation resulting from that ticket, one is required to install phantomjs binary at the location vendor/phantomjs/phantomjs. Specifically for FreeBSD port, this is /usr/local/share/grafana/vendor/phantomjs/phantomjs.

If you run grafana3 on command line in the foreground, you will see the exact error. It would be nice if this could have shown up in the grafana logs, but that's another issue.

INFO[01-06|12:23:59] PhantomRenderer::renderToPng url [http://analytics.example.com:3000/dashboard-solo/db/example-application?from=1483592400000&to=1483678799999&panelId=4&width=1000&height=500]
EROR[01-06|12:23:59] Failed to render to png                  logger=context userId=2 orgId=1 uname=vivek error="fork/exec /usr/local/share/grafana/vendor/phantomjs/phantomjs: no such file or directory"

And indeed there is no such binary existing.

The following gets us past this error:

pkg install phantomjs
cd /usr/local/share/grafana
mkdir -p vendor/phantomjs
cd vendor/phantomjs
ln -shf /usr/local/bin/phantomjs

but then grafana complains: Can't open '/usr/local/share/grafana/vendor/phantomjs/render.js'

but I have yet to find why that is not installed. It appears to be part of the grafana distribution. I fixed it by copying from github:

fetch https://raw.githubusercontent.com/grafana/grafana/v3.1.1/vendor/phantomjs/render.js

and viola! it works.
Comment 4 Vick Khera 2017-01-06 19:01:40 UTC
Spoke too soon... you also need

pkg install webfonts

so that you get the text to render (titles, legend, axes, etc.)
Comment 5 Vick Khera 2017-01-06 19:41:48 UTC
actually, the xorg-fonts-truetype package provides nicer fonts than webfonts and also allows text to render.
Comment 6 slw 2017-01-06 19:49:44 UTC
(In reply to Vick Khera from comment #5)

all of this (lost dependens of phantomjs, webfonts, xorg-fonts-truetype and lost links to right binary) is same issuse.

In general grafana port don't need to insatll MachO binary, need depends (optional) to phantomjs and fonts and need install render.js in right place
Comment 7 Brad Davis freebsd_committer freebsd_triage 2017-01-09 06:28:58 UTC
Created attachment 178658 [details]
patch

This patch fixes the port
Comment 8 Palle Girgensohn freebsd_committer freebsd_triage 2017-01-29 11:17:05 UTC
So we have a patch that fixes the port. Is anyone planning to commit it? :)
Comment 9 commit-hook freebsd_committer freebsd_triage 2017-01-30 14:42:16 UTC
A commit references this bug:

Author: brd
Date: Mon Jan 30 14:41:18 UTC 2017
New revision: 432848
URL: https://svnweb.freebsd.org/changeset/ports/432848

Log:
  Fix www/grafana3 to use the right phantomjs binaries.

  PR:		215468
  Submitted by:	brd
  Approved by:	maintainer timeout, bdrewery (implicit)

Changes:
  head/www/grafana3/Makefile
  head/www/grafana3/pkg-plist
Comment 10 Brad Davis freebsd_committer freebsd_triage 2017-01-30 15:27:08 UTC
Thanks for the reminder Palle!  I forgot to setup a maintainer timeout reminder for myself.