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年前2148ビュー
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年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ