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
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,
--password=secret Required. Gives the password used to log in to cf-launcher.
--urlprefix=prefix Optional. Gives the URL prefix reserved by cf-launcher. Defaults to
--cors=origin Optional. Enables CORS requests to cf-launcher from the given origin.
By default, CORS is not enabled.
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.
cf-launcher includes a WebDAV server, which provides access to the files in your app instance. Most operating systems ship with a WebDAV client built in, allowing you to map your instance files to a local drive or folder. You can then view and edit the files in your app instance as easily as local files.
WebDAV connection info:
HTTPS is mandatory when connecting from most WebDAV clients: accessing your files using an
http://.. URL will fail.
But who needs HTTP anyway?
For detailed setup instructions, see:
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.
cf-launcher can be controlled using the following environment variables:
DEBUG environment variable enables debugging output from cf-launcher. For example this:
$ cf set-env myapp DEBUG cf-launcher:*
will print all debug output from cf-launcher to standard output, meaning it will appear in your app's
To filter debug output, the following suffixes can appear after cf-launcher:
*: logs everything.
auth: logs login attempts and logouts.
proc: logs action taken by the process manager, which is responsible for managing the lifecycle of the target app and node inspector. It can be scoped down further:
proc:target: logs only actions related to the target app process.
proc:debugger: logs only actions related to the node-inspector process.
proxy: logs action taken by the reverse proxy, which takes over the web port and forwards requests based on the request URL.
webdav: logs WebDAV requests. (This is an alias for the
debugModeflag in the underlying jsDAV server.)
DEBUG variable is very flexible. See debug for full details.
cf set-env myapp LAUNCHER_CORS_ORIGINS "[\"\"]"
--corscommand-line options are provided, the environment variable is ignored.
PASSWORDenvironment variable gives the password used to log in to cf-launcher.