A harness for Node.js Cloud Foundry applications that makes debugging a bit easier.
cf-launcher wraps a simple web UI around your app, adding a visual debugger, a shell, and the ability to kill or restart your app process right from the web. If your app crashes or fails to start, the console output viewer shows you what happened.
The launcher UI takes over a single URL prefix in your application's URL space:
/launcher. If your app needs
/launcher, you can set the prefix to something else.
Install cf-launcher as a dependency in your app:
$ npm install --save cf-launcher
Change your app's start command to run
node_modules/.bin/launcher. This is usually done by editing your app's
manifest.yml. For example, if your
manifest.yml has this command:
command: node server.js
You would change it to this:
command: node_modules/.bin/launcher -- node server.js
Set a password. This step is crucial, as it prevents random web users from accessing your app's internals through cf-launcher.
The password can be provided as a command-line option (again, in your manifest.yml):
command: node_modules/.bin/launcher --password secretPassw0rd -- node server.js
Or you can set an environment variable named
LAUNCHER_PASSWORD in your application environment. This is usually done using the CF
$ cf set-env myapp LAUNCHER_PASSWORD secretPassw0rd
The command-line argument takes priority over the environment variable if both are set. If you don't provide a password, cf-launcher refuses to run.
Deploy your app.
https://your_application_url/launcher. You‘ll see the launcher login page. Log in with the password you provided earlier, and you’re all set.
cf-launcher [options] -- [COMMAND]
COMMAND is the command you usually use to start your app (for example,
Required. Gives the password used to log in to cf-launcher.
Optional. Gives the URL prefix reserved by cf-launcher. Defaults to
DEBUGenvironment variable enables debugging output from cf-launcher. Set it to “cf-launcher” to activate it:
$ cf set-env myapp DEBUG cf-launcher
(The DEBUG variable can enable debugging for multiple libraries simultaneously. See debug for details.)
PASSWORDenvironment variable gives the password used to log in to cf-launcher.
Once you‘ve logged in, you’re taken to a landing page that shows the status of your app, and the stdout/stderr log. Use the tabs on the top banner to access the debugger and shell.
When your app is ready for production, you should uninstall cf-launcher.
Remove cf-launcher from your app's dependencies:
$ npm uninstall --save cf-launcher
Restore your application's original start command.