2

I've got a Symfony2 application which I am deploying to development, staging and production servers using Capistrano. However, I'm looking to also setup a CDN to serve static content such as images, css, js files etc. The URL for the CDN for example is static.example.com. I've read that I simply need to add the following to my config_prod.yml file:

framework:
     templating:
         engines: ['twig']
         assets_base_urls:
         http: [http://static.example.com]

However, when deploying using capistrano would I need to deploy the whole application to the CDN as well as the server that will host the website or can I deploy only the assets i.e images, js files etc to the CDN and the dynamic files to the server/s?

Thanks

user1961082
  • 1,015
  • 17
  • 41

1 Answers1

1

Only static assets needs to be served by your CDN.

See also: automatic push to CDN deployment strategy

Community
  • 1
  • 1
Th. Ma.
  • 9,432
  • 5
  • 31
  • 46
  • Thanks. What if we've got 2 servers and we need somewhere to share uploaded content to the server? I.e if a user uploads an image and they are currently on server 1, how does server 2 access this file? Wouldnt you need to upload this image to the CDN? – user1961082 Apr 16 '13 at 08:39
  • Also, I've read the link you gave, how does the CDN do the pull request? Do you need to install something on the CDN? – user1961082 Apr 16 '13 at 08:57
  • I would assume files uploaded by users would need to be added to a content repository from which server 1 and server 2 would pull similar assets. The pull would occur from the original server (hosting dynamically generated contents which would then be statically served by the CDN). http://www.whoishostingthis.com/blog/2010/06/30/cdns-push-vs-pull/ – Th. Ma. Apr 16 '13 at 11:59