January 25, 2022

systemd by example

The Playground

Introducing systemd-by-example.com, a playground for systemd that allows to do experiments with systemd right from your browser!

Why?

In the first post in the systemd series, I explained my approach to learning a new topic, which is driven by experimentation. I also described a way to conduct these experiments in case of systemd using podman containers, which avoids tampering with your real system. This setup has worked well for me, but I have to admit that it is a bit cumbersome. It involves juggling with a few different terminal windows to prepare the container setup, build and start the container, and interact with it. And if you simply want to try out one of the examples mentioned in the blog post, you first have to get the example files from GitHub or re-create them yourself. This creates a pretty big barrier for people to actually try out the examples and do their own experiments, and I’m not aware of many people who did.

The playground systemd-by-example.com tries to remove this barrier by making the examples accessible through the browser. (This is heavily inspired by Julia Evans’ tools for easy experimentation through the browser, with the most recent tool Mess with DNS.) On the playground, you can start any of the examples in the blog posts with a single click and interact with it through a command line. Hopefully this makes it easier to follow the examples and get a deeper understanding.

Following examples is a good way to get started. The real learning experience however comes from trying out things on your own. That’s why all examples are editable: you can change the unit definitions, add or remove unit files, and even edit the description. Once you are happy with a setup, you can create a unique link to it (using the share button); you can then bookmark this link to come back to it later, or share it with others.

How?

The playground allows you to define a set of unit files and create a systemd setup based on these units. When you click on Start system, it sends a request to the backend which basically follows the process described in the first post: it creates a new container image with these unit files and runs a new podman container based on this image. On the web page, you will see a command line; everything you type in there will be executed in a bash shell on the container.

There are some restrictions on the containers:

This shouldn’t prevent any interesting examples, but if it does, let me know.

What’s next?

I will continue writing the series and make new examples accessible through the playground (I still plan to write about services next). The existing posts are already updated.

If you have ideas on how to improve the playground or cool examples to share, let me know!

—Written by Sebastian Jambor. Follow me on Mastodon @crepels@mastodon.social for updates on new blog posts.