Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad Gateway on Heroku Restart #54

Closed
adailey14 opened this issue May 6, 2015 · 1 comment
Closed

Bad Gateway on Heroku Restart #54

adailey14 opened this issue May 6, 2015 · 1 comment

Comments

@adailey14
Copy link

I'm running this (awesome) buildpack with Puma, and Heroku deployments seem to work perfectly with nginx waiting for puma to start before accepting requests. However I notice that when I do a "heroku restart", I end up getting Bad Gateway 502 errors for the time between nginx re-starting and puma re-starting (at least that's what I think is happening).

Could this be because the /tmp/app-initialized file has already been created from the first deploy, and is not deleted? Should I be deleting the file on restart to prevent this? Sorry if this is an obvious issue - I don't fully understand how heroku's "ephemeral file system" works.

@adailey14
Copy link
Author

Aha I figured out what was going on here. I was touching /tmp/app-initialized in my puma.rb config file - which was happening before puma / rails was actually ready to accept requests. Instead, I moved the file touch to an "after_initialized" block in my production.rb config file like this:

MyApp::Application.configure do
config.after_initialize do
FileUtils.touch('/tmp/app-initialized')
end
end

And now everything is working fine. So I'll be closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant