Comments (4)
Put config.ru file on root directory of your Rails project, example for Rails-4 application
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Rails.application
from mina-unicorn.
@tab Thanks for getting back to me. I already have that in my config.ru file in the root of my app. I'm guessing Unicorn can't find it?
from mina-unicorn.
Got it.
Another tutorial had me setting my working_directory
to /home/deployer/my_app
... it should have been /home/deployer/my_app/current
Thanks for your help!
from mina-unicorn.
@jmccartie, I'm glad to see you got it!
By the way you can use this unicorn.rb config file, it work with Rails-3 and Rails-4 applications.
# Set your full path to application.
app_dir = File.expand_path('../../', __FILE__)
# Set unicorn options
worker_processes 2
preload_app true
timeout 360
# Fill path to your app
working_directory app_dir
# Set up socket location
listen "#{app_dir}/tmp/sockets/unicorn.sock", :backlog => 64
# Loging
stderr_path "#{app_dir}/log/unicorn.stderr.log"
stdout_path "#{app_dir}/log/unicorn.stdout.log"
# Set master PID location
pid "#{app_dir}/tmp/pids/unicorn.pid"
before_fork do |server, worker|
defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect!
old_pid = "#{server.config[:pid]}.oldbin"
if File.exists?(old_pid) && server.pid != old_pid
begin
sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU
Process.kill(sig, File.read(old_pid).to_i)
rescue Errno::ENOENT, Errno::ESRCH
# someone else did our job for us
end
end
end
after_fork do |server, worker|
defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection
end
before_exec do |server|
ENV['BUNDLE_GEMFILE'] = "#{app_dir}/Gemfile"
end
from mina-unicorn.
Related Issues (16)
- unicorn_role setting not used HOT 1
- Question HOT 1
- Unicorn searching gems in outdated releases HOT 3
- Using mina/unicorn with rails - where does the rails environment get set? HOT 2
- Not stopping Unicorn HOT 1
- "deployment" environment HOT 4
- mina unicorn:start using wrong directory HOT 4
- Mina beta2 bugs with mina-unicorn HOT 7
- mina/rails should not be required HOT 3
- Forward SECRET_KEY_BASE ? HOT 1
- Add to readme HOT 3
- Suggestion - Restart raise error HOT 2
- Supports mina 0.3.1? HOT 1
- Doesn't respect mina/bundler's bundle_bin setting HOT 1
- Unicorn not starting when using mina HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mina-unicorn.