1
votes

I have rails app running on unicorn+nginx. Now i wanted to deploy another small sinatra app sub uri(localhost:3000/test). Same requirement i achieved on passenger+nginx combination.

Deploying a rails app to a sub uri with passenger and nginx

Any suggestion will be appropriated.

1
I think you should go for mountable engine guides.rubyonrails.org/engines.html#hooking-into-an-applicationMike Szyndel

1 Answers

0
votes

I am assuming that you already know hoe to setup Ngnix with one Unicorn.

There are now fundamentally two ways you can do what you need.

Approach 1

Run another Unicorn (different folder, different port). For the URL pattern, setup another location in Nginx and set proxy directive to this Unicorn instance.

Approach 2

If you want to run both of these application in the same Ruby process, Rack can be used to send a set of URL patterns to Sinatra Application and rest to your Rails Application. If you are using Rails 3, you can do this in your routes.rb as well.

Please let me know if you need sample code for any of these approaches.