I am curious though what would be the goal of something like this? Do you want to distribute load? I mean do you want the images in the frontend of the website also to be loaded from that other server? Or do you just want to make a backup of the media folder?
At codegarden 07 Niels built an FTP datatype. So if you just switch out the regular upload control with your own custom datatype, then you can place the media wherever you want. Just make sure that you return the correct url to for example the RTE so that users don't get confused.
Alternative - you could use IIS to map a virtual directory for the media folder (or subfolder) to an alternate server. I haven't tested this, but it would theoretically work.
I'm doing something similar for my pm4umbraco project to protect media files from unauthorized downloading. Have a peek at the code at http://pm4umbraco.codeplex.com to find out how storing media is handled.
I've build a solution for a client that stored media files on another location (which could also be another server). The only gotcha we had was that the client is using Umbraco Pro with courier, and courier didn't work with this scenario.
Appologies, I should have covered a bit more of the reasoning first....
@Roel, the main reason behind it is for shared development. Currently developers are all developing locally on thier own machines using a shared DB, as they're making lots of updates to doc-types, data-types & content tree.
It would be nice to have a 'shared' media folder in the same way we have a shared DB. We store all the code and templates in SVN (storing media in SVN would be chaos so we don't).
Also, I'd like the solution to work without having to alter all the various data-types that create files. (I guess that makes it quite tricky)
@Chris' IIS mapped path solution could be a go-er however I gave it a quick spin and came up with 404 errors on files in the virtual folder, I'm not sure why yet, the media folders show up ok in my IIS Manager. I may have a permission problem. I tried using my credentials don't seem to work, hmmm... I'll investigate.
I think the problem would be due to the fact that Umbraco wasn't built to support virtual directories.
For a recent website I've created an afterSave handler for the media section that uploads the new file to Amazon S3 so that we can use it as a content delivery network. I suppose you could quite easily build an aftersave handler that would upload files to a network share, but then you'd also have to change the media picker and the getMedia XSLT extension.
I'd just go with dumping the media folder into your source control and deal with it that way (provided that you're already using a single database shared by all of your developers).
@sebastiaan we tried putting the media in source control but it makes it very difficult to maintain, SVN does not know which changes are updates, deletes and adds, so the user has do do everything twice. Additionaly it would violate the principle that SVN should hold what's required to build the application, it should not hold the output or working data of a running application.
However the afterSave event could be worth looking into, that's a great idea.
I don't understand why SVN would not know this.. you tell it to add new files, update changed files and remove deleted files, right? Maybe I'm so used to Git now that I can't remember how (crappy, apparently) SVN works.
Anyway, you're right, there's a lot of stuff that shouldn't be in SVN, but then why would you want to share all those media items with other developers anyway, if they don't "need" it. There's always a trade-off to be made. I tend to store a minimal amount of media items in source control so that I have enough of them to fill one or two pages that help me test the way media items are fetched and displayed.
Beware that media pickers currently can't work with files that aren't stored in /media. Obviously you could simply write your own getmedia xslt extension that can get images from a network share, but why build functionality that will ONLY be used on your dev machines (at the risk of producing bugs and having different behaviour between your dev and staging/production machines)?
Save media to another server
Hi
Has anyone completed a project where the media folder and all it's contents; files & images are saved on another server?
Any comments, lessons learned or recommendations?
Cheers.
Murray.
Not sure if anyone did this before.
I am curious though what would be the goal of something like this? Do you want to distribute load? I mean do you want the images in the frontend of the website also to be loaded from that other server? Or do you just want to make a backup of the media folder?
At codegarden 07 Niels built an FTP datatype. So if you just switch out the regular upload control with your own custom datatype, then you can place the media wherever you want. Just make sure that you return the correct url to for example the RTE so that users don't get confused.
Alternative - you could use IIS to map a virtual directory for the media folder (or subfolder) to an alternate server. I haven't tested this, but it would theoretically work.
If this is about what Roel mentioned in terms of Load Balancing, I would suggest taking a look at http://our.umbraco.org/wiki/install-and-setup/installing-umbraco-for-load-balanced-environments
Murray,
I'm doing something similar for my pm4umbraco project to protect media files from unauthorized downloading. Have a peek at the code at http://pm4umbraco.codeplex.com to find out how storing media is handled.
Cheers,
/Dirk
Hi Murray,
I've build a solution for a client that stored media files on another location (which could also be another server). The only gotcha we had was that the client is using Umbraco Pro with courier, and courier didn't work with this scenario.
Cheers,
Richard
Thanks for all your answers.
Appologies, I should have covered a bit more of the reasoning first....
@Roel, the main reason behind it is for shared development. Currently developers are all developing locally on thier own machines using a shared DB, as they're making lots of updates to doc-types, data-types & content tree.
It would be nice to have a 'shared' media folder in the same way we have a shared DB. We store all the code and templates in SVN (storing media in SVN would be chaos so we don't).
Also, I'd like the solution to work without having to alter all the various data-types that create files. (I guess that makes it quite tricky)
@Chris' IIS mapped path solution could be a go-er however I gave it a quick spin and came up with 404 errors on files in the virtual folder, I'm not sure why yet, the media folders show up ok in my IIS Manager. I may have a permission problem. I tried using my credentials don't seem to work, hmmm... I'll investigate.
Hi Murray,
I am experiencing the same thing on my virtual directory setup.
Were you able to find the cause? Some hints would be appreciated :)
I think the problem would be due to the fact that Umbraco wasn't built to support virtual directories.
For a recent website I've created an afterSave handler for the media section that uploads the new file to Amazon S3 so that we can use it as a content delivery network. I suppose you could quite easily build an aftersave handler that would upload files to a network share, but then you'd also have to change the media picker and the getMedia XSLT extension.
I'd just go with dumping the media folder into your source control and deal with it that way (provided that you're already using a single database shared by all of your developers).
@JL no, I have not tried again since.
@sebastiaan we tried putting the media in source control but it makes it very difficult to maintain, SVN does not know which changes are updates, deletes and adds, so the user has do do everything twice. Additionaly it would violate the principle that SVN should hold what's required to build the application, it should not hold the output or working data of a running application.
However the afterSave event could be worth looking into, that's a great idea.
I don't understand why SVN would not know this.. you tell it to add new files, update changed files and remove deleted files, right? Maybe I'm so used to Git now that I can't remember how (crappy, apparently) SVN works.
Anyway, you're right, there's a lot of stuff that shouldn't be in SVN, but then why would you want to share all those media items with other developers anyway, if they don't "need" it. There's always a trade-off to be made. I tend to store a minimal amount of media items in source control so that I have enough of them to fill one or two pages that help me test the way media items are fetched and displayed.
Beware that media pickers currently can't work with files that aren't stored in /media. Obviously you could simply write your own getmedia xslt extension that can get images from a network share, but why build functionality that will ONLY be used on your dev machines (at the risk of producing bugs and having different behaviour between your dev and staging/production machines)?
Yes, I think the conclusion is... unless umbraco natively supported media on another server, it would be more work than there is benefit.
is working on a reply...