Virtualmin with perl frameworks (Mojolicious)

Hi, this is my first time using Virtualmin, so I was wondering if there are any specific requirements when I am using one of the perl web frameworks. Specifically Mojolicious in this case.

Do I understand correctly that I first create a Virtual Server.
Then I can move all the perl files into the home directory created
Then edit the conf files under Webmin Apache
And then add make a systemd file to execute hypnotoad on boot?

Or is there a more automated/correct way in Virtualmin to do this?

Thank you very much in advance!


OS type and version RockyLinux 8.5
Virtualmin version 7.0

You’ve got it pretty close to right.

Running any web app that has an app server (like hypnotoad) is pretty much the same as in any Apache or nginx config. Run the app server (whichever one you like) and then proxy to it in the web server. Virtualmin has a simplified GUI for setting up proxy rules, if you prefer it (though I think the GUI isn’t as intuitive as it could be, though I think maybe Jamie updated the text in the most recent update to make it a little clearer). If you like the Webmin Apache module for this, I think that’ll work, too.

Virtualmin has a user init module, as well, that allows you to have domain-owned services started automatically as the user when Webmin starts (and they’re editable by the user, which is a feature in a shared hosting environment). But, if you’re comfortable with systemd, it’s just plain better at managing services than our simplistic Perl implementation of an init system.

If it’s something you’ll be doing a lot of, i.e. many very similar deployments, you can probably automate most of it with Server Templates, and putting the app and such into the skel directory. There are pre- and post-creation scripts you can have Virtualmin run automatically, as well.

1 Like

Hi Joe,

Thank you very much for the detailed response.

I’ll have a go with user init, perhaps it’s better at handling PATH then systemd…

I doubt it. systemd is a bazillion human years of development. They’ve thought of everything. virtualmin-init was an afternoon project for Jamie. Its only benefit is that it’s possible for domain owners to manage the services themselves.

But, you can do that sort of thing with systemd, as well, just not in the GUI (though I guess we should implement something for it, now that systemd has replaced other init systems on every distro we support). Here’s some docs on it (not necessarily the best docs, just the first thing I found that looked reasonable): systemd/User - ArchWiki

Thank you very much!

Perhaps, adding it as an install scripts would help?

It would be one of the trickier ones to support, I think, similar to Ruby on Rails or Django, though Mojo is very lightweight compared to those, in terms of dependencies, and is a little less insistent on having the latest Perl version (Mojo rolls its own object system, and is extremely concise, among my favorite web frameworks, actually!).

And, the way we do those is suboptimal. Ideally we’d be using a per-app environment. Python uses virtualenv (or pipenv or poetry, etc.) for this. Ruby has…rbenv and/or Bundler, maybe? Perl has a few competing ones, I’ve used plenv in the past, but Carton and perlbrew seem to be leading.

I haven’t followed closely enough to know what’s considered best practice in the Perl world lately. I have to work in Python for my other job, so Perl is mostly off my radar except for Virtualmin (and I don’t touch a lot of the code in Virtualmin).