diff --git a/compute/compute-node.Dockerfile b/compute/compute-node.Dockerfile index cfb3f0dae3..bdb9e0ed7f 100644 --- a/compute/compute-node.Dockerfile +++ b/compute/compute-node.Dockerfile @@ -1991,7 +1991,8 @@ RUN systemctl enable \ pgbouncer \ postgres_exporter sql_exporter sql_exporter-autoscaling \ local_proxy \ - compute_ctl + compute_ctl \ + chown-pgdata ENTRYPOINT ["/sbin/init"] diff --git a/compute/etc/systemd/system/chown-pgdata.service b/compute/etc/systemd/system/chown-pgdata.service new file mode 100644 index 0000000000..5483a06bd5 --- /dev/null +++ b/compute/etc/systemd/system/chown-pgdata.service @@ -0,0 +1,12 @@ +# When running under neonvm-guest a separate disk is mounted to +# /var/db/postgres/compute. Make it owned by the postgres user. +[Unit] +Description=Change owner of /var/db/postgres/compute to postgres + +[Service] +Type=oneshot +ExecStart=chown postgres:postgres /var/db/postgres/compute +RemainAfterExit=yes + +[Install] +WantedBy=compute_ctl.service