From 9ce615d3d58eebe59dd7279ae5c7ccf9dcc73f82 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Thu, 19 Dec 2024 21:48:48 +0100 Subject: [PATCH 1/4] =?UTF-8?q?rel/=E2=80=A6/init.d/pleroma:=20tab=20inden?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rel/files/installation/init.d/pleroma | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rel/files/installation/init.d/pleroma b/rel/files/installation/init.d/pleroma index ca5b842e1..ed8a27830 100755 --- a/rel/files/installation/init.d/pleroma +++ b/rel/files/installation/init.d/pleroma @@ -17,6 +17,6 @@ retry="SIGTERM/30/SIGKILL/5" pidfile="/var/run/pleroma.pid" depend() { - want nginx - need postgresql + want nginx + need postgresql } From a1247220f35b5d42d2c33dfeacb3c0c0ebc8c279 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Thu, 19 Dec 2024 21:49:12 +0100 Subject: [PATCH 2/4] =?UTF-8?q?rel/=E2=80=A6/init.d/pleroma:=20set=20respa?= =?UTF-8?q?wn=5Fmax=20&=20respawn=5Fperiod?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rel/files/installation/init.d/pleroma | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rel/files/installation/init.d/pleroma b/rel/files/installation/init.d/pleroma index ed8a27830..4e3c20575 100755 --- a/rel/files/installation/init.d/pleroma +++ b/rel/files/installation/init.d/pleroma @@ -16,6 +16,10 @@ retry="SIGTERM/30/SIGKILL/5" pidfile="/var/run/pleroma.pid" +# Needs OpenRC >= 0.42 +respawn_max=200 +respawn_period=86400 # 1*day + depend() { want nginx need postgresql From 9bbeeeb428272873063d0eacd33112be09f4d6bd Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Thu, 19 Dec 2024 21:49:32 +0100 Subject: [PATCH 3/4] */init.d/pleroma: run migrations before starting --- changelog.d/opt-init.d-migrations.change | 1 + installation/init.d/pleroma | 6 ++++++ rel/files/installation/init.d/pleroma | 6 ++++++ 3 files changed, 13 insertions(+) create mode 100644 changelog.d/opt-init.d-migrations.change diff --git a/changelog.d/opt-init.d-migrations.change b/changelog.d/opt-init.d-migrations.change new file mode 100644 index 000000000..c53f2baa0 --- /dev/null +++ b/changelog.d/opt-init.d-migrations.change @@ -0,0 +1 @@ +- OpenRC: Automatically run migrations before starting pleroma diff --git a/installation/init.d/pleroma b/installation/init.d/pleroma index cb6635a0b..2cd366140 100755 --- a/installation/init.d/pleroma +++ b/installation/init.d/pleroma @@ -37,6 +37,12 @@ depend() { need nginx postgresql } +start_pre() { + ebegin "running migrations if any" + su -s /bin/sh -c '/usr/bin/mix ecto.migrate' -l "${command_user}" + eend "$?" +} + healthcheck() { # put pleroma_health=YES in /etc/conf.d/pleroma if you want healthchecking # and make sure you have curl installed diff --git a/rel/files/installation/init.d/pleroma b/rel/files/installation/init.d/pleroma index 4e3c20575..0e117e9b8 100755 --- a/rel/files/installation/init.d/pleroma +++ b/rel/files/installation/init.d/pleroma @@ -24,3 +24,9 @@ depend() { want nginx need postgresql } + +start_pre() { + ebegin "running migrations if any" + su -s /bin/sh -c '/opt/pleroma/bin/pleroma_ctl migrate' -l "${command_user}" + eend "$?" +} From 8943ab8140c4bb160b9e3d5df5ee8bb2c3410a41 Mon Sep 17 00:00:00 2001 From: Lain Soykaf Date: Wed, 29 Jul 2026 15:02:16 +0400 Subject: [PATCH 4/4] fix(openrc): preserve migration execution context --- installation/init.d/pleroma | 3 ++- rel/files/installation/init.d/pleroma | 7 ++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/installation/init.d/pleroma b/installation/init.d/pleroma index 2cd366140..3b584bd45 100755 --- a/installation/init.d/pleroma +++ b/installation/init.d/pleroma @@ -39,7 +39,8 @@ depend() { start_pre() { ebegin "running migrations if any" - su -s /bin/sh -c '/usr/bin/mix ecto.migrate' -l "${command_user}" + su -s /bin/sh -c "cd \"${directory}\" && exec /usr/bin/mix ecto.migrate" \ + "${command_user%%:*}" eend "$?" } diff --git a/rel/files/installation/init.d/pleroma b/rel/files/installation/init.d/pleroma index 0e117e9b8..2d3977e41 100755 --- a/rel/files/installation/init.d/pleroma +++ b/rel/files/installation/init.d/pleroma @@ -16,10 +16,6 @@ retry="SIGTERM/30/SIGKILL/5" pidfile="/var/run/pleroma.pid" -# Needs OpenRC >= 0.42 -respawn_max=200 -respawn_period=86400 # 1*day - depend() { want nginx need postgresql @@ -27,6 +23,7 @@ depend() { start_pre() { ebegin "running migrations if any" - su -s /bin/sh -c '/opt/pleroma/bin/pleroma_ctl migrate' -l "${command_user}" + su -s /bin/sh -c "cd \"${directory}\" && exec /opt/pleroma/bin/pleroma_ctl migrate" \ + "${command_user%%:*}" eend "$?" }