I'm wondering what people have found to be the best method for managing magento's code base in a HA cloud / auto scaling environment. I'm currently planning to share the media directory over NFS, using AWS's CDN to cache both the CMS and product images.

Whilst NFS would make managing the code base simple, i figure the amount of extra network traffic would slow things down (even though varnish will be caching what content it can). We deploy code from github, so i figure webhooks could be an option, but managing these with servers automatically coming on and off line could be tricky.

Any experience, thoughts, must avoids would be very greatly received.

*After thought: Would like to experiment with the performance difference when using mage compiler too, which could make managing a 'synced' code base more challenging / need some more clever scripting.

  • 2
    Possibly relevant to your interests: magento.stackexchange.com/questions/459/… Commented Sep 30, 2013 at 21:03
  • 2
    Thanks @AlanStorm, read that one earlier tonight, but looking for ways to deal with the full on code base specifically. The Angrybirds method of deploying a full new set of infrastructure seems pretty smart but slightly out of my budget / resource availability!
    – user3412
    Commented Sep 30, 2013 at 21:12

1 Answer 1


The deploy resource in Chef is a good tool for managing deployments. My use case is self-hosted Chef Server version 10.18 installed on a utility host that manages my production, staging, and preview clusters. Here are the steps performed through a custom shell script:

  1. Initialize variables
  2. Get the latest revision hash from GitHub
  3. Disable availability monitoring to prevent alerts over HTTP 503 status
  4. Switch all web and utility hosts to maintenance mode (optional)
  5. Deploy utility routines
    1. Stop Magento’s cron and all Resque workers
    2. Address filesystem dependencies
    3. Chef checks out the defined revision as a new release
    4. Address Magento dependencies (install packages, configure modman, configure local.xml)
    5. Update all cron tasks and scripts for automation (paths, timing, arguments)
    6. Deploy all modules (modman)
    7. Clear cache (n98-magerun.phar)
    8. Run any migrations (n98-magerun.phar)
    9. Start the Magento cron (Chef cron_d resource)
    10. Start Resque workers (Chef execute resource)
  6. Deploy the first web host
    1. Address filesystem dependencies (create directories: chown and then chmod)
    2. Chef checks out the defined revision as a new release
    3. Address Magento dependencies (install packages, configure modman, configure local.xml)
    4. Deploy all Magento modules (modman)
  7. Mark a new deployment in New Relic
  8. Enable availability monitoring services
  9. Disable load balancer services to all other web hosts
  10. Continue deployments on web hosts, sequentially bringing them online
  11. Perform Chef routines for the search hosts

Chef deploy callbacks are also used to define an order of operations; commands fire only if the prior steps succeed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.