Skip to content

CLI reference

apurvis edited this page Aug 16, 2017 · 13 revisions

Full Commands Listing

For the most accurate and up to date information on what options are accepted by which commands, run

bundle exec broadside --help

Deploying Stuff

bootstrap

Attempt to set up a task_definition and service based on what you have configured. Useful for getting things up and running - you usually only run it once. Requires that you have a :task_definition_config and :service_config in your target configuration hash. Configured :bootstrap_commands will be executed sequentially before launching the service.

deploy short

Initiates a deployment by first creating a new task definition with the provided docker tag, and injects environment variables from the specified .env file. The corresponding service is updated to deploy the new task definition, which will automatically do a blue-green deploy. On timeout or error, a rollback will ensure the most previous task definition will be deployed.

deploy full

Same as above, except specified :predeploy_commands will be run sequentially before the service is updated with the new task definition. This is where various database migrations or other setup tasks can be run.

deploy scale

Updates the service using the existing task definition with the provided scale, taking precedence over whatever has been specified in the configuration file.

deploy rollback

Deregisters N task definitions and deploys the next valid one. For example, a rollback of 1 will deregister the currently deployed task definition and attempt to deploy the one immediately before.

Other Commands

execute

Run a bash command directly on the specified (with -n INDEX) container. You can use the --all switch to tell broadside to execute the command on all the containers.

run

Create a new task definition using the provided tag and environment variables and run a command you provide on the command line. A one-off task will be launched using this task definition; after, the created task definition will be deregistered. The difference between run and execute is that run will launch a new container; execute will not.

status

Prints out useful information about what is currently deployed.

logtail

Tails the logs inside one of the running containers for your service.

ssh

SSHs into the host EC2 instance that is running one of the containers for your service.

bash

Establishes a shell inside a running container for your service.

targets

Display information about what is currently deployed for all your targets, including things like uptime, deployed image and tag info, and allocated memory/CPU.

Example Usages

  • You can run broadside with the --help flag for any command and subcommand to get usage instructions.

  • Bootstrap your application:

    broadside bootstrap --target TARGET --tag DOCKER_TAG
  • After bootstrapping, you can attempt to deploy your application:

    broadside deploy short --target TARGET --tag DOCKER_TAG
    

    A short deploy will simply launch new containers for your application if configurations have changed.

  • If you would like to run predeploy tasks prior to your deploy, you can use the full deploy command:

    broadside deploy full --target TARGET --tag DOCKER_TAG
    
  • A deploy will fail if the application is unresponsive or if the container does not launch correctly. In this case, an automatic rollback will happen to ensure the previous (and ideally correct) configurations are deployed.

  • Following a successful deploy, you can check your service status:

    broadside status --target TARGET
    
  • Or tail your logs from the container:

    broadside logtail --target TARGET --lines 100
    
  • If you wish the rescale your service on the fly, use:

    broadside scale --target TARGET --scale N
    

    Note that using this command with a provided scale will override the scale settings configured in your broadside.conf.rb