Author: Pedro Lucas Porcellis <porcellis@eletrotupi.com>
Add new post about Alpine Linux
content/blog/alpine-linux.en.md | 81 ++++++++++++++++++++++++++++++ content/blog/alpine-linux.md | 94 +++++++++++++++++++++++++++++++++++
diff --git a/content/blog/alpine-linux.en.md b/content/blog/alpine-linux.en.md new file mode 100644 index 0000000000000000000000000000000000000000..83f4e2e9dd85fede781f0f5be8b6cd215522eed9 --- /dev/null +++ b/content/blog/alpine-linux.en.md @@ -0,0 +1,81 @@ +--- +title: "Alpine Linux" +date: 2021-06-15T07:57:45-03:00 +draft: false +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 diff --git a/content/blog/alpine-linux.md b/content/blog/alpine-linux.md new file mode 100644 index 0000000000000000000000000000000000000000..3d339205459253baadcbbac9186a88a5fb8c7eff --- /dev/null +++ b/content/blog/alpine-linux.md @@ -0,0 +1,94 @@ +--- +title: "Alpine Linux" +date: 2021-06-15 +draft: false +tags: ["infra", "linux"] +--- + +Eu comecei a utilizar o Alpine Linux já faz um tempo, em especial porque eu +sabia que ele era conhecido por ser uma distribuição leve, um requisito do qual +eu [julgo muito necessário][duravel] e da qual [eu já escrevi a +respeito][light]. Depois de um ano trabalhando de casa devido a pandemia de +Covid-19, decidi parar de utilizar um notebook como minha ferramenta principal. +Os motivos são variados, mas a falta de espaço para armazenamento e ter que +lidar com bateria me fizeram eu finalmente fazer um merecido upgrade para uma +estação de trabalho desktop. + +[duravel]: 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 + +Depois que eu migrei tudo do notebook para a nova máquina, vi que era uma ótima +oportunidade de fazer um tão desejado test-drive do Alpine no notebook. Não +preciso dizer que nunca mais voltei atrás. + +Sinceramente, o que eu mais gosto no Alpine é o fato de que ele é *muito* +simples. Tudo nele me remete a um certo minimalismo, a um desejo de não ser +intrusivo e de tentar ser um sistema _barebones_ (apenas o mínimo), mas sem ser +masoquista. Tudo nele me parece que foi feito com o objetivo de optar pelo +caminho mais simples, mesmo que isso signifique sacrificar algumas "otimizações" +para você, e escolher poucas peças, mas peças que apresentem um funcionamento +correto. + +Eu sinto que também é uma distribuição que eu consigo confiar como que ela vai +se portar e que simplesmente emana estabilidade. Todo o desenvolvimento é feito +em uma branch "edge" (ponta) e a cada seis meses se congela uma nova versão, +versão essa que tem suporte por até dois anos. O modelo de _rolling release_, ou +seja, onde assim que um pacote é atualizado _upstream_ [^1] é automaticamente +atualizado pelos empacotadores na distribuição já se provou um sucesso entre +outras distribuições (implementado por distribuições respeitáveis como o Arch +Linux, Gentoo, etc), e o Alpine seguiu o mesmo caminho. Eu considero o período +de dois anos um pouco longo, mas o suficiente para que não deixe o sistema +atrofiar. Atualizar entre versões do Alpine é tão simples quanto editar um +arquivo, trocar a versão e mandar atualizar os pacotes. Manter um sistema +atualizado é o mínimo de qualquer infra-estrutura decente, e o Alpine consegue +tornar isso ainda menos doloroso. + +[^1]: _upstream_ remete à fonte, ou seja, onde o software é publicado e + _downstream_ onde ele é consumido e mantido. + +O gerenciador de serviços, openRC, é pequeno e simples, e essencilamente existem +dois formatos de escrever serviços para ele, preenchendo algumas variaveis no +arquivo de serviço [^2] ou escrevendo scripts mais complexos se necessário [^3], +afinal é tudo shell-script. + +[^2]: https://git.eletrotupi.com/pacotes.eletrotupi.com/tree/master/pkgs/satellite/satellite.initd +[^3]: https://git.eletrotupi.com/alfazema.club-etc/tree/master/init.d/hometown-web + +O gerenciador de pacotes do sistema é incrívelmente rápido e vastamente +documentado. Empacotar programas é realmente muito direto ao ponto. Fora que em +menos de uma hora é possível montar uma infra-estrutura para oferecer pacotes +customizados, ou que ainda não estão disponíveis nos repositórios oficiais. O +próprio Alpine oferece as ferramentas para você montar essa infra-estrutura, +assinar pacotes, manter um índice para consulta (o comando abuild) e basta você +expor esse repositório por um proxy reverso e pronto. + +O ponto mais fraco, infelizmente, é a documentação que além de ser bastante +incompleta em alguns lugares, muitas vezes se refere a documentações externas +como a wiki do Arch Linux ou até mesmo de versões antigas do Alpine. Dito isso, +desenvolvedores do Alpine tem colocado bastante peso em manter as _man pages_ +dos pacotes atualizadas e disponíveis, e alguns esforços tem sido feito para +melhorar a documentação como um todo. + +Outro ponto que ainda atrapalha, mas que na minha opinião revela muito mais +sobre como desenvolvedores veem Linux, é o fato de que a maior parte de +softwares externos tem dificuldade de funcionar no Alpine. Em especial, pelo +fato que o Alpine usa como biblioteca C o projeto do [musl-c], ao invés do GNU. +O projeto do musl-c tenta implementar uma versão "correta, simples e segura" da +biblioteca C, o que faz com que alguns softwares específicos não consigam rodar +por ser extremamente dependente de uma implementação específica da biblioteca C, +ou seja, não são por si só, softwares portáveis. + +[musl-c]: https://musl.libc.org/ + +Apesar disso, não é uma causa perdida e existem algumas camadas de +compatibilidade que a própria equipe do musl e do Alpine disponibilizam, e são +muitos poucos programas que de fato não funcionam ou quebram (eu pessoalmente, +só vi ocorrer em alguns jogos). + +Em suma, eu realmente gosto muito do Alpine Linux e me pego muitas vezes +preferindo utilizar o meu notebook justamente porque roda Alpine. Todos os meus +servidores rodam Alpine, e em breve a minha estação de trabalho irá também. Eu +mantenho um [repositório de pacotes de terceiros][repositorio], algumas dezenas +de pacotes e se possível utilizo em máquinas virtuais/dockers do trabalho. + +[repositorio]: https://pacotes.eletrotupi.com