Please note that these documents apply to OpenShift Online v2 only (accounts created before August 1st, 2016).
If you are using one of the OpenShift 3 products, please refer to documents available at docs.openshift.com.

Perl Application Hosting

Want a Dancer application backed by MySQL? Or maybe you’re looking for Mojolicious and MongoDB? OpenShift Online currently supports Perl 5.10.

Perl is a high-level, general-purpose dynamic programming language. With OpenShift you can easily deploy and run Perl applications using your favorite frameworks and databases.

Perl logo

Simplify Your Perl Deployments

Getting a Perl app with a MySQL backend deployed onto OpenShift is as easy as executing two commands:

$ rhc app create MyApp perl-5.10
$ rhc cartridge add mysql-5.5 -a MyApp

These two commands create your gear and install and configure Perl, MySQL, and a git repository. You can now visit your application on the web at:

http://MyApp-MyDomain.rhcloud.com/

The Perl Cartridge

The perl cartridge provides Perl on OpenShift.

Template Repository Layout

index.pl
.openshift/           Location for OpenShift specific files
    action_hooks/     See the Action Hooks documentation (1)
    markers/          See the Markers section below
    cpan.txt          List of modules to install
1 Action Hooks documentation

Due to changes in Perl cartridge template layout, the application root is now stored in $OPENSHIFT_REPO_DIR, but is also backward compatible with deprecated perl/ directory.

Modules are installed with cpan.txt, located in the .openshift/ directory. In addition, application dependencies can be installed using cpanfile or Makefile.PL placed in the .openshift/ folder. deplist.txt is deprecated in favor of .openshift/cpan.txt.

Cartridge Layout

run/                  Various run configs (like httpd pid)
usr/                  Perl example application template
env/                  Environment variables
logs/                 Log data (like httpd access/error logs)
lib/                  Various libraries
bin/setup             The script to setup the cartridge
bin/build             Default build script
bin/teardown          Called at cartridge destruction
bin/control           Init script to start/stop httpd
versions/             Version data to support multiple perl versions (copied into place by setup)

Markers

Adding marker files to .openshift/markers will have the following effects:

Marker Effect

force_clean_build

Will remove all previous perl deps and start installing required deps from scratch

enable_cpan_tests

Will install all the cpan packages and run their tests

hot_deploy

Will prevent the apache process from being restarted during build/deployment

disable_auto_scaling

Will prevent scalable applications from scaling up or down according to application load.

enable_public_server_status

Will enable server-status application path to be publicly available.