How to integrate a CDN

edited March 2013 in Installation
I'd like to serve assets from a CDN. How might I go about changing the server only for assets? I've already got a method for storing the assets up to the CDN, but I'm wondering how I can just convert http://www.mydomain.com/assets/images/logo.png to http://cdn.mydomain.com/assets/images/images/logo.png. or http://cdn-dev.mydomain.com/assets/images/logo.png.

Any ideas?

Comments

  • edited 1:34AM
    A couple questions:

    1. Are you using .93 or the 1.0 beta?
    2. Are you using the asset helpers to put in images, css and js (e.g. img_path(), css(), js())?
  • edited 1:34AM
    1. 0.93, though we haven't launched yet and could in theory put some time into upgrading to 1.0.
    2. Yes, we are using the Asset Helper class and calling it with either js() or $this->asset->js().
  • edited 1:34AM
    Based on this, I made some changes yesterday to 1.0 to the Asset library to allow you to put absolute paths as the "asset_path" value in the fuel/application/config/asset.php file. This should help with the CDN path.
  • edited 1:34AM
    Thank you! Two more related questions:

    1. How much re-coding could we expect going from .93 to 1.0 assuming we do very few modifications to the base Fuel and CI frameworks?
    2. Without upgrading to 1.0, what might be involved in addressing the original question?

    Again, thank you for your time.
  • edited 1:34AM
    1. Every project is a little different but our internal experience is pretty painless. There are a couple things to look out for. The User permissions lookup table has been removed in favor of the new fuel_relationships table which is used to do many-to-many associations. This may require you to recreate the permissions for users. The structure for putting in fields for layouts MY_fuel_layouts has changed slightly in that it now requires an array key of "fields" that attaches all the Form_builder fields too.

    To update, I would recommend checking out the 1.0 branch and merge your application code into that folder (including your MY_fuel.php, MY_fuel_layouts.php and MY_fuel_modules.php config files). Start there and post back if you have any issues.

    2. The change was in the Asset class for the assets_path method. Below is the commit with more info:
    https://github.com/daylightstudio/FUEL-CMS/commit/bf938e792652615f45aa2b2418fc0d01363d6503
Sign In or Register to comment.