How to make an imported site not accessible for existing users, but only staff and services like CDN that need to be configured?

Context: I’m importing a vBulletin forum to Discourse.

I’d like to configure stuff like CDN, remote backups, etc before letting existing users access the forum content.
I’d prefer not to set the forum as a read-only mode as it will be frustrating for the users to, after a few months, finally see the content again (and updated!) but not to be able to interact with. In this context, if the content is available, then it should be interactable too.

So basically I’d need Discourse to be available for staff, but display a “maintenance” page for other users, even if they are theoretically able to log in, and stillbe able to have my website communicate with services like CDN so I can configure them properly.

What’s the easiest way to do so?

4 Likes

AFAIK the simplest way is to make the site login required, turn on must approve users and aim SMTP at something like mailhog. I don’t recall if the importer approves users automatically, if it does you can do something like this in the rails console:

approved_users = AdminUserIndexQuery.new(query: 'approved', stats: false).find_users_query

approved_users.each do |u|
  u.approved = false
  u.save!
end

And then turn off approval when you’re good to go.

That way you won’t send any messages publicly during the migration, and can see all of the messages that Discourse has generated in case something goes awry.

Unless you choose to migrate passwords, users will be resetting their credentials anyhow.

3 Likes

Thank you for the reply!

After thinking about it for a while, what I think I’ll do is simply having this page:

But hide the login buttons temporarily, as well a replacing the sentence by something like “Under construction. Stay tuned!”

Users who’ll try to log in from /login won’t be able anyway since the password import didn’t work and the emails for non-staff are disabled, so they won’t be able to log in with email or reset their password as well.

I guess this solution can achieve what I need, right?

I would recommend mailhog or a similar solution just so you can be sure discourse isn’t generating piles of notification emails.

Without visibility you’re just risking opening the floodgates by re-enabling email.

1 Like

Can I see the pending emails somewhere?

Sure, that’s what mailhog does. It accepts messages, shows the queue and gives you the option to release emails to mailboxes.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.