4

I am trying to deploy a Ruby on Rails API to AWS Elastic Beanstalk without any luck. I could once deploy succesfully and I'd only got errors because production environment doesn't db:seed. But suddenly every time i wanted to deploy I would have the following errors on logs

-------------------------------------
/var/app/support/logs/passenger.log
-------------------------------------
[ 2016-12-16 13:22:39.2849 5408/7f442ea10780 agents/Watchdog/Main.cpp:728 ]: All Phusion Passenger agents started!
2016/12/16 13:22:40 [error] 5427#0: *3 "/var/app/current/public/index.html" is not found (2: No such file or directory), client: 127.0.0.1, server: _, request: "HEAD / HTTP/1.1", host: "0.0.0.0"
2016/12/16 13:22:40 [error] 5427#0: *3 testing "/var/app/current/public" existence failed (2: No such file or directory) while logging request, client: 127.0.0.1, server: _, request: "HEAD / HTTP/1.1", host: "0.0.0.0"


-------------------------------------
/var/log/eb-activity.log
-------------------------------------
  + service passenger restart
   --> Downloading a Phusion Passenger agent binary for your platform
  ---------------------------------------
  No precompiled Nginx engine could be downloaded. Compiling it from source instead.
  --------------------------------------------

  Your system does not have a lot of virtual memory

  Installing...
  Downloading Nginx 1.8.1 source code...
  Extracting tarball...
  Compiling support libraries (step 1 of 2)...
  Compiling Nginx engine (step 2 of 2)...

  ./configure: error: invalid option "--with-http_v2_module"
  *** ERROR: command failed: cd /tmp/passenger-install.158a2iu/nginx-1.8.1 && env PASSENGER_INCLUDEDIR=/opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/passenger-5.1.0/src PASSENGER_LIBS=/tmp/passenger-install.158a2iu/common/libpassenger_common/Logging.o\ /tmp/passenger-install.158a2iu/common/libpassenger_common/Exceptions.o\ /tmp/passenger-install.158a2iu/common/libpassenger_common/Utils/SystemTime.o\ /tmp/passenger-install.158a2iu/common/libpassenger_common/Utils/StrIntUtils.o\ /tmp/passenger-install.158a2iu/common/libpassenger_common/Utils/StrIntUtilsNoStrictAliasing.o\ /tmp/passenger-install.158a2iu/common/libpassenger_common/Utils/IOUtils.o\ /tmp/passenger-install.158a2iu/common/libpassenger_common/Utils.o\ /tmp/passenger-install.158a2iu/common/libpassenger_common/WatchdogLauncher.o\ /tmp/passenger-install.158a2iu/common/libpassenger_common/AppTypes.o\ /tmp/passenger-install.158a2iu/common/libpassenger_common/Utils/CachedFileStat.o\ /tmp/passenger-install.158a2iu/common/libpassenger_common/UnionStationFilterSupport.o\ /tmp/passenger-install.158a2iu/common/libboost_oxt.a /bin/bash ./configure --prefix=/tmp --with-cc-opt=-Wno-error --without-http_fastcgi_module --without-http_scgi_module --without-http_uwsgi_module --with-ipv6 --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_addition_module --add-module=/opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/passenger-5.1.0/src/nginx_module

I even git revert commits in order to go back to the version that deployed succesfully but got the same errors!

PD: Another thing I had to do (before it worked the first time) was set the Root volume size of the EC2 instance to 16 GiB because i would get the error that nokogiri gem couldn't be installed by budler, and it actually fixed that

lucasrod
  • 93
  • 1
  • 12
  • Why are you using version 1.8.1 of nginx? That was released nearly a year ago, and is listed as a "legacy" version on nginx's downloads page... Also, if you want to run `db:seed` on deploy, create a file under `.ebextensions` and use a container_commands directive to do so. More details can be found here: http://stackoverflow.com/questions/14371615/how-do-you-call-dbseed-on-aws-elastic-beanstalk-apps – Brian Dec 16 '16 at 14:49
  • @lucas-rodriguez Have you been able to resolve this issue? – einSelbst Jun 02 '17 at 09:10

1 Answers1

2

The error you are seeing is almost probably because you have Passenger Gem listed in the Gemfile. Removing it or putting it into the development section if needed should solve the issue. Passenger is pre-installed on the AWS ElasticBeanstalk Ruby Stack.

einSelbst
  • 2,099
  • 22
  • 24
  • I'm running into the exact same issue and did in fact have `Passenger` in the Gemfile. However, the error persists after removing it. When this app was previously configured on DigitalOcean, it had to be restarted manually by running `touch tmp/restart.txt`. Do you think I need to do something of the sort here? – John O'Sullivan Jun 15 '17 at 07:54
  • If you haven't done so I would try to rebuild the ElasticBeanstalk environment. This can be done via AWS console. – einSelbst Jun 17 '17 at 15:37
  • Yup! After I'd removed `Passenger`, restarting the project in a fresh environment did the trick. Must've somehow permanently borked it. – John O'Sullivan Jun 17 '17 at 23:14