aws / elastic-beanstalk-roadmap

AWS Elastic Beanstalk roadmap
https://aws.amazon.com/elasticbeanstalk/
Creative Commons Attribution Share Alike 4.0 International
283 stars 11 forks source link

Add option to prevent app restart after app deployments on amazon linux 2 #126

Open codeshipofficient opened 3 years ago

codeshipofficient commented 3 years ago

Community Note

Tell us about your request Please add a configuration option (eg via config files) to disable the restarting of nodejs, apache,.. during or after application deployments

Is this request specific to an Elastic Beanstalk [platform] at least Nodejs, php+apache,..

Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard? Since AL2, it is no longer possible to disable restarting of apps and proxy servers with custom platform hooks, as that feature has been discontinued. Some of the platforms do not benefit from a restart after app deployment at all. Forced restarts can in some case cause downtime for a few seconds (PHP) or interrupt background jobs (Nodejs). In the case of PHP no restarts are needed to use the new code, because an opcache flush is enough to make PHP use the new code. in the case of Nodejs a restart can cause a job to be interrupted.

Are you currently working around this issue? Only workaround is not upgrading to AL2

Nizari commented 3 years ago

When is this going to be picked up? This is putting us in a stuck situation, since for newer language version we're forced to go to amazon linux 2, but then we no longer have zero down time, which is detrimental to our daily operations

tommypraeger commented 3 years ago

Thanks for the feedback. We will evaluate this feature request.

Nizari commented 3 years ago

@tommypraeger we seem to have found the issue (for us at least):

It seems to be in the difference between Classic LB vs ALB. Below the small difference in events that get generated.

ROLLING DEPLOYMENT with ALB (NO DOWNTIME)

Upload Complete.
2021-05-06 06:36:30    INFO    Environment update is starting.      
2021-05-06 06:36:34    INFO    Deploying new version to instance(s).
2021-05-06 06:36:35    INFO    Batch 1: Starting application deployment on instance(s) [i-0b343ccb78497ecab].
2021-05-06 06:36:57    INFO    Batch 1: Starting application deployment command execution.
2021-05-06 06:37:28    INFO    Instance deployment completed successfully.
2021-05-06 06:37:32    INFO    Batch 1: Completed application deployment command execution.
2021-05-06 06:37:32    INFO    Command execution completed on 1 of 2 instances in environment.
2021-05-06 06:37:32    INFO    Batch 1: Registering instance(s) with the load balancer and waiting for them to be healthy. 
2021-05-06 06:37:46    INFO    Batch 1: Completed application deployment.
2021-05-06 06:37:46    INFO    Batch 2: Starting application deployment on instance(s) [i-0778a9b2a5c51057e].
2021-05-06 06:38:08    INFO    Batch 2: Starting application deployment command execution.
2021-05-06 06:38:38    INFO    Instance deployment completed successfully.
2021-05-06 06:38:39    INFO    Batch 2: Completed application deployment command execution.
2021-05-06 06:38:39    INFO    Command execution completed on 2 of 2 instances in environment.
2021-05-06 06:38:40    INFO    Batch 2: Registering instance(s) with the load balancer and waiting for them to be healthy. 
2021-05-06 06:38:53    INFO    Batch 2: Completed application deployment.
2021-05-06 06:38:56    INFO    New application version was deployed to running EC2 instances.
2021-05-06 06:38:56    INFO    Environment update completed successfully.

ROLLING DEPLOYMENT with CLASSIC LB (SMALL DOWNTIME)

Right after Batch 1: De-registering instance(s) from the load balancer and waiting for them to go out of service. (same for Batch 2)

Upload Complete.
2021-05-06 06:55:34    INFO    Environment update is starting.      
2021-05-06 06:55:37    INFO    Deploying new version to instance(s).
2021-05-06 06:55:39    INFO    Batch 1: Starting application deployment on instance(s) [i-0ccbcb1cd9e40449d].
2021-05-06 06:55:39    INFO    Batch 1: De-registering instance(s) from the load balancer and waiting for them to go out of service.
2021-05-06 06:55:52    INFO    Batch 1: Starting application deployment command execution.
2021-05-06 06:56:06    INFO    Instance deployment completed successfully.
2021-05-06 06:56:10    INFO    Batch 1: Completed application deployment command execution.
2021-05-06 06:56:10    INFO    Command execution completed on 1 of 2 instances in environment.
2021-05-06 06:56:10    INFO    Batch 1: Registering instance(s) with the load balancer and waiting for them to be healthy. 
2021-05-06 06:58:13    INFO    Batch 1: Completed application deployment.
2021-05-06 06:58:14    INFO    Batch 2: Starting application deployment on instance(s) [i-0dce022f5bd2609c9].
2021-05-06 06:58:14    INFO    Batch 2: De-registering instance(s) from the load balancer and waiting for them to go out of service.
2021-05-06 06:58:27    INFO    Batch 2: Starting application deployment command execution.
2021-05-06 06:58:41    INFO    Instance deployment completed successfully.
2021-05-06 06:58:45    INFO    Batch 2: Completed application deployment command execution.
2021-05-06 06:58:45    INFO    Command execution completed on 2 of 2 instances in environment.
2021-05-06 06:58:45    INFO    Batch 2: Registering instance(s) with the load balancer and waiting for them to be healthy. 
2021-05-06 07:00:49    INFO    Batch 2: Completed application deployment.
2021-05-06 07:00:52    INFO    New application version was deployed to running EC2 instances.
2021-05-06 07:00:52    INFO    Environment update completed successfully.

Why this makes such a difference I don't know, but you probably do :)

codeshipofficient commented 3 years ago

@Nizari the downtime intended in this issue relates to downtime due to server restarts. The restart happening during deployment also include the killing of background processes, so this is not something that can be fixed with a load balancer + rolling deployments. It's probably best to create a separate issue for that problem.

benp84 commented 1 year ago

Is this ever getting fixed? My Amazon Linux 1 platform is officially retired and I still can't use AL2 without downtime. I'm not OK with cutting off 100 users' connections every time I push code. Please address this so I can finally upgrade!