Skip to content

Commit

Permalink
Revert "chore: [NODE-1488] Fixup services (#1837)"
Browse files Browse the repository at this point in the history
This reverts commit dff73c6.
  • Loading branch information
NikolaMilosa committed Oct 31, 2024
1 parent c514a53 commit 51f6f4e
Show file tree
Hide file tree
Showing 20 changed files with 95 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Unit]
Description=Node Exporter
After=network.target
After=syslog.target network.target

[Service]
User=node_exporter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[Unit]
Description=Set up hostname
Before=systemd-networkd.target
DefaultDependencies=no
After=bootstrap-ic-node.service
Before=systemd-networkd.service
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[Unit]
Description=Set up hostname
Before=systemd-networkd.target
DefaultDependencies=no
Before=systemd-networkd.service
After=systemd-tmpfiles-setup.service
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[Unit]
Description=Set up hostname
Before=systemd-networkd.service
Before=systemd-networkd.target
DefaultDependencies=no
After=bootstrap-ic-node.service
Before=systemd-networkd.service

[Install]
WantedBy=multi-user.target
Expand Down
14 changes: 7 additions & 7 deletions ic-os/components/guestos.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ component_files = {
Label("ic/ic.json5.template"): "/opt/ic/share/ic.json5.template",

# init
Label("init/bootstrap-ic-node/bootstrap-ic-node.sh"): "/opt/ic/bin/bootstrap-ic-node.sh",
Label("init/bootstrap-ic-node/bootstrap-ic-node.service"): "/etc/systemd/system/bootstrap-ic-node.service",
Label("init/setup-encryption/setup-encryption.sh"): "/opt/ic/bin/setup-encryption.sh",
Label("init/setup-encryption/setup-encryption.service"): "/etc/systemd/system/setup-encryption.service",
Label("init/setup-encryption/setup-var-encryption.sh"): "/opt/ic/bin/setup-var-encryption.sh",
Label("init/bootstrap-ic-node/guestos/bootstrap-ic-node.sh"): "/opt/ic/bin/bootstrap-ic-node.sh",
Label("init/bootstrap-ic-node/guestos/bootstrap-ic-node.service"): "/etc/systemd/system/bootstrap-ic-node.service",
Label("init/setup-encryption/guestos/setup-encryption.sh"): "/opt/ic/bin/setup-encryption.sh",
Label("init/setup-encryption/guestos/setup-encryption.service"): "/etc/systemd/system/setup-encryption.service",
Label("init/setup-encryption/guestos/setup-var-encryption.sh"): "/opt/ic/bin/setup-var-encryption.sh",
Label("init/setup-lvs/setup-lvs.service"): "/etc/systemd/system/setup-lvs.service",
Label("init/setup-lvs/guestos/setup-lvs.sh"): "/opt/ic/bin/setup-lvs.sh",

# misc
Label("misc/logging.sh"): "/opt/ic/bin/logging.sh",
Label("misc/metrics.sh"): "/opt/ic/bin/metrics.sh",
Label("misc/serial-getty@/guestos/override.conf"): "/etc/systemd/system/serial-getty@.service.d/override.conf",
Label("misc/serial-getty@/guestos/serial-getty@.service"): "/etc/systemd/system/serial-getty@.service",
Label("misc/chrony/chrony.conf"): "/etc/chrony/chrony.conf",
Label("misc/chrony/chrony-var.service"): "/etc/systemd/system/chrony-var.service",
Label("misc/vsock/10-vhost-vsock.rules"): "/etc/udev/rules.d/10-vhost-vsock.rules",
Expand Down Expand Up @@ -90,7 +90,7 @@ component_files = {

# networking
Label("networking/generate-network-config/guestos/generate-network-config.service"): "/etc/systemd/system/generate-network-config.service",
Label("networking/retry-ipv6-config/retry-ipv6-config.sh"): "/opt/ic/bin/retry-ipv6-config.sh",
Label("networking/retry-ipv6-config/guestos/retry-ipv6-config.sh"): "/opt/ic/bin/retry-ipv6-config.sh",
Label("networking/retry-ipv6-config/retry-ipv6-config.service"): "/etc/systemd/system/retry-ipv6-config.service",
Label("networking/nftables/reload_nftables.path"): "/etc/systemd/system/reload_nftables.path",
Label("networking/nftables/reload_nftables.service"): "/etc/systemd/system/reload_nftables.service",
Expand Down
3 changes: 0 additions & 3 deletions ic-os/components/misc/serial-getty@/guestos/override.conf

This file was deleted.

35 changes: 35 additions & 0 deletions ic-os/components/misc/serial-getty@/guestos/serial-getty@.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Overwrite the default systemd serial getty service to
# run our own console getty.

[Unit]
Description=Serial Getty on %I
BindsTo=dev-%i.device
After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target
After=rc-local.service

# If additional gettys are spawned during boot then we should make
# sure that this is synchronized before getty.target, even though
# getty.target didn't actually pull it in.
Before=getty.target
IgnoreOnIsolate=yes

# IgnoreOnIsolate causes issues with sulogin, if someone isolates
# rescue.target or starts rescue.service from multi-user.target or
# graphical.target.
Conflicts=rescue.service
Before=rescue.service

[Service]
ExecStart=-/opt/ic/bin/infogetty -r /etc/allow_console_root /dev/%I
Type=idle
Restart=always
UtmpIdentifier=%I
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
KillMode=process
IgnoreSIGPIPE=no
SendSIGHUP=yes

[Install]
WantedBy=getty.target
3 changes: 0 additions & 3 deletions ic-os/components/misc/serial-getty@/setupos/override.conf

This file was deleted.

40 changes: 40 additions & 0 deletions ic-os/components/misc/serial-getty@/setupos/serial-getty@.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Overwrite the default systemd serial getty service to
# run our own console getty.

[Unit]
Description=Serial Getty on %I
Documentation=man:agetty(8) man:systemd-getty-generator(8)
Documentation=http://0pointer.de/blog/projects/serial-console.html
BindsTo=dev-%i.device
After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target
After=rc-local.service

# If additional gettys are spawned during boot then we should make
# sure that this is synchronized before getty.target, even though
# getty.target didn't actually pull it in.
Before=getty.target
IgnoreOnIsolate=yes

# IgnoreOnIsolate causes issues with sulogin, if someone isolates
# rescue.target or starts rescue.service from multi-user.target or
# graphical.target.
Conflicts=rescue.service
Before=rescue.service

[Service]
# The '-o' option value tells agetty to replace 'login' arguments with an
# option to preserve environment (-p), followed by '--' for safety, and then
# the entered username.
ExecStart=-/sbin/agetty -p -a root -o '-p -- \\u' --keep-baud 115200,38400,9600 %I $TERM
Type=idle
Restart=always
UtmpIdentifier=%I
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
KillMode=process
IgnoreSIGPIPE=no
SendSIGHUP=yes

[Install]
WantedBy=getty.target
1 change: 1 addition & 0 deletions ic-os/components/misc/vsock/vsock-agent.service
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[Unit]
Description=VSOCK agent daemon
After=syslog.target

[Service]
User=root
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Unit]
Description=Node Exporter
After=network.target
After=syslog.target network.target

[Service]
User=node_exporter
Expand Down
2 changes: 1 addition & 1 deletion ic-os/components/setupos.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ component_files = {
Label("misc/chrony/chrony.conf"): "/etc/chrony/chrony.conf",
Label("misc/chrony/chrony-var.service"): "/etc/systemd/system/chrony-var.service",
Label("misc/fetch-property.sh"): "/opt/ic/bin/fetch-property.sh",
Label("misc/serial-getty@/setupos/override.conf"): "/etc/systemd/system/serial-getty@.service.d/override.conf",
Label("misc/serial-getty@/setupos/serial-getty@.service"): "/etc/systemd/system/serial-getty@.service",
Label("monitoring/journald.conf"): "/etc/systemd/journald.conf",

# networking
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ DefaultDependencies=no
Requires=dev-mapper-store\x2dshared\x2d\x2ddata.device
After=dev-mapper-store\x2dshared\x2d\x2ddata.device
Before=systemd-fsck@dev-mapper-store\x2dshared\x2d\x2ddata.service
Before=var-lib-ic-data\x2dnode.mount
# Add an explicit sequencing to LVM setup. The observed problem is that the
# LV apparently becomes notified as "ready" through udev before the actual
# lvcreate command has finished. This results in filesystem setup racing with
Expand All @@ -14,6 +15,7 @@ Requires=setup-lvs.service

[Install]
RequiredBy=systemd-fsck@dev-mapper-store\x2dshared\x2d\x2ddata.service
RequiredBy=var-lib-ic-data\x2dnode.mount
WantedBy=local-fs.target

[Service]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ function make_var_cryptsetup() {
echo "Description=Cryptography Setup for var_crypt"
echo "DefaultDependencies=no"
echo "IgnoreOnIsolate=true"
echo "After=setup-encryption.service"
echo "After=cryptsetup-pre.target"
echo "Before=blockdev@dev-mapper-var_crypt.target"
echo "Wants=blockdev@dev-mapper-var_crypt.target"
Expand Down Expand Up @@ -98,5 +99,5 @@ make_requires localfs.target boot.mount
make_requires boot-efi.mount boot.mount
make_requires boot-grub.mount boot.mount

make_var_cryptsetup "$CURRENT_SYSTEM" >"$UNIT_DIR"/systemd-cryptsetup@var_crypt.service
make_requires dev-mapper-var_crypt.device systemd-cryptsetup@var_crypt.service
make_var_cryptsetup "$CURRENT_SYSTEM" >"$UNIT_DIR"/cryptsetup@var_crypt.service
make_requires dev-mapper-var_crypt.device cryptsetup@var_crypt.service

0 comments on commit 51f6f4e

Please sign in to comment.