1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Attachments hosted externally

Discussion in 'XenForo Development Discussions' started by Sim, Nov 11, 2011.

  1. Sim

    Sim Well-Known Member

    Has anyone had a look at the various attachment classes in XenForo and worked out whether it would be possible to extend the functionality to allow attachments to be hosted externally (ie a CDN or bulk-storage facility).

    The main reasons being:
    • make it easier to back up the site (attachments don't change frequently, don't need to be backed up daily, no point taking up extra backup space with multiple copies of them)
    • overcoming storage limitations (many hosting providers don't give enough space for a busy site with a lot of attachments)
    • possible performance benefits if using a CDN

    Workflow might be along the lines of:
    1. user uploads attachment, stored on XF server as normal
    2. cron script periodically copies new attachments to external server
    3. flag set for that attachment to say, "serve from external server rather than local"
    4. thread display checks flag to determine URL to content for when user clicks on an attachment
    I haven't had a chance to play around with the relevant classes yet (I'm still getting up to speed with XenForo addon development), so if anyone had any suggestions on how this might be done - that would be appreciated.
    I do something similar to this on ZooChat where photos in my gallery are uploaded by users to the site before a script moves them to Amazon for storage plus CloudFront CDN. Works well - but I virtually wrote the gallery routines from scratch, so it was relatively easy to add the CDN functionality.
     
    Walter likes this.
  2. Floris

    Floris Guest

    You can set config.php to an external cdn for /data/, which is where attachments are stored.
     
  3. Andy.N

    Andy.N Well-Known Member

  4. Sim

    Sim Well-Known Member

    Thanks guys, but the solution you've both mentioned is specifically for a CDN which retrieves data from a source and then caches it at various network edge-points for performance reasons. That's not what I'm looking for.

    Specifically it doesn't address the need to reduce the storage usage on the main (source) web server. For example, ZooChat had over 50GB of images in its gallery (and growing quickly) and I started running into capacity limitations on the host I was using for the site. By moving the data to an external server, I was able to free up that space completely.

    The CDN solution is also not a suitable backup mechanism, another requirement I have ... 50GB+ worth of data is non-trivial to backup!
     
    BamaStangGuy likes this.
  5. BamaStangGuy

    BamaStangGuy Well-Known Member

    Did you ever find a solution?
     
  6. Sim

    Sim Well-Known Member

    Not yet - haven't had a chance to dig into the classes yet to see what is possible.
     
  7. Kintaro

    Kintaro Well-Known Member

Share This Page