Exporting and re-importing site_settings breaks discourse in many ways

AI-generated summary

Users are experiencing issues when exporting and re-importing site_settings between Discourse environments, causing the site to fail to load. pama reports two methods: directly exporting the database table (which results in a 500 error after removing preview URIs) and using the rake site_settings:export and import commands (which triggers an infinite loading loop with net::ERR_CONNECTION_TIMED_OUT). Lilly shares a link to a relevant Meta Discourse thread for guidance. pfaffman questions whether this is a standard install and notes that direct DB manipulation is not recommended. They confirm the rake task works locally when run as rake site_settings:import < settings.yml, showing zero errors in their test. They also reference a third-party tool, discourse-settings-uploader, which may help but is less straightforward than the rake task. The issue may stem from version incompatibility or misconfiguration, as the error mentioned doesn’t appear in Discourse source code.

Hello! We are trying to export site_settings from a preview environment and import in production environment. Both ways we tried cause discourse to never load again:

  • exporting db table directly, removing what it seems contains preview uri results and reimporting throws a 500
  • rake site_settings:export and import results in an infinite loop trying to load content GET ... net::ERR_CONNECTION_TIMED_OUT

This may help you

You’d need more detail for this to be a bug report. Is this a standard install?

That’s not surprising, and not recommended.

I don’t see that error in Discourse source. Is this a recent version?

Did you run it something like this?

rake site_settings:import < settings.yml

Here’s what it looked like when I ran it and restored it on the same site:

root@monstera-stagingdashboard:/var/www/discourse# rake site_settings:export >/tmp/settings.yml
root@monstera-stagingdashboard:/var/www/discourse# rake site_settings:import </tmp/settings.yml

starting import...


Results:
 Updated:   0
 Not Found: 0
 Errors:    0

I changed a few settings and ran it again and it worked.

I think that still works, though it’s harder to make work than the rake task is supposed to be.