After migrating their Discourse forum from staging.example.com to forum.example.com, Mark_Schmucker encountered broken internal links pointing to the old staging URL. Despite verifying app.yml and settings, links remained broken. Remah suggested following the official domain change guide, including running discourse remap and rake posts:rebakeas documented. Mark_Schmucker attempted the remap but encountered a PostgreSQL unique constraint error on a specific post link: duplicate key value violates unique constraint "unique_post_links"at post 6. The error persisted on retry. michaeld theorized the post contained both old and new URLs, suggesting manual cleanup. After editing a few posts, Mark_Schmucker successfully completed the remap, but the rake posts:rebake job failed at 30%, froze the system, and required a reboot. Post-reboot, a Ruby process consumed 60% CPU — michaeld clarified this was likely Sidekiq processing rebakes, advising to check /sidekiq to monitor progress. The issue remains partially unresolved, with the rebake job needing to complete to fully fix all links.
Many of our intra-forum links are broken after moving to a new server. I had created the new server at a temporary url staging.example.com to help with the transition, but now that the transition is complete, many links at forum.example.com still point to staging.example.com (which no longer exists).
> /var/www/discourse# discourse remap staging.example.com forum.example.com
> Rewriting all occurences of staging.example.com to forum.example.com
> THIS TASK WILL REWRITE DATA, ARE YOU SURE (type YES)
> YES
> Error: ERROR: duplicate key value violates unique constraint "unique_post_links"
> DETAIL: Key (topic_id, post_id, url)=(8718, 57455, https://forum.example.com/t/exampletopic/4606/336) already exists.
> The remap has only been partially applied due to the error above. Please re-run the script again.
I re-ran it as instructed and got the same error, on the same (topic_id, post_id, url) key.
I can get to the rails console and run some SQL/ActiveRecord if you can tell me what to run. Or Data Explorer.
I cleaned up a few posts and was able to complete the remap. However the rebake ran to 30% then encountered errors and hung the system and I had to reboot. System has adequate memory and disk space.
Question: After reboot, in ‘top’, there is a ruby process using 60% CPU. Is that the rake job? Would it resume after reboot?