dark_ruby
dark_ruby

Reputation: 7874

Do I need multiple unicorn instances running to serve different rails websites?

I'm new to unicorn, digitalocean default Rails configuration seems to only support one rails app at a time.

my unicorn config currently looks like this:

listen "127.0.0.1:8080"  
worker_processes 2  
user "rails"  
working_directory "/home/rails"  
pid "/home/unicorn/pids/unicorn.pid"  
stderr_path "/home/unicorn/log/unicorn.log"  
stdout_path "/home/unicorn/log/unicorn.log"  

unicorn process is set to start automatically on startup in /etc/init.d/unicorn

is it possible to specify multiple applications, listening on different ports/unix sockets or do they need to be separate unicorn processes, I need them start automatically on startup

Upvotes: 2

Views: 1075

Answers (1)

Michael Trojanek
Michael Trojanek

Reputation: 1953

Each unicorn holds the code for one Rails application. So if you want to run multiple Rails apps, you need multiple unicorn master processes (each spawning children).

You can easily create different startup-scripts (/etc/init.d/unicorn-app1, /etc/init.d/unicorn-app2 …) for these unicorns as long as lockfiles, pidfiles and ports don't clash.

Upvotes: 1

Related Questions