Ruby app with non-system Ruby
Valentin V. Bartenev
vbart at nginx.com
Tue Jan 29 16:04:23 UTC 2019
On Tuesday 29 January 2019 12:30:24 megatux at gmail.com wrote:
> Hi,
> I'm having trouble setting a new Ruby app. I'm unable to use a Ruby
> different than the system one.
>
> My idea is to have several rack web apps on different ports (or URIs if
> possible) but using a Ruby installation from a version manager, like rbenv,
> RVM, asdf.
>
> I have both Unit .deb installation and Docker installation.
>
> So, to make it simple, let's say I want 2 web apps, a Rails app and a
> Sinatra app, each one using a different Ruby installation within the "asdf"
> language version manager (it could be same user or not). Is it possible?
> Then, if the two apps are APIs, can I migrate _progressively_ different
> endpoints?
>
> Thanks a lot.
>
Because of perfomance reasons Unit doesn't use command-line interptreter
directly from a version manager (that would be unallowable slow).
In order to use Ruby from a version manager, you have to compile a Unit
module with this particular Ruby interpreter.
See here for details on compiling your own Ruby module from sources:
http://unit.nginx.org/installation/#configuring-ruby
Having modules of each version you will be able to switch between them
via control API socket on a per application basis.
See here for the "type" option details:
http://unit.nginx.org/configuration/#application-objects
wbr, Valentin V. Bartenev
More information about the unit
mailing list