porcellis.com

ref: master

content/blog/alpine-linux.en.md


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
---
title: "Alpine Linux"
date: 2021-06-15T07:57:45-03:00
draft: true
tags: ["infra", "linux"]
---

It's been a while since I started to use Alpine Linux, specially because I knew
it was well known for being a very lightweight Linux distribution, a
[prerequisite][reliable] I have [written in the past][light]. After a year
working from home due to Covid-19, I finally decided to stop using my laptop as
my main workstation. The reasons vary, but mostly due to the limitations of
computer storage and having to deal with batteries. So I finally moved into a
proper desktop workstation.

[reliable]: https://porcellis.com/2021/03/29/Sobre-Software-Dur%C3%A1vel.html
[light]: https://porcellis.com/2020/04/02/Porque-eu-uso-Vim-ou-Uma-Reflex%C3%A3o-sobre-Complexidade-na-Tecnologia.html

After migrating everything from my laptop to my new workstation, it occurred to
me that it was the perfect opportunity to do a much desired Alpine Linux
test-drive. Needless to say, I never looked back.

Honestly, the thing I like the most on Alpine, is the fact that it is *very*
simple. Everything in it emanates minimalism, a sense of not being intrusive and
attempt to be very barebones system, but without being masochist. Everything on
it tells me that it were made with the objective to always opt-in for the
simplest path possible, even if that means to sacrifice some "pre-optimizations"
for you, and to always pick the fewest moving parts, and parts that behaves
correctly.

I feel that it's a distribution that I can trust on how it will behaves and
which emanates reliability. All development is made on a "edge" branch, and
every six months they freeze that as a new release, which also has support for
over two years. The rolling release model, which means that whenever a package
is updated upstream it'll be updated on the distro by some maintainer has proved
a complete success on other distros (Arch Linux and Gentoo) and it's the path
Alpine implemented as well. In my opinion, the two years period of support, is a
little too much for my taste, but it's enough to discourage you from letting the
system atrophy. Update between versions of Alpine is simple as edit a file and
bump the repository version. Keeping an up-to-date system is the bare minimum of
any decent infrastructure and Alpine manage to make this even less painful.

The system service supervisor, openRC, is small and simple and essentially
there's two formats of writing services for it. Either filling some variables on
the service file [^1] or writing more complex scripts if necessary [^2], it's
all shell script at the end of the day.

[^1]: https://git.eletrotupi.com/pacotes.eletrotupi.com/tree/master/pkgs/satellite/satellite.initd
[^2]: https://git.eletrotupi.com/alfazema.club-etc/tree/master/init.d/hometown-web

The system packager is simply the fastest package manager and profoundly
documented. Packaging software is a breeze and straight to the point. Also, in
less than a hour it's possible to setup the infrastructure to offer third-party
packages. Alpine offers even the tools for you to build that infrastructure,
sign packages, keep packages indexed, and all you'll need to do is exposing that
repository over a reverse-proxy and that's it.

The weakest point is documentation, that not only is vastly incomplete,
sometimes even send you to other places such as the Arch Wiki. It also features
guides for really old versions of Alpine. Efforts have been made to improve this
situation and to keep man pages tidy as well.

Another issue, even though it shows me more about how mainstream developers see
Linux, is the fact that most mainstream software have some difficulties to play
nice on Alpine. Specially due to the fact that Alpine implements [musl-c] as
it's C Library, instead of GNU. The objective of the musl-c project is to do a
"correct, simple and safe" implementation of the C Library, which makes software
that is deeply GNU dependent to not being able to run smoothly on Alpine, as
they are not portable. Keep in mind that is not some lost cause and there are
some layers of compatibility available that the Alpine and the musl-c team have
made it and to be fair, I only experienced some games failing on it.

[musl-c]: https://musl.libc.org/

So, to summarize, I really like Alpine Linux and find myself picking to use my
laptop over my main workstation just because it runs Alpine. All my servers run
Alpine, and soon my workstation as well. I keep a [third-party
repository][repo], some dozen packages and if I have the chance I'll update any
Dockerfile/server at work to use it as well.

[repo]: https://pacotes.eletrotupi.com