Moov Commands: Deploy

The moov deploy command is used to compile a project and upload it to a Control Center project. It also provides pre-deploy and post-deploy hooks which allow the user to perform custom setup and cleanup actions.

Run moov deploy

The deploy command may be run from the directory of the project to compile and upload. In its most basic form, the deploy command is run as follows:

moov deploy <account>/<project-name>

Where account is the account the project lives in the Control Center, and the project-name is the Control Center Project’s name. This will take all necessary files from the local project you’re currently in and deploy them to the specified Control Center Project’s default mode.

If your Control Center project has multiple Modes defined, and you want to deploy to a particular Mode, you need to specify it on the command line. To do this, leave a space after the account and project name, and then enter the Mode name. Modes must be specified immediately after the account and project name, regardless of what other options are included.

Note: Deploying to a live Mode is restricted by default and will prompt you for confirmation. For more information about Modes check the Modes documentation.

The command will also ask for authentication when deploying if you have not already been authenticated in the current session. Deployment will not be allowed if the credentials specified belong to a user account with restricted access in the Control Center.

Deploy options

The moov deploy command can be run with many options. To get a complete list and a basic description of what they do, run the following command:

moov help deploy

Below we’ll describe some commonly used options.

layers

The --layers= flag specifies which Layers of the project to compile. Using Layers is optional when layers are not being used. If the project requires Layers, and you leave this parameter out, the project will be built with no Layer and will fail. See the Layer Documentation for more info.

notes

The --notes= flag allows notes to be attached to the project deployment. These notes can be viewed in the Control Center Project page. Notes can be edited or even added after a push. The notes field can act similarly to a commit message to provide users more information about each build, such as which Layer was built or other relevant information.

deploy-id

The --deploy-id= flag is used to specify an identifier for the build. The deploy-id can be viewed in the Control Center Project page. The deploy-id cannot be edited for a build after deployment. The deploy-id is not required to be unique, but it is recommended to use unique IDs to facilitate debugging. In practice, the deploy-id can be used to specify a code repository revision number/commit hash/branch name or a link to release notes or any other metadata about this build.

verbose

The --verbose flag enables additional information output from moov deploy. When verbose is set, moov deploy will also display all output from any pre-deploy or post-deploy scripts.

pre-/post-deploy

The --pre-deploy= and --post-deploy= flags are used to specify scripts or executables to use for setup and cleanup, respectively. The pre-deploy script will run before building the local project and pushing it the Control Center. The post-deploy script will run after building the local project and deployment to the Control Center has finished. The scripts specified by these flags are user-defined, and can contain any custom code needed to integrate with the user’s deployment process. The pre-deploy script may additionally change the parameters for the deploy. For more detailed information, visit the pre-/post-deploy scripts docs page.

debug-scripts

The --debug-scripts flag turns the command into a dry run, only running your pre- and post-deploy scripts, not actually building and deploying. This helps you test and debug the functionality of your pre- and post-deploy scripts while you develop them. It also allows you to verify that all parameters are correct before actually deploying to the Control Center.

project-dir

The --project-dir flag is an alternate way to specify the project directory.

login

The --login flag will prompt you to log in to switch between different accounts.

ignore-live

The --ignore-live flag when passed will ignore the live Mode prompt.