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

demandé il y a 4 ans2147 vues
4 réponses
0
Réponse acceptée

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

répondu il y a 4 ans
0

A thousand thanks!

répondu il y a 4 ans
0

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

have you seen this? thanks!

répondu il y a 4 ans
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

répondu il y a 3 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions