MVC multi-site media libraries sync to wrong folders

Mark Elliott asked on April 23, 2021 00:23

Hello,

We have a number of sites running in the same admin instance (on K12). The presentation sites are all separate of course. Noticing something very strange happening. When adding a file to the media library of one site when the UpdateMediaWebFarm task runs to sync the admin site with the presentation site - it will write the file to the media folder of a completely different site! I've checked the settings and everything seems normal.

Any ideas what might be happening?

Thanks

Correct Answer

Juraj Ondrus answered on April 29, 2021 11:18

Are all the web farm servers marked as healthy? What license keys for how many servers you have in the system? This sounds like a web farm sync issue where not all web farm servers are taking their tasks from the tasks list. Have you tried restarting all the apps in the web farm? What are the media library folder settings for each site in Content -> Media library?
Anyway, I would recommend considering using a shared folder/storage for the media library files and use site-specific subfolders.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Juraj Ondrus answered on April 23, 2021 13:54

What is the hotfix applied to the admin and what is the version of the NuGet packages used by the MVC apps? Are you using shared storage, blob or S3? What are the folder settings - are you using some folder for each site, are you using site-specific subfolders? Are you able to reproduce the issue on other Kentico instances?

0 votesVote for this answer Mark as a Correct answer

Mark Elliott answered on April 27, 2021 00:06

This is version 12.0.83 (with the corresponding NuGet packages 12.0.83) We, aren't using external storage, the files are on our local web server.

We didn't initially have any site specific sub-folders specified, thinking that might be the issue I gave it a site-specific folder, which it created under the other site (so it wrote the files to /SiteA/SiteB/media/site-specific-folder) Very strange!

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on April 27, 2021 07:34

Ahh OK I see what you mean. That the folders and files are also present in the other MVC project directory, right? If yes, then this is by design. In the Admin UI you see only the media libraries created for the site. However, e.g. when using the media selector form control, the editors can switch sites and use media from other sites too - this means that the media files have to be synchronized to all MVC projects too.
The recommended approach in this case is using shared storage - shared folder for MVC and Kentico apps. This way you can save some synchronization between the apps since the media files are always on disk, both apps can look into the same folder/storage.
If you need to have the sites totally separate, e.g. due to security reasons, different clients, then the correct approach is to use also separate Kentico admin apps for each site.

0 votesVote for this answer Mark as a Correct answer

Mark Elliott answered on April 27, 2021 16:35

Well, this is sort of what is happening but not exactly, the media files are synchronizing to one of the MVC project directories but not the others.

We have one admin instance and 5 MVC sites:

  • Site A has a Media Library and a media folder under the project tree
  • Site B has no Media Library and no media folder under its project tree
  • Site C has a Media Library and has media folders for both itself as well as sites B,D, and E
  • Site D has a Media Library and has a media folder under the project tree
  • Site E has a Media Library but does not have a media folder under the project tree, when a media file is uploaded it goes only to the folder under Site C

I checked the tasks on the Web Farm there is an error when a file is uploaded to Site E that it can't write the file to the media folder for Site B, which makes sense because there is no media folder for that site. There is no sign though that its even attempting to write to a media folder under Site E

0 votesVote for this answer Mark as a Correct answer

Mark Elliott answered on April 29, 2021 17:51

The web servers were healthy and the licenses looked ok. I changed the settings to use shared folder with site specific folders and everything seems to be working as expected now. Thanks!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.