Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Unified service management (and systemd)

Unified service management (and systemd)

The workshop is about service management and how to do it with systemd.

Service Management Big Picture:
What is there around:
The rise of systemd and unification of service management in Linux.
Service management vs. container management.
systemd Holy Wars, people with strong opinions and being pragmatic.

What is systemd?
Pros, Cons.
Key concepts.

Get Job Done with systemd:
Reading logs.
"Cron jobs"
Autostarting services.
Autorestarting services.


Michael Pershyn

November 10, 2016


  1. Unifed Service Management Michael Pershyn November 10, 2016

  2. 2 Agenda • Service Management Big Picture • What is

    systemd? • Get Job Done with systemd
  3. 3 Fragmentation Problem Assume you have lots of servers, some

    of them will run systemd, some may still run sysV init scripts, You have to know both
  4. 4

  5. 5 Service Management Big Picture

  6. 6 What is a service (OS) • A program that

    runs as a background process, rather than being under the direct control of an interactive user • In Unix-world knows as a daemon • In Microsoft-world known as a service
  7. 7 The service in Desktop Environment

  8. 8 What is init? The init is a frst daemon

    process which starts as soon as the computer starts and continue running till, it is shutdown. It’s pid is 1.
  9. 9 Service Managers

  10. 10 Service Management in Linux • SysV init scripts –

    Not parallel, because of poor dependency management – Stable since 1982 (UNIX System V) – “Fire and forget”. But there are supervisord, runit and circus – Lots of missing features (see Links) • systemd – Widely adopted as drop-in replacement for SysV init scripts – Does much more than service management should do – Is a platform
  11. 11 Big Picture: systemd adoption 2016

  12. 12 Service Management vs. Container Orchestration Container Orchestration is about

    managing services running in containers Usually in a cloud
  13. 13 Container Orchestration Tools • Common tools for Container Orchestration

    – Kubernetes – Mesosphere Marathon – Docker Swarm – Amazon EC2 Container Service • It is also possible to manage services, running in containers on one host using systemctl
  14. 14 systemd holy wars and being pragmatic

  15. 15 What is systemd? systemd is a service- and system

    manager, that replaces SysV init scripts and does a lot more
  16. 16 Goal/Features of systemd • Parallelized service execution, speedup the

    boot • Socket and D-Bus activation for starting services and daemon • On-demand starting of demons • Managing the service processes as a group using Linux cgroup (resource management) • Supporting automount points, snapshotting, and restoring of services • Manage logs, crons, locale, logins, time, network, ...
  17. 17 Pros • Systemd brings standardization • Unit Files replace

    init scripts and are much simpler to write and maintain. They are same and run then on every distribution that supports systemd • Faster startups and less services running due to efcient dependency resolution and concurrency • ...
  18. 18 Cons • Takes to many responsibilities • Binary logs

    (can be turned of) • Not the unix-way (small things that do one job) • Depends heavy on Linux API, not portable to GNU systems without Linux (hi hurd) and BSD Family • ...
  19. 19 systemd components

  20. 20 systemd concepts • Unit - any resource that the

    system knows how to operate on and manage – E.g.: service, socket, device, timer, ... • Unit File – confguration fle, that defnes unit – Contains Sections and Directives • [Section] • DirectiveKey=DirectiveValue • Unit Files locations – /lib/systemd/system/* - default location, do not edit – /etc/systemd/system/* - best location for overrides – /run/systemd/system/* - for run-time unit defnitions
  21. 21 Getting Things Done with systemd

  22. 22 Reading logs • Logs are accessible through journalctl –

    sudo journalctl -u dmp-importer -f – sudo journalctl -u docker.service -f • journalctl takes care about logs, rotation and storage. It also drops old or massive ones when limits are reached • On debian, some are duplicated as plain text in /var/log/*
  23. 23 Cron-jobs • The cron jobs are replaced with .timer

    unit fle • To start d*ner.service daily, another unit is needed: d*ner.timer
  24. 24 Autostart service • systemctl enable your.service • To check

  25. 25 Autorestart service

  26. 26 Cheat sheet • Use one in the beginning More

    here: http://images.linoxide.com/systemd-vs-sysVinit-cheatsheet.pdf
  27. 27 Some useful links • The Debian developer discussion about

    systemd switch – https://wiki.debian.org/Debate/initsystem/systemd • The motivation statement why systemd was written – http://0pointer.de/blog/projects/why.html • The source code of systemd – https://github.com/systemd/systemd • Ofcial site – https://freedesktop.org/wiki/Software/systemd/ • An article on systemd and init – http://www.tecmint.com/systemd-replaces-init-in-linux/ • How to debug boot and other things in systemd – https://www.freedesktop.org/wiki/Software/systemd/Debugging/ • Systemd cheat sheet – http://images.linoxide.com/systemd-vs-sysVinit-cheatsheet.pdf
  28. 28 Take home message • systemd is here. Learn it.

    Use it. Be Ninja. • By unifying how the service management is done in your company, the fragmentation can be decreased. • Apart from other benefts, the boarding time can be shorter for new employees and they have less impediments to start bringing value from the frst month. True North. • There are also problem areas. Be aware.
  29. 29 Questions?

  30. 30 Thank you!

  31. 31