Restoring forum to a new server

For the various production services I run (WordPress sites, etc) I like to run a second, “mirror” site, as well as the production site. For example, I might have www.mydomain.com and also mirror.mydomain.com. The latter is created by cloning from the production site and then disabling a couple of processes that don’t need to run.

I’d like to do the same with my forum. As I understand, the restore function is “all in”, it restores not just the data (topics, etc) but also the entire configuration. That leaves me with two issues I’d like to understand better.

  1. I use WordPress SSO. After the restore is complete I want the mirror-forum.mydomain.com Discourse site to point to mirror.mydomain.com, as the logon source. How would I modify the mirrored forum site (catch 22 of course - after restore and logging on, the mirrored site would presumably point to the production site)?

  2. I want to be 100% sure that no eMails are sent from the mirrored forum site. Again, if I restore to the mirrored forum site then I assume all the scheduled tasks from the production site (sending digest emails to users, etc) will be scheduled, right? How can I avoid that? Is there a central location to turn off ALL eMails from that server?

How can I approach this?

Thank you.

1 Like

Have a look through Syncing Production to Staging

especially That sounds like a good approach

Here is a script we use to keep a staging site mirrored to production site.

#!/bin/bash
echo "cd /var/www/discourse"
cd /var/www/discourse

echo "/usr/local/bin/rake site_settings:export > /var/www/discourse/settings.yml"
/usr/local/bin/rake site_settings:export >  /var/www/discourse/settings.yml

echo "cd /var/www/discourse/public/backups/default"
cd /var/www/discourse/public/backups/default

echo "/usr/local/bin/discourse restore " $(ls -r | head -1)
/usr/local/bin/discourse restore $(ls -r | head -1)

echo "cd /var/www/discourse"
cd /var/www/discourse

echo "/usr/local/bin/rake site_settings:import <  /var/www/discourse/settings.yml"
/usr/local/bin/rake site_settings:import <  /var/www/discourse/settings.yml

It’s called from docker.

Example of calling a script from outside the discourse instance:

echo 'cd /var/www/discourse; RUBY_ENV=production rails r /var/www/discourse/script/import_scripts/wordpress-with-sabai-export.rb /var/www/discourse/script/import_scripts/wordpress-discourse-id-map.json' | docker exec -i $(docker ps | grep app | awk '{print $1}') /bin/bash

3 Likes

Set the mirrored site disable email setting to ‘yes’

https://{fully-qualiified-domain-name}/admin/site_settings/category/email?filter=disable%20email

1 Like

Yes, disable email from your site settings. Or you can set email to staff-only which is helpful sometimes.

2 Likes

Great stuff everyone. This looks like it gives me all I need. Thank you.

1 Like

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