How can I run a Rack-based application (not Rails) with unicorn? Let's assume I have a "hello world" response simple rack app with the name of server.ru
, and config file at the same directory with the name of unicorn.conf
, how am I supposed to run it? In Thin, for example, I would do something like:
bundle exec rackup server.ru -s thin -E production -p 4001
How would I do the same to run under Unicorn?
Unicorn does not give any special treatment to Rails 3+ applications, so the behavior is exactly the same for Rails 3+ applications and non-Rails Rack applications. Just run
unicorn
in your app's root. To run with a specific port, pass -p/--port
with the port:
unicorn -p 4001
You can also specify the rackup file:
unicorn server.ru
You can see all the options by running unicorn --help
. Of course, you should prepend bundle exec
to these commands as needed by your setup.
You can make a setting file for unicorn like this:
working_directory "/path/to/your/app"
listen 4001
pid "/tmp/unicorn.pid"
And then launch unicorn with the following command:
unicorn -c /path/to/your/setting/file.rb
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With