make root cgroup.procs writable

This commit is contained in:
Heikki Linnakangas
2025-02-10 22:28:53 +02:00
parent 5cb17cb384
commit 4fb9bc4b01
3 changed files with 33 additions and 1 deletions

View File

@@ -2043,7 +2043,9 @@ RUN systemctl enable \
postgres_exporter sql_exporter sql_exporter-autoscaling \
local_proxy \
compute_ctl \
chown-pgdata
chown-pgdata \
make-cgroup-procs-writable \
load-cgconfig.service
ENTRYPOINT ["/sbin/init"]

View File

@@ -0,0 +1,10 @@
[Unit]
Description=Create neonvm-postgres cgroup
[Service]
Type=oneshot
ExecStart=cgconfigparser -l /etc/cgconfig.conf
RemainAfterExit=yes
[Install]
WantedBy=compute_ctl.service

View File

@@ -0,0 +1,20 @@
# Allow all users to move processes to/from the root cgroup.
#
# This is required in order to be able to 'cgexec' anything, if the entrypoint is not being run as
# root, because moving tasks between one cgroup and another *requires write access to the
# cgroup.procs file of the common ancestor*, and because the entrypoint isn't already in a cgroup,
# any new tasks are automatically placed in the top-level cgroup.
#
# This *would* be bad for security, if we relied on cgroups for security; but instead because they
# are just used for cooperative signaling, this should be mostly ok.
[Unit]
Description=Allow all users to move processes to/from the root cgroup.
[Service]
Type=oneshot
ExecStart=chmod go+w /sys/fs/cgroup/cgroup.procs
RemainAfterExit=yes
[Install]
WantedBy=compute_ctl.service