Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We've got a site where the pages need to get updated every once in a while. The site has approximately 8 EC2 instances running at any moment, but occasionally it gets much larger. We use a load balancer and autoscaling to create more instances. The pages are just plain files on disk; there's no content management system. The web server is Jetty.

If I modify a page, how can I deploy it to all current and future instances?

Obviously, I can't use a management tool like Fabric because that won't update the AMIs from which future instances will be built. It would also be a mistake to create a new AMI and deploy it because, first, that's a cumbersome process, and second, it would kill off all current user sessions on existing instances.

I'm thinking that the instances need to pull the site's pages from somewhere, and check for updates every once in a while.

I thought of putting the pages on S3, but that's a non-starter because 1) S3 has no way of notifying instances when pages are changed, 2) so you have to poll S3 continuously, 3) which is expensive, and 4) you have to do it for every page individually.

What's the simplest way to do this? What's the best way, if best != simple?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

There are a couple options as I see it:

  1. Use S3; I know you indicated it was a non starter but new servers have to get the code from somewhere. Assuming your deployment is already scripted to deploy to the running instances add a line to push to S3. This can be accomplished automatically with man source control tools as well.
  2. Create a master server that all the other servers can poll for code over ssh.
  3. Pull from code hosting service like github
share|improve this answer

You do it by using some post-clone steps in your auto-scaling. The exact methods depends on your comfort-levels, but a solution like this would probably do a lot for you:

  • Build your web-directory in something like git.
  • In the AMI, build in a cron-task to git-pull from the repo-server on a schedule.
  • In the AMI, build in a git-pull as part of the on-boot tasks.

This is a batch-mode method. Existing servers don't get notified of new files, but they'll all get them at about the same time due to the cron execution time. New servers will get new files as they start up.

The key here is to decouple your content from the AMI itself.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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