netbird icon indicating copy to clipboard operation
netbird copied to clipboard

Packaging for more distros / inits?

Open endigma opened this issue 2 years ago • 19 comments

Starting to build automated packages for more of the distros in the world would be great, perhaps starting with some of the popular non-debian ones?

Alpine Linux Artix/Arch Void Linux NixOS Solus

I'm sure given its Go there's a template pkgfile for each of these available if someone were to attempt automating it.

endigma avatar Jun 16 '22 13:06 endigma

This could also involve writing rudimentary service files for openrc/runit/s6/etc

endigma avatar Jun 16 '22 13:06 endigma

Hello @endigma, thanks for your suggestion. We will have a look at it, we consider building the package for Alpine and Arch already, we will need a repository to host them, this might be the only blocker.

If you already have any documentation or guides of the package managers of the distros you've proposed will be highly appreciated.

mlsmaycon avatar Jun 17 '22 13:06 mlsmaycon

Official repositories should do for most distros. If you the first party are committed to maintaining the package and it doesn't have any dependencies I don't foresee you having much of a problem getting updates merged.

As an alternative with less upfront effort you could look into providing consistent versioned artifacts which would make 3rd party packages very simple. Scripts for other inits would also be fairly trivial to include in a doc/ folder or etc.

endigma avatar Jun 17 '22 13:06 endigma

Void Linux

https://github.com/void-linux/void-packages/blob/master/Manual.md

Alpine Linux

https://wiki.alpinelinux.org/wiki/Creating_an_Alpine_package

Arch Linux

https://wiki.archlinux.org/title/creating_packages

NixOS

https://nixos.wiki/wiki/Go

Solus

https://getsol.us/articles/packaging/

endigma avatar Jun 17 '22 13:06 endigma

If you're intent on hosting the repos yourself, I know for a fact void repos at least are trivial to self-host, but not really integrated into the package manager. Alpine should be similar. Not sure about Arch or Solus, NixOS shouldn't even require a repo.

endigma avatar Jun 17 '22 13:06 endigma

Thank you @endigma we will have a look and get back to you soon.

mlsmaycon avatar Jun 17 '22 14:06 mlsmaycon

Consider using Open Build Service instead of reimplementing the wheel. (the code block is to avoid unnecessary linking)

https://github.com/tonarino/innernet/issues/203#issuecomment-1172847002

hg avatar Jul 05 '22 11:07 hg

OBS is great until you realize in reality it only supports:

  • openEuler
  • openSUSE
  • SUSE SLE
  • Arch
  • Raspbian
  • Debian
  • Fedora
  • ScientificLinux
  • RHEL
  • CentOS
  • Ubuntu
  • Univention
  • Mageia
  • IBM PowerKVM
  • AppImage

Which although technically covered by AppImage leaves off:

  • Solus
  • Void
  • Alpine
  • NixOS
  • Gentoo
  • Clear Linux

and a lot more, also any BSD

If you don't have the manpower to handle this, non-lock-in solutions like jordansissel/fpm exist, which is somewhat extensible to produce packages for "unsupported" distros.

endigma avatar Jul 05 '22 12:07 endigma

hello @endigma and @hg, thanks for your suggestions.

I've checked all the guides and descriptions on how to create the packages. Unfortunately, the project only has 2 maintainers with an extensive roadmap, and we can't move this forward request without community help.

I've tested the binary installation and it worked well with 3/5 of the distros above:

  • Alpine
  • Artix
  • Solus

For Void and NixOS, we had a few issues:

  • Void: default init system doesn't have support by our service/init lib https://github.com/kardianos/service, once I am done testing, I will add an example of manual init configuration for it.
  • NixOS: the main problem with the binary installation path is that the /etc is read-only, same as for Void, I will add a configuration.nix example. This will help teams to get started.

With that being said, as we progress with the project and onboard more people we will review this request again in the following quarters.

mlsmaycon avatar Jul 11 '22 10:07 mlsmaycon

This is an example of init file for Void: Create a sv directory:

mkdir /etc/sv/netbird

Add a run file:

vi /etc/sv/netbird/run
# contents
#!/bin/sh
[ -r conf ] && . ./conf
exec netbird service run --log-level info 1>&2

link the file to /var/services

ln -s /etc/sv/netbird /var/service/

mlsmaycon avatar Jul 11 '22 11:07 mlsmaycon

@mlsmaycon personally I wouldn't expect you to support anything but a couple of the most popular distributions. Even major corporations rarely care about anything besides Ubuntu and RHEL.

OBS is great until you realize in reality it only supports …

… probably 99% of Linux installations out there. The remaining ones mostly cater to enthusiasts who can write their own packages. I really don't think it's reasonable to expect support for Void, Solus, and Clear Linux from a small startup. I don't believe I've ever seen anyone shipping packages for them now that I think of it (or binary packages for any of the BSDs for that matter — you're typically expected to use ports).

Alpine is pretty popular, but it's also frequently updated (and you can easily install 'backports' from the Edge repo, which is perfectly safe for statically linked binaries in my experience).

Note that OBS supports more than they officially claim, although quality may vary (it may not work on less popular architectures). For example, here are projects for cross-compilation onto Windows:

  • https://build.opensuse.org/project/show/windows:mingw:win64
  • https://build.opensuse.org/project/show/windows:mingw:win32

I'll throw together an OBS repo in the next few days, and we'll see how well it performs. If it works out badly, at least that's one dead end crossed out.

hg avatar Jul 11 '22 12:07 hg

I can help getting netbird to NixOS repository.

EDIT: see https://github.com/NixOS/nixpkgs/pull/186669

misuzu avatar Aug 14 '22 14:08 misuzu

awesome, thanks @misuzu for your contribution.

mlsmaycon avatar Aug 14 '22 17:08 mlsmaycon

Great if it also support BSD based firewall OS, like OPNSense? I would love to use it at an gateway.

Tennyleaz avatar Oct 07 '22 02:10 Tennyleaz

Created an issue in Alpine Linux's aports at https://gitlab.alpinelinux.org/alpine/aports/-/issues/14248

FireMasterK avatar Nov 11 '22 21:11 FireMasterK

Is there any update on the BSD support?

FReichelt avatar Mar 14 '24 11:03 FReichelt

I agree BSD wuld be nice to have Opnsense, Pfsense would be perfect for this especially they all support wireguard now.

xromansx avatar Apr 11 '24 09:04 xromansx