using unicorn as a local development server
normalperson at yhbt.net
Thu Feb 23 04:30:07 UTC 2012
"Patrick J. Collins" <patrick at collinatorstudios.com> wrote:
> Hi Unicorn friends,
> I wanted to try out Unicorn as my development server and I see that I
> need to perform some configuration to make this work nicely with rails.
> >From what I can tell the only real things I need to do to make unicorn
> similar to the default rails server is to supply a config file with:
> listen 3000
> logger Logger.new(STDOUT)
You shouldn't even need the logger directive, it goes to stderr by
default so your console will still show it.
> After creating this file, I was kind of confused as to how to proceed..
> Should I made a bash alias like
> alias unicorn="unicorn_rails -c /path/to/unicorn_config.rb"
I generally avoid shell aliases for per-app/project things since I
split my work across different apps + terminals + machines.
If I'm (rarely) developing an app that _requires_ a persistently running
web server, I'd just run in the foreground and Ctrl-C/<uparrow+enter> to
use my shell history.
Normally I just write integration tests (sometimes starting unicorn (or
zbatery) + hitting it with curl, but often just mocking a Rack env).
Unlike most folks that develop apps that run over HTTP, I have a strong
aversion to web browsers. I'd rather pipe curl output to "vim -" if I
have to look at any text output from the application.
You'll probably get different answers from other folks here :)
> and lastly, is there a convention where a configuration file like this
> should go on a unix/OS X system?
Nothing that I know of. It's quite common for Rails apps to have a
config/ directory, so maybe the unicorn config file is suitable there...
More information about the mongrel-unicorn