diff options
author | V3n3RiX <venerix@koprulu.sector> | 2023-10-14 00:19:02 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2023-10-14 00:19:02 +0100 |
commit | 333918aa838615aed27cb5f4b49b87269868deeb (patch) | |
tree | 9781ce1626081e4dd17db9dd1cde49b9f89f194b /app-containers/incus/files | |
parent | b8330d80ce605a72596ccfa1bfc087b9ded559b8 (diff) |
gentoo auto-resync : 14:10:2023 - 00:19:01
Diffstat (limited to 'app-containers/incus/files')
-rw-r--r-- | app-containers/incus/files/incus-0.1.confd | 23 | ||||
-rw-r--r-- | app-containers/incus/files/incus-0.1.initd | 59 | ||||
-rw-r--r-- | app-containers/incus/files/incus-0.1.service | 23 | ||||
-rw-r--r-- | app-containers/incus/files/incus-0.1.socket | 12 | ||||
-rw-r--r-- | app-containers/incus/files/incus-containers-0.1.service | 16 |
5 files changed, 133 insertions, 0 deletions
diff --git a/app-containers/incus/files/incus-0.1.confd b/app-containers/incus/files/incus-0.1.confd new file mode 100644 index 000000000000..ec857143c2da --- /dev/null +++ b/app-containers/incus/files/incus-0.1.confd @@ -0,0 +1,23 @@ +# Group which owns the shared socket +INCUS_OPTIONS+=" --group incus" + +# Enable cpu profiling into the specified file +#INCUS_OPTIONS+=" --cpuprofile /tmp/lxc_cpu_profile" + +# Enable memory profiling into the specified file +#INCUS_OPTIONS+=" --memprofile /tmp/lxc_mem_profile" + +# Enable debug mode +#INCUS_OPTIONS+=" --debug" + +# For debugging, print a complete stack trace every n seconds +#INCUS_OPTIONS+=" --print-goroutines-every 5" + +# Enable verbose mode +#INCUS_OPTIONS+=" -v" + +# Logfile to log to +#INCUS_OPTIONS+=" --logfile /var/log/incus/incus.log" + +# Enable syslog logging +#INCUS_OPTIONS+=" --syslog" diff --git a/app-containers/incus/files/incus-0.1.initd b/app-containers/incus/files/incus-0.1.initd new file mode 100644 index 000000000000..d09ffe224d04 --- /dev/null +++ b/app-containers/incus/files/incus-0.1.initd @@ -0,0 +1,59 @@ +#!/sbin/openrc-run +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +DAEMON=/usr/sbin/incusd +PIDFILE=/run/incusd.pid + +depend() { + need net + need lxcfs +} + +start() { + ebegin "Starting incus service" + + modprobe -f loop > /dev/null 2>&1 + + # Fix permissions on /var/lib/incus and make sure it exists. + # Create a log directory for incus with correct permissions. + install -d /var/lib/incus --group incus --owner root --mode 0775 + install -d /var/log/incus --group incus --owner root + + start-stop-daemon --start \ + --pidfile ${PIDFILE} \ + --exec ${DAEMON} \ + --background \ + --make-pidfile \ + -- \ + ${INCUS_OPTIONS} + eend ${?} + + # Create necessary systemd paths in order for systemd containers to work on openrc host. + # /etc/rc.conf should have following values: + # rc_cgroup_mode="hybrid" + if [ -d /sys/fs/cgroup/unified ] && + [ ! -d /sys/fs/cgroup/systemd ]; then + install -d /sys/fs/cgroup/systemd --group incus --owner root + mount -t cgroup -o none,name=systemd systemd /sys/fs/cgroup/systemd + fi +} + +stop() { + if [ "${RC_CMD}" = restart ]; then + ebegin "Stopping incusd service (but not containers)" + # start-stop-daemon sends SIGTERM with a timeout of 5s by default. + # SIGTERM indicates to INCUS that it will be stopped temporarily. + # Instances will keep running. + start-stop-daemon --stop --quiet -p "${PIDFILE}" + eend ${?} + else + ebegin "Stopping incusd service and containers, waiting 40s" + # SIGPWR indicates to INCUS that the host is going down. + # LXD will do a clean shutdown of all instances. + # After 30s all remaining instances will be killed. + # We wait up to 40s for INCUS. + start-stop-daemon --stop --quiet -R SIGPWR/40 -p "${PIDFILE}" + eend ${?} + fi +} diff --git a/app-containers/incus/files/incus-0.1.service b/app-containers/incus/files/incus-0.1.service new file mode 100644 index 000000000000..354a53122923 --- /dev/null +++ b/app-containers/incus/files/incus-0.1.service @@ -0,0 +1,23 @@ +[Unit] +Description=Incus - main daemon +After=network-online.target lxcfs.service incus.socket +Requires=network-online.target lxcfs.service incus.socket +Documentation=man:incus(1) + +[Service] +EnvironmentFile=-/etc/environment +ExecStart=/usr/sbin/incusd --group incus --syslog +ExecStartPost=/usr/sbin/incusd waitready --timeout=600 +ExecStartPre=/bin/mkdir -p /var/log/incus +ExecStartPre=/bin/chown -R root:incus /var/log/incus +KillMode=process +PermissionsStartOnly=true +TimeoutStartSec=600s +TimeoutStopSec=30s +Restart=on-failure +LimitNOFILE=1048576 +LimitNPROC=infinity +TasksMax=infinity + +[Install] +Also=incus-containers.service incus.socket diff --git a/app-containers/incus/files/incus-0.1.socket b/app-containers/incus/files/incus-0.1.socket new file mode 100644 index 000000000000..864ebf19954e --- /dev/null +++ b/app-containers/incus/files/incus-0.1.socket @@ -0,0 +1,12 @@ +[Unit] +Description=incus - unix socket +Documentation=man:incus(1) + +[Socket] +ListenStream=/var/lib/incus/unix.socket +SocketGroup=incus +SocketMode=0660 +Service=incus.service + +[Install] +WantedBy=sockets.target diff --git a/app-containers/incus/files/incus-containers-0.1.service b/app-containers/incus/files/incus-containers-0.1.service new file mode 100644 index 000000000000..038d633a53d7 --- /dev/null +++ b/app-containers/incus/files/incus-containers-0.1.service @@ -0,0 +1,16 @@ +[Unit] +Description=incus - container startup/shutdown +Documentation=man:incus(1) +After=incus.socket incus.service +Requires=incus.socket + +[Service] +Type=oneshot +ExecStart=/usr/sbin/incusd activateifneeded +ExecStop=/usr/sbin/incusd shutdown +TimeoutStartSec=600s +TimeoutStopSec=600s +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target |