Building Services

The Processes chapter introduced systemd as a system and service manager. We got some insight into systemd unit files structure and saw how the NGINX package ships systemd configuration for running the web server as a supervised process. Similarly to supervising the reverse proxy, we need to supervise the application server, background job processors, and other related services for automatic restarts on failures.By standardizing on systemd, we can achieve a single unified way of deploying services on the system. In this chapter, we’ll learn about the three parts that make up systemd unit files and list most of the useful directives we might need. Then we define the production configuration for Puma and Gunicorn and see how resource consumption of a particular service can be limited with Cgroups.

Table of Contents

Defining Services

Service Units
Unit Section
Service Section
Install Section
Global settings
User Services

Application Services

Socket Activation
Puma Configuration
Gunicorn Configuration

Modifying Services



Buy for $50
Rated 36x five stars
Gumroad (as of Aug 3, 2023)
I am using some scripts I downloaded from Josef Strzibny's book that are setting up Ruby on Rails deployment and automatically installing a PostgreSQL server. I am also using Dokku, but I like the idea of controlling what is happening on the server.
Lucian Ghinda, Senior Ruby Developer