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