Skip to main content

thermostat deploy

This command is used to deploy a new application or to update the application that is already deployed here to the latest version. If there is no application deployed here, you should provide the client/application and stage of the new application you want to deploy, and the code and data will be pulled from the Thermostat API and deployed to this machine. If there is already an application deployed here, you can just run "thermostat deploy" to update it to the latest version. When updating existing deployments, this command will NOT update the application data unless the --replace-data option is provided.

If the application is already deployed, the redeployment process is designed to be "zero downtime" in that it will create a "new-code" and "new-data" folder to load the new code and data into during the setup process, which are then atomically swapped out for the existing "code" and "data" folders when the setup process finishes. The basic order of operations of this process are as follows:

  1. Check deployment status: Thermostat checks that the current directory contains either an already deployed application or that it is empty and ready to accept a new deployment.
  2. Save application configuration: Thermostat saves an internal record of this application in it's internal configuration file if it does not already exist.
  3. Download code: Thermostat downloads the Git repository for the application and checks out the branch associated with this application stage.
  4. Download data: If this is the first deployment of the application or if the --replace-data option is provided, Thermostat downloads and decompresses the latest backup file associated with this application stage from the Thermostat API.
  5. Apply data links: Thermostat symlinks files from the data folder into the code folder according to the data_links configuration in the application's Thermostat configuration file.
  6. Build application: Thermostat runs the "build" script defined in the scripts section of the application's Thermostat configuration file if it exists and if the --no-build option is not passed.
  7. Update services: Thermostat reconfigures the application services as specified in the services section of the application's Thermostat configuration file.
  8. Swap directories: Thermostat swaps the newly downloaded code and data with the previous version of the application code and data.
  9. Start application: Thermostat runs the "start" script defined in the scripts section of the application's Thermostat configuration file if it exists and if the --no-start option is not passed.

If any step of the deployment process fails, all changes are automatically rolled back to how things were before the command was run.

Usage:
$ thermostat deploy [client/application] [stage[:substage]]

Positionals:
client/application [string] The client and application name of the application to deploy
stage:substage [string] The stage (and optionally the substage) of the application to deploy (the stage must be production, staging, or development, unless --custom-stage is passed)

Options:
--replace-data [boolean] Always download a new copy of the application data, even if it is not needed.
--no-build [boolean] Deploy the application without running the build script.
--no-start [boolean] Deploy the application without running the start script.
--preserve-files [boolean] Do not clean up downloaded files upon a failed deployment.
--custom-stage [boolean] Allow the application to be deployed with a custom stage name.
-f, --force [boolean] Allow the deployment process to perform dangerous actions such as deleting files and databases.