Open katafrakt opened 3 years ago
Not only for Heroku (starting November 28th free dynos will no longer be available). So for PaaS/VPS and for 12 factor app ideology all these three issues need to be implemented. So, I solve 3rd issue/"graceful shutdown" with:
# Shutdown the application before forking
before_fork do
@_app.shutdown if instance_variable_defined?(:@_app)
end
Recently I have deployed an app from the template to Heroku and I needed to tweak a few things. Listing them here, so we can discuss which of them should make it to the code (I will be happy to prepare PRs, once we decide) - or at least be a checklist for someone else facing similar problems.
Gemfile.lock
andyarn.lock
currently the are in.gitignore
and Heroku does not allow that (I see now it's partly addressed by b38df3aff7e758bd765ccc8035d7887327d950b2)/public
Currently there's this in
config.ru
:I had to change to root to
root: ENV['PRECOMPILED_ASSETS'] == 'true' ? "public" : ".assets/tmp"
, so it serves precompiled assets from/public
. I'm not really sure what's the deal with.assets
directory though, so there might be other solution for this.before_fork
(Sequel::DATABASES.each(&:disconnect)
) - I'm not sure here if it's somethingHanami.shutdown
should do, but for now manual disconnect is required.