In net-mgmt/prometheus2 2.14.0, some frontend files are missing after the update to the new React UI. This does not affect the ability of Prometheus to scrape metrics, or to be visualized in tools like Grafana, or alerting, but does mean that the Prometheus UI cannot be accessed at the moment. I am currently working on a fix for this, apologies for the breakage. -David
This was caused by two things: 1. We don't pass all the correct build flags. We need to add this to the Makefile: GO_BUILDFLAGS+=-mod=vendor -a -tags netgo,builtinassets 2. Which causes the build to expect two new go source files which must be provided or build. In their Makefile, they expect that 'gmake assets' gets called before the build starts, which runs yarn, compiles/downloads a bunch of stuff and creates two required go files for the above to work: web/ui/ui.go web/ui/assets_vfsdata.go assets_vfsdata.go is ~14M and has all of the HTML from the templates/ dir embedded in it. We probably don't want to run `gmake assets` as we do not want to reach out to the Internet during the port build phase. So, as a workaround, I'd suggest hosting the above two files somewhere. Then, open a PR with the prometheus developers to request that they build/embed these files in their release tarballs moving forward.
A second workaround could include deploying the templates/ directory to disk via the port. You would need to figure out how to tell prometheus the full path to this as I think the source expects that it's relative.
These are the generated/required files for 2.14.0: https://people.freebsd.org/~zi/ui.go https://people.freebsd.org/~zi/assets_vfsdata.go
(In reply to Ryan Steinmetz from comment #1) "-mod=vendor" and "-a" are not needed - go.mk already sets "-mod=vendor" as a result of USES=go:modules and "-a" will cause a rebuild of everything including standard library bits. I'm not sure why upstream needed -a, probably some CI workaround.
Regardless, the important bit is adding -tags netgo,builtinassets.
I'll be hosting the pre-compiled assets on Github, which I should have a patch for later today.
Created attachment 209135 [details] net-mgmt/prometheus2: Add UI assets This patch updates net-mgmt/prometheus2 to pull in pre-compiled assets from the ports-assets/net-mgmt_prometheus2 GitHub repository and use them when compiling Prometheus, enabling the new UI to function properly. The assets are copied over in the post-patch stage and testing shows the Prometheus UI to be functional again. Apologies again for the breakage, -David
Build info is available at https://gitlab.com/swills/freebsd-ports/pipelines/95741184
A commit references this bug: Author: dmgk Date: Wed Nov 13 21:43:56 UTC 2019 New revision: 517390 URL: https://svnweb.freebsd.org/changeset/ports/517390 Log: net-mgmt/prometheus2: Add missing frontend files Pull in pre-compiled assets from the ports-assets/net-mgmt_prometheus2 GitHub repository and use them when compiling Prometheus, enabling the new UI to function properly. While here, remove GO_PKGNAME which is not needed with USES=go:modules. PR: 241925 Submitted by: David O'Rourke <dor.bsd@xm0.uk> (maintainer) Approved by: tz (mentor, implicit) Changes: head/net-mgmt/prometheus2/Makefile head/net-mgmt/prometheus2/distinfo
Committed with some changes, thanks for the quick fix!