Jahia Dev Forum > Images and media...

0 (0 Good)
0 (0 Bad)

Images and media files stored in MongoDB

by  joewei »  2013/12/01 11:16

In our current system images and other media files are served from a separate sub domain where they are stored in MongoDB and for this we're using nginx with the corresponding MongoDB module.

We'd prefer to do the same with the images in Jahia, therefore I'd like to ask if someone has any idea how to achieve this. Would it be possible to change the storage location to be a MongoDB instance instead of the local repository ?

  • Images and media files stored in MongoDB
    2013/12/01 11:16

    joewei <p> In our current system images and other media files are served from a separate sub domain where they are stored in MongoDB and for this we&#39;re using nginx with the corresponding MongoDB module.</p> <p> We&#39;d prefer to do the same with the images in Jahia, therefore I&#39;d like to ask if someone has any idea how to achieve this. Would it be possible to change the storage location to be a MongoDB instance instead of the local repository ?</p>

  • Number of messages  6
    Registration date Dec 1, 2013
    0 (0 Good)
    0 (0 Bad)

    Re: Images and media files stored in MongoDB

    by  shuber »  2013/12/02 07:46

    Hello,

    While there is nothing preventing you from serving images from anywhere, the main issue you would run into are the fact that Jahia's image browsing and file selectors are connected to the underlying JCR repository. So you could do either : 

    - develop your own MongoDB JCR provider and mount it as a additional JCR provider using Jahia's interface (be aware that this will change a bit in the next version of Jahia, your implementation will still work but there will be easier ways to achieve this).

    - I found a MongoDB back-end implementation in Jackrabbit's sandbox here : http://svn.apache.org/repos/asf/jackrabbit/sandbox/jackrabbit-mongo-persistence/ but it is clearly not production ready.

    - Implement your own image selectors using a custom Javascript UI, but then you would not benefit from the rest of Jahia's service for images.

    In I was in your position I would probably go with the first solution, but that's also because I know how to do it :)

    Best regards,

      Serge Huber.

    Serge Huber (shuber)

    Number of messages  271
    Registration date
    0 (0 Good)
    0 (0 Bad)

    Re: Re: Images and media files stored in MongoDB

    by  joewei »  2013/12/02 08:43

    Hello Serge,

    thank you for your quick response :)

    If going with the first solution, is there some example code available for me to look at, i.e. a provider for another database ?

    And for the third solution, how would I tie in a custom Javascript UI for the image selectors ?

    Best regards

    Joerg

  • Re: Re: Images and media files stored in MongoDB
    2013/12/02 08:43

    joewei <p> Hello Serge,</p> <p> thank you for your quick response :)</p> <p> If going with the first solution, is there some example code available for me to look at, i.e. a provider for another database ?</p> <p> And for the third solution, how would I tie in a custom Javascript UI for the image selectors ?</p> <p> Best regards</p> <p> Joerg</p>

  • Number of messages  6
    Registration date Dec 2, 2013
    0 (0 Good)
    0 (0 Bad)

    Re: Re: Re: Images and media files stored in MongoDB

    by  shuber »  2013/12/02 09:34

    Hello,

    Here is our VFS JCR implementation that could serve as a basis for a MongoDB mountable repository : http://subversion.jahia.org/svn/jahia/releases/JAHIA_6_6_1_0/core/src/main/java/org/jahia/services/content/impl/vfs/

    Btw if you implement this it would be great to share it.

    For the second solution, here I was really thinking about directly connecting to MongoDB via the REST HTTP interface : http://docs.mongodb.org/ecosystem/tools/http-interfaces/. I'm however not an expert at MongoDB so this might not be the best way to achieve this.

    Best regards,

      Serge Huber.

    Serge Huber (shuber)

    Number of messages  271
    Registration date
    0 (0 Good)
    0 (0 Bad)

    Re: Re: Re: Re: Images and media files stored in MongoDB

    by  joewei »  2013/12/02 11:10

    Ok great, thanks a lot for providing the link to the VFS JCR implementation, that certainly should be helpful.

    Given that we would get this implemented, how would we tell Jahia to store any images (and other media files) in the MongoDB, while regular content should still go into the standard repository ?

    Regarding Javascript UI, we've got something similar already implemented for KonaKart so that's not the problem. My question was just what would be the best approach to replace image selectors in Jahia without breaking compatibility ?

    Oh, and of course, I'd be open to sharing such an implementation :)

    Thanks
    Joerg

     

  • Re: Re: Re: Re: Images and media files stored in MongoDB
    2013/12/02 11:10

    joewei <p> Ok great, thanks a lot for providing the link to the VFS JCR implementation, that certainly should be helpful.</p> <p> Given that we would get this implemented, how would we tell Jahia to store any images (and other media files) in the MongoDB, while regular content should still go into the standard repository ?</p> <p> Regarding Javascript UI, we&#39;ve got something similar already implemented for KonaKart so that&#39;s not the problem. My question was just what would be the best approach to replace image selectors in Jahia without breaking compatibility ?</p> <p> Oh, and of course, I&#39;d be open to sharing such an implementation :)</p> <p> Thanks<br /> Joerg</p> <p> &nbsp;</p>

  • Number of messages  6
    Registration date Dec 2, 2013
    0 (0 Good)
    0 (0 Bad)

    Re: Re: Re: Re: Re: Images and media files stored in MongoDB

    by  shuber »  2013/12/02 13:20

    Well as JCR provider are attached to mount points, simply putting the resources in the proper directory will make sure they go into the MongoDB JCR provider

    For example 

    / - default Jackrabbit JCR provider

    /mount/localFiles - VFS provider with a file:// root configuration

    /mount/mongoDB - Your new MongoDB provider

    For the Javascript solution, what I was suggesting was implementing a seperate file selection UI that would be completely different from the built-in Jahia UIs. Unlike the first solution, this would not offer a unique UI but two seperate ones.

    Best regards,

      Serge Huber.

    Serge Huber (shuber)

    Number of messages  271
    Registration date
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page