diff --git a/src/freedombone-app-pleroma b/src/freedombone-app-pleroma index 515c3ea9..e3f54291 100755 --- a/src/freedombone-app-pleroma +++ b/src/freedombone-app-pleroma @@ -227,11 +227,12 @@ function pleroma_create_database { echo $"Missing directory $PLEROMA_DIR/config" exit 7835393 fi - pleroma_secret=$PLEROMA_DIR/config/dev.secret.exs + pleroma_secret=$PLEROMA_DIR/config/prod.secret.exs if [ ! -f $PLEROMA_DIR/config/dev.exs ]; then echo $"Did not find $PLEROMA_DIR/config/dev.exs" exit 78923528 fi + cp $PLEROMA_DIR/config/dev.exs $pleroma_secret sed -i "s|username:.*|username: \"pleroma\",|g" $pleroma_secret sed -i "s|password:.*|password: \"$PLEROMA_ADMIN_PASSWORD\",|g" $pleroma_secret @@ -272,13 +273,20 @@ function pleroma_create_database { echo $'mix ecto.create failed' exit 83653582 fi - sudo -u pleroma mix ecto.migrate --force + sudo -u pleroma MIX_ENV=prod mix ecto.migrate --force if [ ! "$?" = "0" ]; then run_system_query_postgresql "ALTER USER pleroma NOSUPERUSER;" run_system_query_postgresql "ALTER USER pleroma NOCREATEDB;" echo $'mix ecto.migrate failed' exit 73752573 fi + sudo -u pleroma MIX_ENV=prod mix phx.digest --force + if [ ! "$?" = "0" ]; then + run_system_query_postgresql "ALTER USER pleroma NOSUPERUSER;" + run_system_query_postgresql "ALTER USER pleroma NOCREATEDB;" + echo $'mix phx.digest failed' + exit 783529235 + fi # revoke the ability to create databases for this user run_system_query_postgresql "ALTER USER pleroma NOSUPERUSER;" @@ -878,7 +886,7 @@ function install_pleroma { # We need to set up the url option again because it somehow gets # lost during mix compile - pleroma_secret=$PLEROMA_DIR/config/dev.secret.exs + pleroma_secret=$PLEROMA_DIR/config/prod.secret.exs if ! grep -q 'watchers: [],' $pleroma_secret; then sed -i 's|watchers: []|watchers: [],|g' $pleroma_secret fi @@ -899,6 +907,7 @@ function install_pleroma { echo 'User=pleroma' >> /etc/systemd/system/pleroma.service echo "WorkingDirectory=$PLEROMA_DIR" >> /etc/systemd/system/pleroma.service echo "Environment=\"HOME=$PLEROMA_DIR\"" >> /etc/systemd/system/pleroma.service + echo "Environment=\"MIX_ENV=prod\"" >> /etc/systemd/system/pleroma.service echo 'ExecStart=/usr/local/bin/mix phx.server' >> /etc/systemd/system/pleroma.service echo 'ExecReload=/bin/kill $MAINPID' >> /etc/systemd/system/pleroma.service echo 'KillMode=process' >> /etc/systemd/system/pleroma.service