Switch to alembic migrations and pitchfork
Replace calls to `flask db upgrade` with `alembic upgrade head` in SimpleLogin install and update scripts so migrations are executed via Alembic in the virtualenv. For Discourse, remove in-place puma.rb sed tweaks (socket bind and stdout redirect) and update the systemd ExecStart to run `pitchfork -c config/pitchfork.conf.rb` instead of invoking puma directly, using Discourse's recommended process manager.
This commit is contained in:
@@ -53,7 +53,7 @@ function update_script() {
|
||||
msg_info "Running Database Migrations"
|
||||
cd /opt/simplelogin
|
||||
cp /opt/simplelogin_env.bak /opt/simplelogin/.env
|
||||
$STD .venv/bin/flask db upgrade
|
||||
$STD .venv/bin/alembic upgrade head
|
||||
msg_ok "Ran Database Migrations"
|
||||
|
||||
msg_info "Restoring Data"
|
||||
|
||||
@@ -65,8 +65,6 @@ APP_ROOT=/opt/discourse
|
||||
EOF
|
||||
|
||||
mkdir -p /opt/discourse/tmp/sockets /opt/discourse/tmp/pids /opt/discourse/log
|
||||
sed -i 's|bind "unix://#{APP_ROOT}/tmp/sockets/puma.sock"|bind "tcp://127.0.0.1:3000"|' /opt/discourse/config/puma.rb
|
||||
sed -i 's|stdout_redirect.*|# logging handled by systemd|' /opt/discourse/config/puma.rb
|
||||
chown -R root:root /opt/discourse
|
||||
chmod 755 /opt/discourse
|
||||
msg_ok "Configured Discourse"
|
||||
@@ -119,7 +117,7 @@ User=root
|
||||
WorkingDirectory=/opt/discourse
|
||||
EnvironmentFile=/opt/discourse/.env
|
||||
Environment=PATH=/root/.rbenv/shims:/root/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
ExecStart=/root/.rbenv/shims/bundle exec puma -w 2
|
||||
ExecStart=/root/.rbenv/shims/bundle exec pitchfork -c config/pitchfork.conf.rb
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ export NAMESERVERS="1.1.1.1"
|
||||
export MEM_STORE_URI="redis://localhost:6379/1"
|
||||
export OPENID_PRIVATE_KEY_PATH="/opt/simplelogin/openid-rsa.key"
|
||||
export OPENID_PUBLIC_KEY_PATH="/opt/simplelogin/openid-rsa.pub"
|
||||
$STD .venv/bin/flask db upgrade
|
||||
$STD .venv/bin/alembic upgrade head
|
||||
$STD .venv/bin/python init_app.py
|
||||
msg_ok "Configured SimpleLogin"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user