Ability to "sync" post content between instances without overwriting settings/users

Hi there,

Not sure this is support although it could be – here’s my use case:

For my clients’ discourse installation I have two environments; staging and production. I have a synchronisation script for the website which syncs data from production to staging each night to keep staging as close to production as possible.

I would like to do the same for discourse, but as the forums are accessible from different hostnames with different admin settings I would only like to sync the post information (and users which aren’t already present in the database, but anonymising their user account (i.e. overwriting email/real name/etc fields on the sync so there’s no PII in the staging database – i don’t want to accidentally email real people from staging!)

Is this possible right now? The import/export looks to be a bit full featured for me – i.e. it’ll nuke and overwrite everything. Am I going to have to write a rake task on each and my own importer layer? :frowning:

You could setup mailcatcher on staging to address the accidentally emailing people issue.

I believe the only supported way currently to sync data is to use the import/export tool.

If you wanted something to just sync post data and new users you will probably need to write your own sync functionality using the discourse_api. Using the api you should be able to get all the new posts and users, but I don’t think there is a good way to bulk insert or modify the dates on insert to match production using the api.

You could also find the right tables in postgres and export and import those directly.

1 Like