Skip to content

vr_services

Ruben S. Montero edited this page Feb 5, 2024 · 3 revisions

OpenRC Services

Each feature of the VR is represented by an OpenRC service. There are two types of such services, some are one-shot line NAT4, and others are daemons like SDNAT4 or HAProxy.

To list all running services:

$ rc-status
Runlevel: default
 keepalived                                       [  started  ]
 one-failover                                     [  started  ]
 haveged                                          [  started  ]
 crond                                            [  started  ]
 qemu-guest-agent                                 [  started  ]
 sshd                                             [  started  ]
 acpid                                            [  started  ]
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed/wanted
 sysfs                                            [  started  ]
 udev                                             [  started  ]
 fsck                                             [  started  ]
 root                                             [  started  ]
 localmount                                       [  started  ]
 udev-trigger                                     [  started  ]
 udev-settle                                      [  started  ]
Dynamic Runlevel: manual
 iptables                                         [  started  ]
 one-lvs                                          [  started  ]
 one-sdnat4                                       [  started  ]
 one-dhcp4                                        [  started  ]
 one-dns                                          [  started  ]
 one-haproxy                                      [  started  ]
 kea-dhcp4                            [  started 00:12:34 (0) ]
 one-nat4                                         [  started  ]
 unbound                                          [  started  ]
 one-context-reconfigure                          [  started  ]
 one-router4                                      [  started  ]
 haproxy                                          [  started  ]
 one-context-reconfigure-delayed                  [  started  ]

To start/stop/restart a service:

$ rc-service <openrc-service> <start | stop | restart>

The list of OpenRC services implementing each of the virtual router features are describes in the table below:

OpenRC Service Type Runlevel Config Path (INPUT) Config Path (OUTPUT) Log Path
keepalived daemon default /etc/keepalived/ (dir) /var/log/messages
one-failover daemon default /run/one-context/one_env /var/log/one-appliance/one-failover.log
one-lvs daemon manual /run/one-context/one_env /etc/keepalived/conf.d/lvs.conf /var/log/one-appliance/one-lvs.log
one-router4 oneshot manual /run/one-context/one_env /etc/sysctl.d/98-Router4.conf /var/log/one-appliance/one-router4.log
iptables oneshot manual /etc/iptables/ (dir) /etc/iptables/ (dir) /var/log/messages
one-nat4 oneshot manual /run/one-context/one_env (iptables -t nat) /var/log/one-appliance/one-nat4.log
one-sdnat4 daemon manual /run/one-context/one_env (iptables -t nat) /var/log/one-appliance/one-sdnat4.log
haproxy daemon manual /etc/haproxy/ (dir) /var/log/messages
one-haproxy daemon manual /run/one-context/one_env /etc/haproxy/ (dir) /var/log/one-appliance/one-haproxy.log
unbound daemon manual /etc/unbound/ (dir) /var/log/unbound/ (dir)
one-dns daemon manual /run/one-context/one_env /etc/unbound/ (dir) /var/log/one-appliance/one-dns.log
kea-dhcp4 daemon manual /etc/kea/ (dir) /var/log/kea/ (dir)
one-dhcp4 daemon manual /run/one-context/one_env /etc/kea/ (dir) /var/log/one-appliance/one-dhcp4.log

Note

Services prefixed with one- have been designed to automatically manage their counterparts (if present), so for example stopping one-haproxy automatically stops the haproxy service as well, etc.

Contextualization

Each feature of the VR goes through three lifecycle steps:

Step Frequency Log Path Description
install once /var/log/one-appliance/install.log Install required software and render OpenRC scripts.
configure recurring /var/log/one-appliance/configure.log Render static configuration files.
bootstrap recurring /var/log/one-appliance/bootstrap.log No operation for VR.

Note

The install stage is executed during image build, only once.

Note

The configure and bootstrap stages are executed every time (re)contextualization happens, i.e. on occasions like: initial deployment, reboot, context modification, NIC attach, etc.

Note

During (re)contextualization the one-contextd daemon creates (among others) the /run/one-context/one_env file, which is then loaded for each of the OpenRC services as environment variables (configuration).

Clone this wiki locally