CLI

A simple way to manage your application

To simplify the management of your application once it is installed on a server, a command line utility ships with all packages. By default it has the same name than your package, and is available only to the root user.

For instance, assuming you've installed an application named example-sinatra-app:

sudo example-sinatra-app
# Usage:
#  example-sinatra-app run COMMAND [options]
#  example-sinatra-app scale TYPE=NUM
#  example-sinatra-app logs [--tail|-n NUMBER]
#  example-sinatra-app config:get VAR
#  example-sinatra-app config:set VAR=VALUE
#  example-sinatra-app configure
#  example-sinatra-app reconfigure

config:set

Allows to set an environment variable for your application:

sudo example-sinatra-app config:set PORT=6789

config:get

Displays the value of an environment variable. Exits with the code 1 if the variable does not exist.

sudo example-sinatra-app config:get PORT
# 6789
sudo example-sinatra-app config:get DOESNOTEXIST
# outputs nothing, and exits with 1

config

Displays the full list of environment variables set for your application:

sudo example-sinatra-app config
# APP_GROUP=example-sinatra-app
# APP_HOME=/opt/example-sinatra-app
# APP_NAME=example-sinatra-app
# APP_RUNNER_CLI=initctl
# APP_RUNNER_TYPE=upstart
# APP_SAFE_NAME=example_sinatra_app
# APP_USER=example-sinatra-app
# ...

run

Run a one-off process in the context of your application, in the foreground:

sudo example-sinatra-app run web
# Puma 2.9.2 starting...
# * Min threads: 0, max threads: 16
# * Environment: production
# * Listening on tcp://0.0.0.0:6789
# == Sinatra/1.4.5 has taken the stage on 6789 for production with backup from Puma

You can also run any other script (the application context -- e.g. PATH -- will be made available to them):

sudo example-sinatra-app run ./path/to/script

scale

Run a process in the background, and generate init scripts for your platform:

sudo example-sinatra-app scale web=1
# Scaling up...
# --> done.

Which allows you to manage your app processes with the service system utility (and the services will be launched when your system starts/reboots):

sudo service example-sinatra-app [start|stop|status|restart]

To disable the process completely (including init scripts):

sudo example-sinatra-app scale web=0
# Scaling down...
# --> done.

To scale (up or down) multiple processes at once:

sudo example-sinatra-app scale web=1 worker=2

You can find more details about processes and how to declare them in the Procfile documentation.

logs

Displays your application's logs (stored in /var/log/app-name/):

sudo example-sinatra-app logs

You can also tail:

sudo example-sinatra-app logs --tail