Rebake all posts?

I’ve installed spoiler alert plugin. It works correctly. But old post doesn’t work spoiler tag.

If you change this, you must rebake all posts with: rake posts:rebake.

How can do that? When i ./launcher enter app rake is not installed!

I’ve 300k post. Even if I did, the process may take a long time. Is there a way to do it in a short way?

2 Likes

Either one of these should work

./launcher enter app
rake posts:rebake

or

cd /var/discourse
./launcher enter app
bundle exec rake posts:rebake
11 Likes

I applied that commands and after close terminal but it seems working now on the terminal with htop command.

bin/rake posts:rebake

But the server is high load because of that. There 300.000 post. I think it will take a long time. When this is done, spoiler tag for old post work correctly, right?

How can i cancel that rake process. Server is high cpu load because of that.

So, the rake task finished and put lots of rebake jobs into Sidekiq and now your server is on :fire:?

Hmm, I guess, you could stop all tasks by flushing redis. :bomb:
:warning: You may loose some other background jobs in the process!

cd /var/discourse
./launcher enter app
redis-cli flushall

After that, take a look at the following topic. It should allow you to rebake only posts that contain the spoiler tag.

4 Likes

I applied actions.

Output:

OK

Anyway, bin/rake posts:rebake process still looks terminal and high cpu load continues.

Well, then kill the rake process.

1 Like

I killed process. Server load down 5+ to 1.6 but CPU running still %70+.

How should it be rebake posts matching pattern for containing tags?

Try flushing redis again.

Something like rake posts:rebake_match["\[spoiler]"] should work. You’ll have to try it out yourself…
Read the post about rebaking I linked above. The documentation is really good!

2 Likes

This process has high cpu usage. %50,%90

postgres 9.5/main: discourse discourse [local] SELECT

What does it do?

After restoring Discourse on a new host, I found some old topic images are not showing

But it appears in two case

  • When I click on it to see full size
  • When I rebuild HTML of that topic

If I do below command

cd /var/discourse
./launcher enter app
rake posts:rebake

Is it same as rebuilding? :thinking:
Yesterday, I tried it was taking so long time, so I stopped it in half-way.

Thanks & Regards,
Gulshan

2 Likes

If the URL to your site changed, yes, it’s a good idea to rebake.

5 Likes

Site URL is same as before. The original goal was to moving Discourse existing forum to another hosting.

The include thumbnails in backups site setting lets you configure if backups should include thumbnails or not. The setting defaults to off and leads to smaller backups. When you restore such a backup you will see the following message in the log:

Posts will be rebaked by a background job in sidekiq. You will see missing images until that has completed.
You can expedite the process by manually running rake posts:rebake_uncooked_posts

5 Likes

Thanks for the head up. Actually, I was surprised my original disk usage was near 34GB out of 40GB. but I was getting backup file of only 2GB. I have enabled this settings now, and I will take backup again and then I will proceed to restore.

  1. I enabled include thumbnails in backups
  2. Created backup at S3
  3. Installed Discourse
  4. Download backup at default folder location using wget command
  5. Restored site. Every posts are showing even many images also, but few of them are broken.

Rebuild HTML is not fixing the problem, just make that area little larger than before. Ref: screenshot


(Clicking on image doesn’t show me full size image)

8tAkwFf30m

Not sure, if this will fix. :frowning:

On 8 vCPUs, 52 GB memory, the rebake process is quite slow. Is there any alternative fix?

1 Like