Metakgp talk:SysAdmin/2018-03-12 Migration of the droplet from FRA1 region to BLR region

From Metakgp Wiki
Jump to navigation Jump to search

Backup/restore images[edit source]

You don't need to do a batch upload of images, you can directly copy /srv/static/images (then checkImages should succeed). This is mounted on the static volume so it should persist across container lifetimes. Amrav (talk) 18:34, 10 September 2018 (IST)


Actually, we have discussed this before on Metakgp Slack. here and here. The images are stored inside /srv/static/images inside folders like this: "a/a0/image.jpg". These paths change when we changed the wiki servers. So, now putting the old images back where they were originally doesn't work. But uploading them anew works!

I will try this again with a couple images tomorrow (i.e. create a droplet from the old snapshot, put an image where it is in the old droplet), just to be sure.

Although wasteful, the batch upload method seems cleaner to me. It allows Mediawiki to re-generate new thumbnails and images of various sizes. (When we upload a large image, mediawiki resizes it to various, probably for different screen sizes.) Since we will not be moving servers often, it seems like a decent trade-off that has very small overhead. (Currently, we have 19 MB of images and PDFs)

You might already know this but I discovered while working on this patch that the images are not just stored in /srv/static/images, instead the original images are inside /srv/static/images/images and the top folder, /srv/static/images, is where the original image along with all it's resized versions are stored. Apart from this, there are also two other folders temp/ and cache/.

-- Icyflame (talk) 20:29, 10 September 2018 (IST)


Hmm interesting. The subdirectory structure is just supposed to correspond to the hash of the image - so for example if the hash is 012345, the image will be under 0/01. This is so that even you have thousands or millions of files, they're not all in the same subdirectory and this makes lookup faster. But it should also mean that the directory structure doesn't change (not sure about thumbnails), and I'm not sure why the database wouldn't still have image info, since we're using mysqldump. Worth checking out! -- Amrav (talk) 15:08, 12 September 2018 (IST)