How to manage Mojolicious applications from the root user

In general, Mojolicious applications should be created by general users and deployed using the hypnotoad command.

In other words, the hypnotoad command usually needs to be executed by a general user. However, there is a desire to manage it from root. I think that it is often impossible to automate if you execute it after becoming a general user.

Also, if you are using perlbrew, you may end up using the default Perl if you run it from root, and you may run with root privileges.

Set user and group in the config file

I don't want to run it with root privileges, so let's set user and group in the hypnotoad config file. This allows child processes running in hypnotoad to run with user privileges.

[hypnotoad]

user = kimoto

group = kimoto

Set PATH if you are using perlbrew

If you're using perlbrew, you'll need to set the PATH environment variable because your perl isn't visible to root. So you need to wrap your application in a shell script and run it.

#! / bin / sh

PATH = "perl path: $PATH"
hypnotoad application path

Associated Information