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 "$?" +}