Files
ansible-role-eom/files/discourse-sso.rb
T
claudeandClaude Opus 5.5 e91586b968 Discourse: move from Bitnami chart to launcher-built image
The Bitnami chart and images stop at 3.5.0. Run Discourse 2026.10.0 from
an image built with the official launcher, on PostgreSQL 18, reusing the
existing uploads volume, Redis and secrets.

Update the Dex sign-in step for the new image paths, drop the removed
LDAP setting, and keep chat off now that it is bundled in core. The image
adds a real-IP rule so visitors are not all rate limited as the ingress.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:32:46 -05:00

46 lines
1.7 KiB
Ruby

# Idempotent: sign-in goes only through Dex (discourse-openid-connect),
# and the Sign Up button goes to the eom.dev membership site.
# Run with: RAILS_ENV=production bundle exec rails runner <this file>
SIGNUP_URL = "https://www.eom.dev/members"
# OIDC is the only login method left, so with auth_immediately the
# Log In button redirects straight to Dex. Accounts link by email.
SiteSetting.enable_local_logins = false
SiteSetting.auth_immediately = true
# New members sign up at www.eom.dev; Discourse must still create their
# account on first Dex login.
SiteSetting.allow_new_registrations = true
# Chat is bundled in core and on by default; this forum does not use it.
SiteSetting.chat_enabled = false
head_tag = <<~HTML
<script>
(function () {
var url = #{SIGNUP_URL.to_json};
if (location.pathname === "/signup") { location.replace(url); return; }
document.addEventListener("click", function (e) {
var b = e.target.closest(".sign-up-button, a[href='/signup']");
if (!b) return;
e.preventDefault();
e.stopImmediatePropagation();
location.href = url;
}, true);
})();
</script>
HTML
name = "eom.dev sign-up redirect"
component = Theme.find_by(name: name) ||
Theme.create!(name: name, user_id: Discourse.system_user.id, component: true)
component.set_field(target: :common, name: :head_tag, value: head_tag)
component.save!
Theme.where(component: false).find_each do |theme|
next if theme.child_themes.include?(component)
theme.add_relative_theme!(:child, component)
end
puts "enable_local_logins=#{SiteSetting.enable_local_logins} component=#{component.id} " \
"parents=#{component.parent_themes.pluck(:name).join(', ')}"