-
-
Save vormwald/4424558 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'unicorn' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add these changes | |
config.assets.precompile += %w( *.js *.css ) | |
config.assets.initialize_on_precompile = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes 3 | |
timeout 30 | |
preload_app true | |
before_fork do |server, worker| | |
# Replace with MongoDB or whatever | |
if defined?(ActiveRecord::Base) | |
ActiveRecord::Base.connection.disconnect! | |
Rails.logger.info('Disconnected from ActiveRecord') | |
end | |
# If you are using Redis but not Resque, change this | |
if defined?(Resque) | |
Resque.redis.quit | |
Rails.logger.info('Disconnected from Redis') | |
end | |
sleep 1 | |
end | |
after_fork do |server, worker| | |
# Replace with MongoDB or whatever | |
if defined?(ActiveRecord::Base) | |
ActiveRecord::Base.establish_connection | |
Rails.logger.info('Connected to ActiveRecord') | |
end | |
# If you are using Redis but not Resque, change this | |
if defined?(Resque) | |
Resque.redis = ENV['REDIS_URI'] | |
Rails.logger.info('Connected to Redis') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment