cloudfoundry / staticfile-buildpack

Deploy static HTML/JS/CSS apps to Cloud Foundry
Apache License 2.0
200 stars 325 forks source link

Unable to start nginx with buildpack version v1.3.3 #71

Closed wolfgangkirchler closed 8 years ago

wolfgangkirchler commented 8 years ago

When using the buildpack version v1.3.3. nginx is unable to start. If I instead switch back to v1.3.2 nginx starts up fine. The error which is reported in the log messages "no "events" section in configuration" was no misconfiguration, since the events section is present. My assumption is that there is a major bug in the new v1.3.3. version.

These are my log messages:

2016-03-17 09:31:44 +0000 [API] OUT App instance exited with guid c2822093-11ee-4d66-b76e-f4585 8399aad payload: {"cc_partition"=>"default", "droplet"=>"c2822093-11ee-4d66-b76e-f45858399aad", "version"=>"9f449a74-351c-4715-bb1e-2c582ff3b8ee", "instance"=>"2b9c06ab60944d31ac4442065360ff5e", "index"=>0, "reason"=>"CRASHED", "exit_status"=>1, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1458207104} 2016-03-17 09:31:44 +0000 [DEA] ERR Instance (index 0) failed to start accepting connections 2016-03-17 09:31:44 +0000 [App/0] OUT 2016-03-17 09:31:44 +0000 [App/0] ERR 2016/03/17 09:31:44 [emerg] 31#0: no "events" section in configuration 2016-03-17 09:31:44 +0000 [App/0] ERR from /usr/bin/erb:154:in <main>' 2016-03-17 09:31:44 +0000 [App/0] ERR from /usr/bin/erb:133:inrun' 2016-03-17 09:31:44 +0000 [App/0] ERR from /usr/lib/ruby/1.9.1/erb.rb:820:in run' 2016-03-17 09:31:44 +0000 [App/0] ERR from /usr/lib/ruby/1.9.1/erb.rb:838:inresult' 2016-03-17 09:31:44 +0000 [App/0] ERR from /usr/lib/ruby/1.9.1/erb.rb:838:in eval' 2016-03-17 09:31:44 +0000 [App/0] ERR from /home/vcap/app/nginx/conf/orig.conf:52:in

' 2016-03-17 09:31:44 +0000 [App/0] ERR /home/vcap/app/nginx/conf/orig.conf:52:in `read': No such file or directory - ip-restriction.txt (Errno::ENOENT) 2016-03-17 09:31:42 +0000 [DEA] OUT Starting app instance (index 0) with guid c2822093-11ee-4d66-b76e-f45858399aad 2016-03-17 09:31:40 +0000 [STG] OUT -----> Uploading droplet (2.6M) 2016-03-17 09:31:38 +0000 [STG] OUT -----> Setting up nginx 2016-03-17 09:31:38 +0000 [STG] OUT -----> Copying project files into public/ 2016-03-17 09:31:38 +0000 [STG] OUT -----> Using root folder 2016-03-17 09:31:38 +0000 [STG] OUT Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/concourse-binaries/nginx/nginx-1.9.12-linux-x64.tgz] 2016-03-17 09:31:36 +0000 [STG] OUT -------> Buildpack version 1.3.3 2016-03-17 09:31:36 +0000 [STG] OUT Submodule path 'compile-extensions': checked out '9932bb1d352b88883d76df41e797a6fa556844f0' 2016-03-17 09:31:35 +0000 [STG] ERR Cloning into 'compile-extensions'... 2016-03-17 09:31:35 +0000 [STG] OUT Submodule 'compile-extensions' (https://github.com/cloudfoundry/compile-extensions.git) registered for path 'compile-extensions' 2016-03-17 09:31:32 +0000 [STG] ERR Cloning into '/tmp/buildpacks/staticfile-buildpack'... 2016-03-17 09:31:32 +0000 [STG] OUT -----> Downloaded app package (36K) 2016-03-17 09:31:32 +0000 [API] OUT Updated app with guid c2822093-11ee-4d66-b76e-f45858399aad ({"state"=>"STARTED"}) 2016-03-17 09:31:31 +0000 [DEA] OUT Got staging request for app with id c2822093-11ee-4d66-b76e-f45858399aad 2016-03-17 09:31:04 +0000 [API] OUT Created app with guid c2822093-11ee-4d66-b76e-f45858399aad 2016-03-17 09:31:44 +0000 [API] OUT App instance exited with guid c2822093-11ee-4d66-b76e-f45858399aad payload: {"cc_partition"=>"default", "droplet"=>"c2822093-11ee-4d66-b76e-f45858399aad", "version"=>"9f449a74-351c-4715-bb1e-2c582ff3b8ee", "instance"=>"2b9c06ab60944d31ac4442065360ff5e", "index"=>0, "reason"=>"CRASHED", "exit_status"=>1, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1458207104} 2016-03-17 09:31:04 +0000 [API] OUT Updated app with guid c2822093-11ee-4d66-b76e-f45858399aad ({"route"=>"7adc89a8-cb8c-4131-9d30-b622847cbac2"})

cf-gitbot commented 8 years ago

We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/115845431.

Dannyzen commented 8 years ago

Thank you for reporting this issue we will look into promptly. On Mar 17, 2016 5:55 AM, "cf-gitbot" notifications@github.com wrote:

We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/115845431.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/cloudfoundry/staticfile-buildpack/issues/71#issuecomment-197795444

davidjahn commented 8 years ago

Hi @wolfgangkirchler , I am trying to understand your error so that we can push out a fix for the staticfile buildpack as soon as possible.

I am not able to replicate the error. Could you possibly provide me with the following information if it is available?

It would be easiest if you could provide a sample application that is giving the above error, otherwise the above information would be very useful. Thank you!

wolfgangkirchler commented 8 years ago
$ cf curl /v2/info
{
   "build": "2222",
   "version": 2,
   "api_version": "2.23.0",
}

We run on DEA and not on Diego.

We have a custon nginx.conf but no additional modules. Here is my nginx.conf:

worker_processes 1;
daemon off;

error_log <%= ENV["APP_ROOT"] %>/nginx/logs/error.log debug;
events { worker_connections 1024; }

http {
  log_format cloudfoundry '$http_x_forwarded_for - $http_referer - [$time_local] "$request" $status $body_bytes_sent';
  access_log <%= ENV["APP_ROOT"] %>/nginx/logs/access.log,severity=debug,tag=nginx cloudfoundry;
  default_type application/octet-stream;
  include mime.types;
  sendfile on;
  gzip on;
  tcp_nopush on;
  keepalive_timeout 0;   # disable keepalive
  port_in_redirect off; # Ensure that redirects don't include the internal container PORT - <%= ENV["PORT"] %>

  real_ip_header    X-Forwarded-For;
  set_real_ip_from  0.0.0.0/0;
  real_ip_recursive on;

  client_max_body_size 25m;

  # DNS resolver, the resolved upstream IP addresses will be cached 30s before another resolution
  resolver 8.8.8.8 valid=30s; # Google DNS

  server {
    listen <%= ENV["PORT"] %>;
    server_name localhost;
    # Allow header size up to 32K
    large_client_header_buffers 4 32k;

    ### some forwarding rules 

  }
}
davidjahn commented 8 years ago

Does the section ### some forwarding rules try to access a custom config file ip-restriction.txt ? The error log

2016-03-17 09:31:44 +0000 [App/0] ERR /home/vcap/app/nginx/conf/orig.conf:52:in `read': No such file or directory - ip-restriction.txt (Errno::ENOENT)

indicates that nginx cannot find the file ip-restriction.txt. We recently made a change where we move files from the app root directory into the nginx public directory, and no longer copy them. If you refer to config files in the root directory of your app, this will break.

If you change the include command (or whatever you are using to add ip-restriction.txt) to

include <%= ENV['APP_ROOT'] %>/public/ip-restriction.txt

does the app successfully deploy with staticfile-buildpack v1.3.3?

wolfgangkirchler commented 8 years ago

@davidjahn: thank you. That was exactly the problem. After I moved ip-restrictions.txt to public folder the service did start up again. :)

jtarchie commented 8 years ago

@wolfgangkirchler, are you using the staticfile buildpack mainly as an nginx buildpack?

wolfgangkirchler commented 8 years ago

@jtarchie: yes thats our main purpose. And we use nginx mainly as reverse proxy.

jtarchie commented 8 years ago

I am hoping that the router services will help solve that problem for you. The staticfile-buildpack was never meant to be a nginx buildpack, nginx was just a nice side effect. Just want to make sure that future changes we make the buildpack to optimize for static content, don't effect large deployments of nginx being used for reverse proxy purposes.