Catalyst§
To run apps based on the Catalyst 5.9+ framework using Unit:
Install Unit with a Perl language module.
Install Catalyst’s core files.
Create a Catalyst app. Here, let’s store it at /path/to/app/:
$ cd /path/to/
$ catalyst.pl app
$ cd app
$ perl Makefile.PL
Make sure the app’s .psgi file includes the lib/ directory:
use lib 'lib'; use app;
Run the following command so Unit can access the application directory:
# chown -R unit:unit /path/to/app/
Note
The unit:unit user-group pair is available only with official packages, Docker images, and some third-party repos. Otherwise, account names may differ; run the ps aux | grep unitd command to be sure.
For further details, including permissions, see the security checklist.
Next, prepare the Catalyst configuration for Unit (use real values for script and working_directory):
{ "listeners": { "*:80": { "pass": "applications/catalyst" } }, "applications": { "catalyst": { "type": "perl", "working_directory": "/path/to/app/", "script": "/path/to/app/app.psgi" } } }
Upload the updated configuration. Assuming the JSON above was added to
config.json
:# curl -X PUT --data-binary @config.json --unix-socket \ /path/to/control.unit.sock http://localhost/config/
Note
The control socket path may vary; run unitd -h or see Startup and Shutdown for details.
After a successful update, your app should be available on the listener’s IP address and port: