Menu Developer Moovweb University

Develop Locally: Deployment

The moov deploy command is used to compile a project and upload it to a Control Center project. The command also runs any tasks you have in your task runner queue.


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> <mode-name>

Where account is the account the project lives in the Control Center, the project-name is the Control Center Project’s name, and the mode-name is the Mode you want to deploy to.

moov deploy user/new-project mobile-endpoint

To deploy to the default mode, just leave out the mode argument. The following command will deploy to the default mode.

moov deploy user/new-project

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. See the Layers documentation for more info.

For example, to deploy the “mobile” layer to the “mobile-endpoint” mode on the Control Center,

moov deploy user/project mobile-endpoint --layers="mobile"

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 is used to specify source control versioning information (such as a git commit hash or a subversion version number).

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.

Note that pre- and post-deploy scripts are mostly unnecessary with the advent of the task runner.

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 suppress the prompt when deploying to live Modes.