Managing the Sidekiq Process in Production with Systemd
Systemd
Systemd is a system and service manager for Linux. It is the default init system for Debian since Debian 8.
Systemd tasks are organized as units. The most common units are services (.service), mount points (.mount), devices (.device), sockets (.socket), or timers (.timer).
Systemctl is the main tool used to introspect and control the state of the “systemd” system and service manager. You can use systemctl to enable/disable services.
Sidekiq
Simple, efficient background processing for Ruby. read more
Systemd Service for Sidekiq
Our objective is to create a service file for sidekiq which can be used to start, stop or restart the Sidekiq process in the Ubuntu 16.04.
- Create a new file for Sidekiq service:
sudo nano /lib/systemd/system/sidekiq.service
2. Add the following content in the service file:
3. Reload the systemctl daemon for the new created service
sudo systemctl daemon-reload
4. Enable the sidekiq service:
sudo systemctl enable sidekiq
5. Now we can start the Sidekiq service:
sudo systemctl start|stop|restart sidekiq
If you have completed the last step, you have successfully created the sidekiq service and you can start using this.