From 231b2fb1b7537bac8c544e7f67a8f449c2b74179 Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Mon, 5 Oct 2026 12:47:42 +0200 Subject: [PATCH] discourse: serve stylesheets and repair the update (#17697) nginx passed X-Accel-Mapping on every request. Stylesheets are sent from tmp/, outside that mapping, so Rack redirected nginx to their filesystem path and the page loaded without CSS. Existing installs get the line removed on update. The update called yarn, which is not installed, ran Rails without the production environment or rbenv on PATH, asked for PostgreSQL 16 on a 17 install and left sidekiq running. --- ct/discourse.sh | 35 +++++++++++++++++++++-------------- install/discourse-install.sh | 1 - 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/ct/discourse.sh b/ct/discourse.sh index fc54dd65b..89ff57623 100644 --- a/ct/discourse.sh +++ b/ct/discourse.sh @@ -36,28 +36,35 @@ function update_script() { exit fi - msg_info "Stopping Service" - systemctl stop discourse - msg_ok "Stopped Service" + if grep -q 'X-Accel-Mapping' /etc/nginx/sites-available/discourse 2>/dev/null; then + msg_info "Fixing stylesheet delivery in Nginx" + sed -i '/X-Accel-Mapping/d' /etc/nginx/sites-available/discourse + $STD systemctl reload nginx + msg_ok "Fixed stylesheet delivery in Nginx" + fi - create_backup /opt/discourse/.env + msg_info "Stopping Services" + systemctl stop discourse discourse-sidekiq + msg_ok "Stopped Services" msg_info "Updating Discourse" - PG_VERSION="16" PG_MODULES="pgvector" setup_postgresql cd /opt/discourse - git pull origin main - $STD bundle install --deployment --without test development - $STD yarn install + export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH" + export COREPACK_ENABLE_DOWNLOAD_PROMPT=0 + set -a + source /opt/discourse/.env + set +a + $STD git pull origin main + $STD bundle install + $STD pnpm install $STD runuser -u postgres -- psql -d discourse -c "CREATE EXTENSION IF NOT EXISTS vector;" - $STD bundle exec rails assets:precompile $STD bundle exec rails db:migrate + $STD bundle exec rails assets:precompile msg_ok "Updated Discourse" - restore_backup - - msg_info "Starting Service" - systemctl start discourse - msg_ok "Started Service" + msg_info "Starting Services" + systemctl start discourse discourse-sidekiq + msg_ok "Started Services" msg_ok "Updated successfully!" exit } diff --git a/install/discourse-install.sh b/install/discourse-install.sh index 175ac7b1d..ac2687517 100644 --- a/install/discourse-install.sh +++ b/install/discourse-install.sh @@ -203,7 +203,6 @@ server { proxy_set_header X-Real-IP \$remote_addr; proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto \$scheme; - proxy_set_header X-Accel-Mapping /opt/discourse/public/=/downloads/; } } EOF