Elastic beanstalk is not reading environment variables.

0

Hello,
I'm running a Rails 6 app on AWS Elastic Beanstalk, but I get from puma log the following (repeats every few seconds)

[X] + Gemfile in context: /var/app/current/Gemfile
[X] Early termination of worker

The version numbers:
Rails 6.0.3.3
puma 4.3.5
ElasticBeanstalk Ruby 2.7 running on 64bit Amazon Linux 2/3.1.1
ruby 2.7.1p83

The server is unresponsive from outside the instance, and there's nothing on log/production.log.
Running on a dev machine on production mode there's no errors, and the database is reachable (no migration failure).
I ran the Rails console (production) on the instance and found that the database settings were missing. When I hardcoded them, the database was reachable and working.
I then found that none of the environment variables set on ElasticBeanstalk web console are present (as opposed to what the documentation describes).

Is this a platform bug, or am I missing a way to define environment variables?

Edited by: arsawatt on Sep 21, 2020 5:19 PM

Edited by: arsawatt on Sep 21, 2020 10:29 PM

已提問 4 年前檢視次數 2149 次
4 個答案
0
已接受的答案

I have the same problem with the same configuration. However I have all the environment variables properly set.

Rails 6.0.3.3
puma 4.3.5
ElasticBeanstalk Ruby 2.7 running on 64bit Amazon Linux 2/3.1.1
ruby 2.7.1p83

No problems in dev, but puma/nginx are not working properly. In /var/app/puma/puma.log, I get the same occurence:

[X] + Gemfile in context: /var/app/current/Gemfile
[X] Early termination of worker


SOLVED!
In my case, the problem was a puma dependency that has been silently updated.
I ssm'ed into the machine, executed 'pumactl start' and got an error:

/opt/rubies/ruby-2.7.1/lib/ruby/site_ruby/2.7.0/bundler/runtime.rb:312:in check_for_activated_spec!': You have already activated nio4r 2.5.2, but your Gemfile requires nio4r 2.5.4. Prepending bundle exec` to your command may solve this. (Gem::LoadError)

then I doublechecked the pull request and noticed that the gem nio4r was updated.

The solution was forcing the nio4r to 2.5.2 in the Gemfile.

Hope it is suitable for you too.

Best Regards,
Pedro

Edited by: pedrorgomes on Sep 22, 2020 8:51 AM

已回答 4 年前
0

A thousand thanks!

已回答 4 年前
0

follow up question:
upgrading to ElasticBeanstalk Linux 2/3.1.2 broke things again.

have you seen this? thanks!

已回答 4 年前
0

Beware if you bundle update in August 2021, as nio4r bumped to version 2.5.8 during the last month, and this doesn't match the version on the current Beanstalk platform Ruby 2.7 AL2 version 3.3.4

Edited by: philayres on Aug 31, 2021 4:35 PM

已回答 3 年前

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

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

回答問題指南