16

I am new to AWS Beanstalk-Rails-Puma-Nginx. After deploying my RAILS app to Beanstalk, all my api calls work fine, but HTML pages are causing error.

When opening my HTML page -

  1. Nginx throws 502 Bad Gateway error.
  2. Puma log :
    Started GET "/admin" for 182.70.76.160 at 2016-04-22 05:13:19 +0000 Processing by Devise::SessionsController#new as HTML Rendered devise/sessions/new.html.erb within layouts/application (6.1ms) [18858] ! Terminating timed out worker: 22913
  3. var/app/current/production.log is empty.

Read somewhere, that adding SSL could solve. Is it required to added SSL?

Please help! I am stuck!

STATUS : My assets were huge because of which it was killing itself. I was using a theme and removed all the unnecessary js, css and images.

Now, Puma doesn't terminate, but it doesnot compile assets. I had selected Ruby as application type so it should do it for me, correct?

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Disha
  • 776
  • 9
  • 19

2 Answers2

14

Try setting worker timeout to a higher value in puma config. Default value is 60 seconds

worker_timeout 100

It is possible that you are creating more workers than the server could handle. Try decreasing the worker count or increasing the server capacity.

Sebin
  • 1,044
  • 1
  • 8
  • 21
  • 1
    Hey Sebin! I tried this, but doesn't work. I just have 2 workers running so I don't think thats an issue. – Disha Apr 25 '16 at 05:31
  • Have you tried other log files and get more info? I am not aware of your deployment setup, but for me, I have puma access and error logs. – Sebin Apr 25 '16 at 06:42
  • Yes! I have. But no leads. If you want more information about any logs, let me know. – Disha Apr 25 '16 at 06:53
  • If there is any error trace in any of the logs, you could update it in the question. Also I suggest you trying with one worker. – Sebin Apr 25 '16 at 07:41
  • I tried with one worker but no luck. I am updating my question with the status. – Disha Apr 28 '16 at 04:54
7

For now I moved to EC2 as EBS issues weren't getting solved. I had the same issue on EC2 but I could fix it as I access my machine.

Puma workers were timing out because my assets weren't precompiled. Everytime I take a new build on server, I have to run the following :

RAILS_ENV=production rake assets:precompile
Disha
  • 776
  • 9
  • 19