Sunday, 2 November 2014

unicorn on heroku

In  config/unicorn.rb


 
config/unicorn.rb
# With a typical Rails memory footprint, you can expect to run 2-4 Unicorn worker processes.
# https://devcenter.heroku.com/articles/rails-unicorn
# config/unicorn.rb
worker_processes Integer(ENV["WEB_CONCURRENCY"] || 1)
timeout 15
preload_app true
before_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
Process.kill 'QUIT', Process.pid
end
defined?(ActiveRecord::Base) and
ActiveRecord::Base.connection.disconnect!
end
after_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT'
end
defined?(ActiveRecord::Base) and
ActiveRecord::Base.establish_connection
end
view raw gistfile1.rb hosted with ❤ by GitHub
Procfile

 
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
view raw gistfile1.txt hosted with ❤ by GitHub
Gemfile






 
source 'https://rubygems.org'
ruby '2.1.3'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.6'
gem 'unicorn'
group :production do
gem "rails_12factor"
end
gem "pg"
group :development, :test do
# gem "sqlite3", :require => "sqlite3"
gem "better_errors"
gem "binding_of_caller"
end
gem "faker"
gem "devise"
gem 'simple_form'
gem 'annotate'
gem 'bootstrap-generators', '~> 3.0.2'
gem 'high_voltage'
gem 'will_paginate', '~> 3.0'
gem 'will_paginate-bootstrap'
gem 'groupdate'
gem 'chartkick'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
# gem 'jquery-rails'
# Use sqlite3 as the database for Active Record
# gem 'sqlite3'
# Use SCSS for stylesheets
# gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
# gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
# gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
# gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
# gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
# gem 'sdoc', '~> 0.4.0', group: :doc
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
view raw gistfile1.txt hosted with ❤ by GitHub
or start on localhost bundle exec unicorn -p 3000

No comments:

Post a Comment