Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Elastic Beanstalk: nginx reload failed

I have provided to my Elastic Beanstalk environment nginx configuration according to this article. My application sits in a Docker container. The problem is that the environment fails to reload nginx.

Here's my config file:

files:
  "/etc/nginx/conf.d/proxy.conf" :
    mode: "000644"
    owner: root
    group: root
    content: |
      client_max_body_size 500M;

container_commands:
  01_reload_nginx:
    command: "sudo service nginx reload"

And that results in failure (after /var/log/eb-activity.log):

EmbeddedPostBuild/postbuild_0_audio_explorer] : Starting activity...
[2019-03-04T21:45:01.064Z] INFO  [3274]  - [Application deployment app-8a62-190304_223307@1/StartupStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_audio_explorer/Command 01_reload_nginx] : Starting activity...
[2019-03-04T21:45:01.100Z] INFO  [3274]  - [Application deployment app-8a62-190304_223307@1/StartupStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_audio_explorer/Command 01_reload_nginx] : Activity execution failed, because:  (ElasticBeanstalk::ExternalInvocationError)


[2019-03-04T21:45:01.100Z] INFO  [3274]  - [Application deployment app-8a62-190304_223307@1/StartupStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_audio_explorer/Command 01_reload_nginx] : Activity failed.
[2019-03-04T21:45:01.100Z] INFO  [3274]  - [Application deployment app-8a62-190304_223307@1/StartupStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_audio_explorer] : Activity failed.
[2019-03-04T21:45:01.100Z] INFO  [3274]  - [Application deployment app-8a62-190304_223307@1/StartupStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild] : Activity failed.
[2019-03-04T21:45:01.122Z] INFO  [3274]  - [Application deployment app-8a62-190304_223307@1/StartupStage0/EbExtensionPostBuild] : Activity failed.
[2019-03-04T21:45:01.122Z] INFO  [3274]  - [Application deployment app-8a62-190304_223307@1/StartupStage0] : Activity failed.
[2019-03-04T21:45:01.122Z] INFO  [3274]  - [Application deployment app-8a62-190304_223307@1] : Completed activity. Result:
  Application deployment - Command CMD-Startup failed

When I remove section:

container_commands:
  01_reload_nginx:
    command: "sudo service nginx reload"

Deployment goes smooth.

Any ideas? How can I get information on what precisely goes wrong with the command? If I ssh to my instance, I can execute command without a problem.

like image 674
Lukasz Tracewski Avatar asked Mar 04 '19 22:03

Lukasz Tracewski


People also ask

Does Elastic Beanstalk use nginx?

Elastic Beanstalk uses nginx as the reverse proxy to map your application to your Elastic Load Balancing load balancer on port 80. Elastic Beanstalk provides a default nginx configuration that you can either extend or override completely with your own configuration.

What is proxy server in Elastic Beanstalk?

Elastic Beanstalk provides a default proxy configuration that you can either extend or completely override with your own configuration. By default, Elastic Beanstalk configures the proxy to forward requests to your application on port 5000.

Where is nginx config file in AWS?

By default this configuration is in the file /etc/nginx/conf.


1 Answers

The elastic beanstalk deployment process will do the nginx reload for you, so you can remove it from your script permanently and avoid the error. Figuring out why exactly the command failed will just be academic

like image 51
brocknz Avatar answered Sep 28 '22 11:09

brocknz