The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Pepper::Commander

DESCRIPTION / PURPOSE

This package provides all the functionality for the 'pepper' command script, which allows you to configure and start/stop the Pepper Plack service. The 'pepper' command must be run as root or via sudo, and expects at least one argument.

sudo pepper setup

This is the configuration mode and must be run as root or via sudo. The Pepper workspace will be created under /opt/pepper, unless it already exists. You will be prompted for the configuration options, and your configuration file will be created or overwritten.

pepper test-db

This will perform a basic connection / query test on the database config you provided via 'pepper setup'.

pepper set-endpoint [URI] [PerlModule]

This creates an endpoint mapping in Pepper to tell Plack how to dispatch incoming requests. The first argument is a URI and the second is a target Perl module for handing GET/POST requests to the URI. If these two arguments are not given, you will be prompted for the information. Use 'default' for the URI to set a default endpoint handler.

If the Perl module does not exist under /opt/pepper/lib, an initial version will be created.

pepper list-endpoints

This will output your configured endpoint mappings.

pepper test-endpoint [URI]

This will run Plack::Test against the URI's endpoint to see that it will return 200 OK. This is not a test of functionality, just a test that the endpoint executes and returns 200.

pepper delete-endpoint [URI]

Removes an endpoint mapping from Pepper. The Perl module will not be deleted.

pepper start [#Workers] [dev-reload]

Attempts to start the Plack service. Provide an integer for the #Workers to spcify the maximum number of Plack processes to run. The default is 10.

If you indicate a number of workers plus 'dev-reload' as the third argument, Plack will be started with the auto-reload option to auto-detect changes to your code. If that is not provided, you will need to issue 'pepper restart' to put your code changes into effect. Enabling dev-reload will slow down Plack significantly, so it is only appropriate for development environments.

pepper restart

Restarts the Plack service and put your code changes into effect.