Verlihub / verlihub

Verlihub 1.5.0.0
https://github.com/verlihub/
GNU General Public License v3.0
57 stars 15 forks source link

Support compilation on Alpine Linux #193

Closed MattKobayashi closed 1 year ago

MattKobayashi commented 1 year ago

Use cmake -DHAVE_ALPINE .. instead of cmake .. to compile for Alpine.

To install dependencies:

apk --no-cache add bash build-base cmake gettext gettext-dev icu-dev libmaxminddb-dev mariadb-dev openssl-dev pcre-dev
apk --no-cache add libexecinfo-dev --repository=https://dl-cdn.alpinelinux.org/alpine/v3.15/main/

Warnings are thrown by the compiler because Alpine keeps poll.h in a different location to what's normally expected, a skeleton poll.h in /usr/lib/sys/ includes the real one with a warning at the top. Not a real issue, just annoying. It could be resolved with some logic to test for the location of poll.h or the existence of /etc/alpine-release, but I haven't had time to get that deep into it.

RoLex commented 1 year ago

I totally like your contribution, and I'm very thankful for it! I will accept it when we resolve HAVE_ALPINE autodetection, if possible.

I've just tested Alpine Linux myself for the first time and I see it as absolutely horrible! :-D I downloaded latest 3.17 version and tried to setup it on newly created VM. The setup wizard asked me to enter IP address, subnet and gateway - which ofcourse failed in "network unreachable". Later I could find on Google that from version 3.13 the IP should be entered in 1.2.3.4/5 way, but the setup script didn't say that. Anyway, while failing with network setup, I was not able to select the available package mirrors, and the installation CD didn't have the package to setup GRUB properly, so I ended up with unbootable system. After fixing GRUB, networking and mirrors, I tried to upgrade all packages to latest versions. Everything ended in openssh upgrade with default SSH settings, which didn't let me to login again. :-D This was very horrible first-meet to a Linux OS. But I like the idea of tiny Linux that can run on router, Raspberry, or any small device. Keep up with your work! :-)

MattKobayashi commented 1 year ago

Thank you for the kind words @RoLex! I've pushed some further code changes to this PR that appear to work well for handling autodetection of HAVE_ALPINE, I'd love to hear your thoughts!

My primary motivation for this work was to develop a Docker image for Verlihub with Alpine Linux as the base, as Alpine is generally viewed as the best base image for most Docker images to be built on. I'm pleased to say that I've been able to make an image that works, you can see my work here.

On my list of things to improve is removing the requirement to interact with the container during runtime. I'm hoping that I might be able to incorporate a modified version of the vh --install script as an entrypoint script to configure the container based on env variables defined by the user in the Docker run command or Compose file.