Wed, July 03, 2024

Alpine Linux: A Primer

Alpine linux a primer

What is Alpine Linux?

Alpine Linux is a type of Linux distribution, like Ubuntu or Debian.

Alpine Linux benefits

Alpine's special in that it is very small and simple. It's very minimal. A tiny Alpine Linux image takes only 2-3 megabytes, while Ubuntu or Debian need 90 megabytes or more.

Why is being small good?

When you use the cloud for your apps, a small container is easier and quicker to start than a big one. Alpine saves storage space and starts up really fast.

On top of that: building a container using Debian and Ubuntu is going to be much larger and that has effects down the line. That's all bandwidth that you're going to have to ship into your production cluster.

Alpine Linux is well-maintained

Another great thing about Alpine Linux is that it always has the newest packages. With Alpine, everything is up-to-date. You just add a package and it's ready to go.

A quick example of why this matters

Let's say, for example, you're running Ruby or PHP or Elixir. On Debian and Ubuntu, updates usually lag behind quite a bit. That means that you'll end up building a lot of what you need yourself since you can't wait.

With Alpine Linux, it's much simpler. The packages are already up to date. You do an APK add and then your package is up-to-date. For example, in Elixir, you're getting Elixir 1.15.7 on Alpine 3.19. You don't have to manually build anything.

With Ubuntu and Debian, you're always stepping into a situation where you could potentially have to build the extra pieces that would be there already, waiting for you, if you were using Alpine. Yes, we <3 Alpine – and for good reason!

Alpine Linux benefits summary

So, Alpine Linux is good because it's small, fast, and has the latest packages. These things alone make it one of the best choices for running your apps.

How to install Alpine Linux

You can actually download the ISO image from the website or if you're deploying an app with us, all you have to do is choose which stack you want to deploy. If you're deploying an app with Opsmaru it's super easy: just choose the stack you want, like alpine/3.19 for version 3.19.

If you want to install Alpine Linux on your local machine, visit the official Alpine website. They have different images for your needs. Check their site and see which one is right for you.

What version of Alpine Linux is available on Opsmaru?

Right now, we have five versions in our platform.

We do this because we follow the end of life rules from the Alpine Linux makers. Each Alpine version lasts about two years. After that, it is called "end of life" and does not get any more security updates.

Right now, we have Alpine 3.16, 3.17, 3.18, 3.19, and the Edge version. For work that is important, we suggest using a release version, not Edge. The Edge version can have problems because it gets new packages often.

Why do we use Alpine Linux ourselves?

It's a lot of what we already talked about above. Alpine is a very small and simple system. When you build an app using Alpine, your app will also be small. This makes Alpine containers load very fast and differentiates Alpine from other common systems like Ubuntu or Debian.

Even if you use Docker or any containerization, you're going to have to choose what kind of OS runs your container, that is, what's running inside of your container. The base Alpine operating system is a couple of megabytes. Literally.

The most minimal Ubuntu is going to run at least 90 something megabytes. And we see all this because we have our own image server – we can actually see the whole process happening before our eyes.

Alpine linux image size

Debian image size

Ubuntu image size

It's pretty cool to see how much of an advantage Alpine Linux is for hosting applications inside of a container.

The second factor that we already talked about a bit is that with Alpine Linux, all the dependencies are there when you want them. For example, if you're using Ruby, you get Ruby 3.2.2 out of the box with  MJIT. If you use Elixir, you get Elixir 1.15 out of the box with the latest version of Alpine. If you use any other operating system, you'll have to do manual builds, which complicates a lot of things.

You'll always get the latest language and frameworks on Alpine, where with others, you just don't.

How we use Alpine Linux

We use Alpine for a few things. We use it to set up our customers' containers. We also use the Alpine build system, called APK, to make customers' apps.

We have a tool named PAKman that helps build alpine packages. The package is shipped to the customer's S3 bucket. When a new version is built, the package is automatically installed in the containers.

If you like learning about image servers

Then check out our community image server that we built for LXD. LINK Here's the whole story about how it came into being and what led us to make it.

If this is all a bit much...

Linux distributions can feel like a little bit of the deep end and more than you want to handle, especailly if you just want to get back to building. In that case, you should check out our Opsmaru tool.

We made OpsMaru so that people could have the PaaS UX everyone likes without having to pay the 208% markup PaaSs charge for cloud services (on average).

You can build your own platforms, it generates all the code you need for you with code engines, and you can build as many no-code platforms on as many cloud providers as you want. It unlocks lower cloud pricing and it takes about 10 minutes to set up a new platform.