OpsCaptain CLI

The open source OpsCaptain CLI is available to be installed from npm. Npm is a ubiquitous package manager for Node.js. Run the below command to install the CLI:

npm install -g opscaptain-cli

You can always run the above command to upgrade the CLI.

Once the CLI is installed, you must login to be able to use it. You only have to log in once and that's it.

opscaptain -login -em info@opscaptain.com -pw ******

To uninstall the CLI, run the below command:

npm uninstall opscaptain-cli

The CLI provides a very simple way for you to deploy your applications, check logs, status and also perform restart and stop operations.

OpsCaptain CLI example commands

Deploying your app

// Simplest command to deploy when you have an ocmanifest.json file opscaptain deploy // Deploy without an ocmanifest.json file opscaptain deploy -n myapp -ev "ENV_VAR_1=EN_VAR_2"

When deploying without an ocmanifest.json file, You can set all your parameters on the command line using the below options

Option Description
-n Use this option to specify the name of your app if not set in the ocmanifest.json file.
-p If your project folder or the build output of your project to deploy is in a folder different from the current working directory, use this option to specify the absolute or relative path of your project.
-ev Specify an environment variable and value to be set for your app. You can also set environment variables in your ocmanifest.json file. Example: -ev VARIABLE_NAME=VARIABLE_VALUE
-e By default the CLI looks for the ocmanifest.json file in the current working directory (CWD). If you have this file in a directory other than the CWD, use this option to specify the relative or absolute path of the file.
-bp Specify the buildpack used to build your project when you deploy. You can specify multiple buildpacks by separating values with a comma. Run opscaptain help to list the available buildpacks.
--ruas This is the rollupdateaftersecs parameter for zero downtime deployments. Review the zero downtime deployments page on how to use this option.
--rups This is the rollupdateaftersecs parameter for zero downtime deployments. Review the zero downtime deployments page on how to use this option.


Checking the logs of your deployed application

// If you have an ocmanifest.json in the current working directory, use: opscaptain logs // If you do not have an ocmanifest.json in the current working directory, use: opscaptain logs -n my-node-app

Checking the status and resource usage of your application

opscaptain status

Restarting your app containers and databases

opscaptain restart // Restarting your database: opscaptain restart --db

Stopping your app containers

opscaptain stop

Read the CLI help guide

opscaptain help