Logo upload is not working after restore from backup

AI-generated summary

The discussion revolves around the issue of logo upload not working after restoring a Discourse instance from a backup. aksiksi encountered the problem and initially thought it was an intermittent issue, but it persisted.

After investigation, aksiksi discovered that the issue was due to most images not being correctly restored from the backup during the restore operation. The solution involved manually extracting the tarball and copying over the missing images into the Discourse uploads directory.

The analysis revealed that the image upload seemed to work fine, but the subsequent GET request to display the uploaded image resulted in a 404 error due to the image not being present in the uploads directory. The backup tarball contained the images, but they were not copied over correctly during the restore operation.

I created a new Discourse instance on a different domain and restored it from backup. Everything went through smoothly. However, none of the logos appeared (all blank, not default). So, I went ahead and used the Branding menu to try to re-upload the logos.

Here is the Discourse log from uploading a new logo:

New : /uploads/default/original/1X/75a192f211147f512bdddabaf50addd43c6a9d86.png
Previous : /images/discourse-logo-sketch.png

But, when I check my uploads directory, that particular image does not exist:

/var/discourse# tree shared/standalone/uploads/default/ | grep 75a1

Note that this incorrect logo filename (hash?) matches the one from the original Discord instance which is still online:

New : /uploads/default/original/1X/75a192f211147f512bdddabaf50addd43c6a9d86.png

Any clue what went wrong here? Should I create a new instance and restore that from a fresh backup?

Thanks.

We need to know more about your environment to be able to help here.

  • How was the new instance installed?
  • Is it behind a reverse proxy, or CloudFlare?

Hey Stephen,

  1. It was installed using the standalone discourse-setup script.
  2. No reverse proxy or CDN is involved.

Just an update on this. I ended up creating a new instance today and the logos were restored fine from backup. It was probably some kind of intermittent issue.

Scratch that, I’ve hit the issue again… So, the logo images worked fine until I cleared my browser cache.

Solution

The root cause was that most of the images were not correctly restored from the backup during the restore operation. I was able to solve the issue by manually extracting the tarball and copying over the missing images into the Discourse uploads directory.

Analysis

When I try to upload a new logo, I see the following:

  1. Image upload seems to work fine:

  1. But then the subsequent GET to display the uploaded image hits a 404:

  1. The image is not present in the uploads directory:
/var/discourse# tree shared/standalone/uploads/default/original/
shared/standalone/uploads/default/original/
`-- 1X
    |-- 52b3aff4e63a7e38bef42d469bafd1ed7c1cc1a2.png
    `-- e952cfd4c1bc58e77024e4c2b518531356319780.png

Here is what the backup tarball contains:

/tmp# tar tvzf ask-tunisians-2020-07-28-042934-v20200728004302.tar.gz 
-rw-r--r-- discourse/www-data 11767008 2020-07-28 04:29 dump.sql.gz
drwxr-xr-x discourse/www-data        0 2020-07-26 21:11 var/www/discourse/public/uploads/default/
drwxr-xr-x discourse/www-data        0 2020-07-26 21:11 var/www/discourse/public/uploads/default/original/
drwxr-xr-x discourse/www-data        0 2020-07-27 20:33 var/www/discourse/public/uploads/default/original/1X/
-rw-r--r-- discourse/www-data    14843 2020-07-26 21:56 var/www/discourse/public/uploads/default/original/1X/7835873085d7323b640c2504cd737b51f370360f.png
-rw-r--r-- discourse/www-data     9039 2020-07-27 20:33 var/www/discourse/public/uploads/default/original/1X/75a192f211147f512bdddabaf50addd43c6a9d86.png
-rw-r--r-- discourse/www-data     5783 2020-07-26 21:56 var/www/discourse/public/uploads/default/original/1X/19629775936660ecc73235158b4d68b9ec4b2abe.png
-rw-r--r-- discourse/www-data    11124 2020-07-26 21:11 var/www/discourse/public/uploads/default/original/1X/e952cfd4c1bc58e77024e4c2b518531356319780.png
-rw-r--r-- discourse/www-data    35570 2020-07-26 21:11 var/www/discourse/public/uploads/default/original/1X/52b3aff4e63a7e38bef42d469bafd1ed7c1cc1a2.png
-rw-r--r-- discourse/www-data     2375 2020-07-26 21:56 var/www/discourse/public/uploads/default/original/1X/d4af3550a7c3f857c974b996257c8e3db72e7850.png
-rw-r--r-- discourse/www-data     9759 2020-07-26 22:14 var/www/discourse/public/uploads/default/original/1X/dfc47da4c22ffeddf59f736a46a2c50ee55d7fa1.png
-rw-r--r-- discourse/www-data    24898 2020-07-26 21:46 var/www/discourse/public/uploads/default/original/1X/d832b24f2cb338139984be98045d22e0af093c4a.png

Clearly, the images were there, but I suppose the question is: why were most of the images not copied over correctly as part of the restore operation?