Docker Nginx Config Customizations not Working (Ruby)

0

Hi,

I understand that Nginx has to be customized by .ebextensions to get proxy pass working correctly. In my research, however, I have seen two methods:

  1. .ebextensions/nginx/nginx.conf or .ebextensions/nginx/conf.d/proxy.conf
  2. .ebextensions/00-nginx-customizations.config

Where (1) creates a file that either overrides or adds to the current Nginx configuration and (2) has yaml definition of a file that will be created.

However, neither of these methods seems to be modifying my Nginx configuration at all. I continue to get this error:

2019-07-22 22:40:57    INFO    Environment update is starting.
2019-07-22 22:41:34    INFO    Deploying new version to instance(s).
2019-07-22 22:41:41    INFO    Successfully pulled ruby:2.3.3
2019-07-22 22:41:42    INFO    Successfully built aws_beanstalk/staging-app
2019-07-22 22:41:49    ERROR   Failed to start nginx, abort deployment
2019-07-22 22:41:53    ERROR   [Instance: i-12345] Command failed on instance. Return code: 1 Output: nginx: [emerg] invalid port in upstream "172.17.0.4:$PORT" in /etc/nginx/conf.d/elasticbeanstalk-nginx-docker-upstream.conf:2
nginx: configuration file /etc/nginx/nginx.conf test failed
Failed to start nginx, abort deployment.
Hook /opt/elasticbeanstalk/hooks/appdeploy/enact/01flip.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2019-07-22 22:41:53    INFO    Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2019-07-22 22:41:54    ERROR   Unsuccessful command execution on instance id(s) 'i-00ac10fbc84ade699'. Aborting the operation.
2019-07-22 22:41:54    ERROR   Failed to deploy application.

Any ideas? Any way to check what Nginx configuration is being generated?

Thanks,
Mark

已提問 5 年前檢視次數 332 次
1 個回答
0

I figured it out.

It turns out nothing was happening because I was running

eb deploy

without committing the changes. So my EXPOSE port in my Dockerfile was getting carried all the way down to the Nginx proxy config. Even though I had fixed it in my Dockerfile, since I hadn't committed it, it wasn't changing.

I actually ended up looking at the Dockerfile on the instance, and then looking at the Zip that was uploaded to S3 to eventually figure this out.

So make sure you have committed any changes you want uploaded during eb deploy or you can stage them, I believe and run eb deploy --staged.

Hope this helps someone.

Edited by: MarkAtTes on Jul 23, 2019 9:34 AM

已回答 5 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南