I migrated a 200,000-post forum to a new server. The live site was put in read-only mode so there wouldn’t be downtime.
I restored the backup on a different subdomain so that users wouldn’t see the install screens or any problems that might happen during the restore – something like dev.example.com
.
As soon as the restore was complete, I pointed the DNS as the new server and changed the app.yml
file’s domain to the normal forum.example.com
.
Then all the smilies in the based posts were pointing at the dev.example.com
server, so I ran rake:rebake
.
It gets through about 1,000-2,000 posts before crashing with errors about the database connection.
Here are a couple of excerpts:
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.4/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.4/lib/bundler/cli.rb:34:in `dispatch'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.4/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.4/lib/bundler/cli.rb:28:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.4/exe/bundle:45:in `block in <top (required)>'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.4/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.4/exe/bundle:33:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
1999 / 200968 ( 1.0%)
Failed to rebake (topic_id: 78730, post_id: 210607)
PG::ConnectionBad: PQsocket() can't get socket descriptor
/var/www/discourse/lib/tasks/posts.rake:108:in `rebake_posts_all_sites'
/var/www/discourse/lib/tasks/posts.rake:7:in `block in <main>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Caused by:
PG::ConnectionBad: PQsocket() can't get socket descriptor
At the moment, I have the images loading by redirecting the dev.example.com
domain to the forum.example.com
domain, but it’s just a temporary solution.
Does anyone know how to get past that error so I can rebake all the posts? Is it creating too much load on the database?