What do I do after a restore without thumbnails? (missing images, avatars)

Due to disk space constraints, I had to do a backup and restore without thumbnails. The process went very smoothly. I was nervous, but everything worked perfectly and the whole procedure was very painless. The Discourse team did a great job at making that task easy.

Now, as expected, I have lots of missing images, and also unexpectedly, missing avatars. Searching has led me to a lot of conflicting information. Some posts say I need to rebake everything, with many different ways to go about it. Others say Sidekiq will do this automatically. There doesn’t seem to be a current definitive answer to this I can find. Triggering Sidekiq tasks doesn’t seem to do much, and the Rails console doesn’t even recognize ‘rebake’.

Not sure what to do. Something? Nothing? I’m lost.

3 Likes

Avatars and thumbnails will be regenerated by background jobs.

Avatars will be generated shortly after the restore. You should see a lot of “create_avatar_thumbnails” jobs in Sidekiq unless that’s already finished.

Generating thumbnails for images will take a lot longer, because that happens in batches over a long period of time. You can speed it up by running a rake task:

cd /var/discourse
./launcher enter app

rake posts:rebake_uncooked_posts
9 Likes

Thanks! Is it to be expected that new posts and avatar uploads will behave unexpectedly during this transition? Some post images and embeds will now show up immediately while others do not, and there doesn’t seem to be much rhyme or reason as to what will work.

For example, this image will not display in a new post I just made on my forum:

But this one will:
eureka-Z

The reason are image dimensions. The first picture requires thumbnails, the second doesn’t. Generating of thumbnails for new posts might be delayed if your server is currently fully utilized by regenerating old thumbnails and avatars. You can take a look at the Sidekiq queue in order to see what’s going on.

6 Likes

Is there an equivalent for rake posts:rebake for restoring avatars? That is what I ended up having to do to fix post images, but most avatars are still missing. I have tried triggering CreateMissingAvatars in Sidekiq and it runs for 5-10 seconds, but nothing changes.

My issues seem nearly identical to the ones in this topic, which unfortunately doesn’t seem to have a solution.

The command to force restoration of all missing thumbnails and optimized image sizes for posts, avatars, etc is:

rake uploads:regenerate_missing_optimized

If you have a lot of images this may take a very long time. On a 4 CPU system with 8GB it took 32 hours to regenerate all images for a forum with 29GB of original uploads.

Hi! Should there be a Sidekiq task showing up regarding this? I’ve reinstalled my forum. Avatars have been restored, but image thumbnails are missing and there is currently no Sidekiq task running or in queue.

It’s the PeriodicalUpdates job. You can find it at /sidekiq/scheduler

3 Likes