FreeBSD builds
Is your feature request related to a problem? Please describe. I would like to run gotify on FreeBSD but there are not any FreeBSD builds.
Describe the solution you'd like I would like to see FreeBSD builds for each release just like other OSes.
Describe alternatives you've considered Linux binary compatibility or running a Linux bhyve virtual machine are workarounds.
Additional context n/a
@jmattheis What do you think? Should we add official support for this?
@eternal-flame-AD Sure, why not (:.
AFAIK Ubuntu does not seem to have a pre-built freebsd cross-compiler available. I think we need to build it from source manually. Right? @jmattheis
So, I'm not a free bsd user but I've you said that free bsd supports linux binary compatibility, why not use this instead?
Yeah, couldn't find a prebuilt cross compiler.
@geeseven Does the linux binary work on your machine?
Thanks for the timely replies. I was hoping to avoid Linux binary compatibility if possible. It seems like a workaround golang was designed to eliminate. That being said, I understand in the real world other issues crop up.
If there is no tooling and y'all do not use FreeBSD, I think official support more or less just providing 'as is' binaries is not a good idea. If/when I get time, I will report back how I got gotify running on FreeBSD.
I've recently deployed gotify on freeBSD based VPS without any issues, built without any hiccups. If that helps anybody
Hey @barolo, glad to hear. Do you mind sharing details on what you did, as I have not had a chance to look into this further.
Besides VPS specific stuff like setting paths [ it had to be compiled and installed in the user folder ] nothing much
go get -u github.com/gotify/server
in the ui folder:
npm install
npm run build
in the main folder
packr build
[ I had to get packr, but just:
go get -u github.com/gobuffalo/packr/packr
go get -u github.com/gobuffalo/packr
was enough ]
then copy config.example.yml into config.yml [ changed port to what I needed ] and launch serwer, done.
npm and go was already set up
@barolo, thanks for the details. Did the ports versions of go and npm not work? Also do you mind sharing your rc.d script?
@geeseven It's a VPS, I have no access to system or say in how it's set up, It was preconfigured by a hosting provider
Interesting, sounds more like a shell account than a VPS. None the less, thanks for sharing.
@geeseven It's something inbetween, on a shell account you can't usually binexec your own stuff. There's decent amount of configurability, myriad of dev tools of several versions and virtual environments for these [ It's also really cheap ]
I have been toying with sourcehut's build tools to see if it could be used for FreeBSD builds. They not only offer Linux build hosts, but also FreeBSD, OpenBSD and even 9front. :laughing:
I was able to get a build to complete, but I get the following error after coping the binary off the build host:
2020/06/06 15:51:47 [Recovery] 2020/06/06 - 15:51:47 panic recovered:
GET / HTTP/1.1
Host: localhost:8080
Accept: */*
User-Agent: curl/7.70.0
stat /usr/home/user/ui/build/index.html: no such file or directory
Note, /health works, but /version gets weird:
$ curl localhost:8080/health
{"health":"green","database":"green"}
$ curl localhost:8080/version
{"version":"unknown","commit":"unknown","buildDate":"unknown"}
I will post updates if I make anymore progress.
@geeseven
Have a look at our build docs. Steps 2 and 3 are responsible for the ui: https://gotify.net/docs/build
The version info will be populated via ldflags: https://github.com/gotify/server/blob/92a468bf74f243c94f2c2a94db96247c962bef03/.travis.yml#L42
go build -ldflags="$LD_FLAGS" -o gotify-server
I don't use FreeBSD as my primary OS (so I'm not quite as clued up on it as I'd like to be) but I have a server that uses it and I'd like to run gotify on that.
I setup a new jail (to have a fresh environment of FreeBSD 11.4) and followed the documented build instructions. The instructions worked almost as-is without issue. I built gotify manually without docker or the makefile and only had to make two minor changes due to the default shell being csh rather than bash:
- Instead of assigning LD_FLAGS as suggested, I set LDFLAGS with
set LDFLAGS="-w -s -X main.Version=`git describe --tags | cut -c 2-` -X main.BuildDate=`date '+%F-%T'` -X main.Commit=`git rev-parse --verify HEAD` -X main.Mode=prod"; - The build command similarly needs to change slightly to become:
go build -ldflags="$LDFLAGS" -o gotify-server
I now appear have a fully-functioning gotify server running on FreeBSD. I'd be happy to help trying to roll that out to the Release/CI build process. I haven't tried yet but I expect if I installed bash and went through the build process there it'd work without modification.
Yeah, the problem is that there are no cross-compilers for freebsd. Thus, we cannot integrate this into the current build pipeline on travis-ci.
Restic (encrypted backup utility written in Go) provides FreeBSD builds. Maybe one of their pipelines can give some insight in how to solve this? https://github.com/restic/restic/blob/master/.github/workflows/tests.yml
Anyone has luck with recent build on Freebsd 14? I have currently yarn command run exception
bgotify ui (master?) # yarn
yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "react-infinite > [email protected]" has unmet peer dependency "enzyme@^3.0.0".
warning " > @typescript-eslint/[email protected]" has unmet peer dependency "eslint@^5.0.0 || ^6.0.0 || ^7.0.0".
warning "@typescript-eslint/eslint-plugin > @typescript-eslint/[email protected]" has unmet peer dependency "eslint@*".
warning "@typescript-eslint/eslint-plugin > @typescript-eslint/experimental-utils > [email protected]" has unmet peer dependency "eslint@>=5".
warning " > @typescript-eslint/[email protected]" has unmet peer dependency "eslint@^5.0.0 || ^6.0.0 || ^7.0.0".
warning " > [email protected]" has unmet peer dependency "eslint@>=3.14.1".
warning " > [email protected]" has unmet peer dependency "eslint@^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8".
warning " > [email protected]" has unmet peer dependency "eslint@>=5".
warning " > [email protected]" has unmet peer dependency "eslint@>=2.0.0".
warning " > [email protected]" has unmet peer dependency "eslint@^3 || ^4 || ^5 || ^6 || ^7 || ^8".
warning " > [email protected]" has unmet peer dependency "eslint@>=7.3.0".
warning "eslint-plugin-unicorn > [email protected]" has unmet peer dependency "eslint@>=7.0.0".
warning "eslint-plugin-unicorn > eslint-template-visitor > @babel/[email protected]" has unmet peer dependency "eslint@^7.5.0 || ^8.0.0".
[4/4] Building fresh packages...
[1/5] ⢀ puppeteer [-/5] ⢀ waiting...
[-/5] ⢀ waiting...
[4/5] ⢀ ejs
error /root/gotify/server/ui/node_modules/puppeteer: Command failed.
Exit code: 1
Command: node install.js
Arguments:
Directory: /root/gotify/server/ui/node_modules/puppeteer
Output:
/root/gotify/server/ui/node_modules/puppeteer/lib/cjs/puppeteer/util/assert.js:28
throw new Error(message);
^
Error: Unsupported platform: freebsd
at assert (/root/gotify/server/ui/node_modules/puppeteer/lib/cjs/puppeteer/util/assert.js:28:15)
at new BrowserFetcher (/root/gotify/server/ui/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserFetcher.js:216:44)
at PuppeteerNode.createBrowserFetcher (/root/gotify/server/ui/node_modules/puppeteer/lib/cjs/puppeteer/node/Puppeteer.js:208:16)
at downloadBrowser (/root/gotify/server/ui/node_modules/puppeteer/lib/cjs/puppeteer/node/install.js:59:51)
Ignore above it was about puppeteer chromium download, can be skipped with env variable
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true