1

I have a PHP application running on an AWS auto-scale group that uses sticky sessions behind an AWS ELB.

When running CodeDeploy against these machines to release, CodeDeploy will initially delete the files before replacing them with the new ones. However, during that short period of time, all web requests hitting the servers will receive 404s or 500 server errors due to the files not all being there.

Connection draining and pulling the servers out of the pool won't work due to sticky sessioning as we'd be logging the users out of the system when we pulled a server out of the pool.

I've considered code deploying to a new directory in the file system and rsyncing over, but I think that would only partially solve the problem since rsync isn't instantaneous either.

Is there an option for sticky sessioned servers like this to see a seamless deploy?

sailboatlie
  • 346
  • 1
  • 6
  • 18
  • Instead of using rsync you may consider the instantanious version of that , lsyncd - a daemon to continuously synchronize directory trees – Ijaz Ahmad Jan 18 '17 at 08:30

1 Answers1

0

One option that might help is to rely on File Exists Behavior and set to the RETAIN option. The flag in the aws deploy create-deployment command is --file-exists-behavior: https://docs.aws.amazon.com/cli/latest/reference/deploy/create-deployment.html

If you create the deployment through the console there's a way to select the "Content options" which allows you to specify whether the deployment should fail, overwrite, or retain the file.

But I'm not 100% sure if that solves the problem since then you don't update the files during deployment. I quickly read up on sticky sessions... but can your client software simply retry if it loses a sticky session? I can't think of a way around it.

Like, your host could disappear at any time. During deployment you might be (no idea if you are) removing the host from the load balancer. Your application stop scripts could be shutting down your host's service. I bet that sticky sessions should have a solution where you can drain previous sessions from a host and stop new clients from reaching that host. But I don't know enough about what you're doing here.

I hope this info helps you. -Asaf