Ruby on Rails support in Virtualmin


This page says that an Install Script can be used for Ruby on Rails, but I can’t find it… I guess it no longer exists? or am I looking in the wrong places?

Can you please let me know if any support for Ruby on Rails exists?

Thank you

Hello @pjbelo and welcome to the Virtualmin community forums.

You are right, the documentation does say that Ruby on Rails is one of the scripts offered at Virtualmin → Install Scripts. However, this script is available only in the Pro version of Virtualmin, not in the GPL version. The documentation should have been clear about this.

You could install it yourself, manually - see Installing Ruby

1 Like

Given all the changes in the Ruby on Rails ecosystem that have happened, and at a quite rapid pace, over the years, I can’t really recommend the Install Script for Ruby on Rails at the moment (even if it were in GPL).

Jamie’s refactoring the proxying and port protection features a bit to make it more obvious how to run any web app server (whether that’s Rails with Puma or Unicorn or something Node or Python or Perl) under Virtualmin without needing root access to set it up. I think that’s in the next version coming really soon…but it might be the next version after that. I haven’t followed his checkins lately to know what he’s been working on. But I know this is on his todo list.

Right now, the way I’m running our Ruby on Rails apps is to set them up in the way recommended by the application in question (our Discourse runs in a docker container with puma, the new ecommerce thing I’m working on is currently Solidus also running under puma but not in a docker container). Both have ProxyPass/ProxyPassReverse rules setup to handle getting from port 80/443 to port 3000 (or whatever) on localhost. This is how you should run any app with its own web server under Virtualmin, it is very generic and applies to everything modern. (PHP-FPM is roughly the same model, we just happen to have a lot more specialized support for it because of the much higher popularity of PHP in shared hosting environments.)


Hi @calport, thanks for your help!

In fact I had already installed ruby. My next step would be installing Puma (app server) and configuring reverse proxy in Apache, but I don’t have much experience in these topics and I can´t find any clear (and simple) documentation so I was looking into the install scripts…

Hi @Joe, thanks for your reply and for pointing some directions that can be followed. Also good to know about the new features coming in the next (or after) version.

There is an “Edit Proxy Website” menu item in Server Configuration, which I think can do the thing for proxying. I think you’d just proxy to http://localhost:3000 or whatever and make sure your app allows the hostname of the virtual server to reach it…in Ruby on Rails this might be set in config.hosts in your environments files, though I think some apps default to being accessible to anyone that can reach them. That’s not a Virtualmin question, though, and I am, by no means, an expert on Ruby on Rails. But, the Virtualmin side is pretty opaque, which is why it’s getting an overhaul, since nearly every modern web app needs to be deployed in the same way.

I believe I’ve used custom rules in my cases, which just look something like this (maybe with a Match rule added to make it skip .well-known so Let’s Encrypt can work).

ProxyPass "/" "http://localhost:3000/"
ProxyPassReverse "/" "http://localhost:3000/"
ProxyPreserveHost On

Obviously if more than one app runs on the system, each will need its own port. Right now, we only handle protecting those ports from other users squatting on them for apps installed via Install Scripts, but that’s one of the features being worked on, along with a user-owned startup utility (so apps started on boot can be safely managed by non-root users).

Anyway, none of this stuff is really Virtualmin or Ruby on Rails specific. Every app is being deployed in some variation of this. You have an app server (puma in our RoR case) that runs the app, and you have a frontend server (Apache or nginx doesn’t matter) that proxies to it. No matter what language or framework, that’s pretty much how everybody is doing it, so when you read up on deploying modern web apps it’s always gonna be some minor variation on this theme. We’ve just been a little slow to adopt that as an obvious/clear/foolproof process in Virtualmin, due to my failure to communicate requirements clearly to Jamie mostly!