Deployment Functions
deployBuildEnvironment
Deploy to a host
Usage
deployBuildEnvironment [ --env-file envFile ] [ --debug ] [ --first ] --home deployPath --id applicationId --application applicationPath [ --target targetPackage ]
Deploy to a host
Loads ./.build.env if it exists.
Not possible to deploy to different paths on different hosts, currently. Hosts are assumeed to be similar.
Arguments
--env-file envFile - Optional. File. Environment file to load- can handle any format.--debug- Optional. Flag. Enable debugging.--first- Optional. Flag. When it is the first deployment, use this flag.--home deployPath- Required. Directory. Path where the deployments database is on remote system. Uses--id applicationId- Required. String. If not specified, uses environment variable loaded from.build.env, orAPPLICATION_IDenvironment.--application applicationPath- Required. String. Path on the remote system where the application is live. If not specified, uses environment variable loaded from.build.env, orAPPLICATION_REMOTE_HOMEenvironment.--target targetPackage- Optional. Filename. Package name usually an archive format. If not specified, uses environment variable loaded from.build.env, orBUILD_TARGETenvironment. Defaults toapp.tar.gz.
Return codes
0- Success1- Environment error2- Argument error
Environment
- DEPLOY_REMOTE_HOME - RemoteDirectory. Path on the remote server where the application deployment home is (per application)
- path on remote host for deployment data
- APPLICATION_REMOTE_HOME - RemoteDirectory. Path on the remote server where the application is served
- path on remote host for application
- DEPLOY_USER_HOSTS - String. A list of one ore more user@host for installation of the application
- list of user@host (will be tokenized by spaces regardless of shell quoting)
- APPLICATION_ID - String. This is the unique hash which represents the source code state (typically a git hash)
- Version to be deployed
- BUILD_TARGET - String. The file to generate when generating builds
- The application package name
deployRemoteFinish
This is run on the remote system after deployment; environment
Usage
deployRemoteFinish [ --revert | --cleanup ] [ --debug ] deployPath applicationId applicationPath
This is run on the remote system after deployment; environment files are correct. It is run inside the deployment home directory in the new application folder.
Current working directory on deploy is deployHome/applicationId/app.
Current working directory on cleanup is applicationHome/
Current working directory on undo is applicationHome/
Note that these MAY be the same or different directories depending on how the application is linked to the deployment
Arguments
--debug- Enable debugging. Defaults toBUILD_DEBUG--deploy- Optional. Flag, default setting - handles the remote deploy.--revert- Optional. Flag, Revert changes just made.--cleanup- Optional. Flag, Cleanup after success.--home deployPath- Required. Directory. Path where the deployments database is on remote system.--id applicationId- Required. String. Should matchAPPLICATION_IDin.env--application applicationPath- Required. String. Path on the remote system where the application is live--target targetPackage- Optional. Filename. Package name, defaults toapp.tar.gz
Return codes
0- Success1- Environment error2- Argument error
deployToRemote
Deploy current application to host at applicationPath.
Usage
deployToRemote [ --cleanup ] [ --help ] [ --debug ] --versions --id applicationId --application applicationPath userAtHost
Deploy current application to host at applicationPath.
If this fails it will output the installation log.
When this tool succeeds the application:
--deploy- has been deployed in the remote systems successfully but temporary files may still exist--revert- No changes should have occurred on the remote host (not guaranteed)--cleanup- has been installed in the remote systems successfully
Operation:
Deploy --deploy Operation
- On each host,
app.tar.gzis uploaded to theapplicationPathfirst - On each host, via the shell, change to the
applicationPathdirectory - Decompress the application package, and run the
deploy-remote-finish.shscript
Cleanup --cleanup Operation
- On each host, via the shell, change to the
applicationPathdirectory - Run the
deploy-remote-finish.shscript which ... - Deletes the application package if it still exists, and runs the
deploy-cleanuphook
Undo --revert Operation
- On each host, via the shell, change to the
applicationPathdirectory - Run the
deploy-remote-finish.shscript which ... - Deploys the prior version in the same manner, and ...
- Runs the
deploy-reverthook afterwards
The userAtHost can be passed as follows:
deployDeployAction --deploy 5125ab12 /var/www/DEPLOY/coolApp/ /var/www/apps/coolApp/ "www-data@host0 www-data@host1 stageuser@host3" "www-data@host4"
Local cache: deployHome is considered a state directory so removing entries in this should be managed separately.
Arguments
--cleanup- Optional. Flag. After all hosts have been--deployed successfully the--cleanupstep is run on all hosts to finish up (or clean up) the deployment.--help- Optional. Flag. Show help--debug- Optional. Flag. Turn on debugging (defaults toBUILD_DEBUGenvironment variable)--versions - deployHome- Required. Path. Remote path where we can store deployment state files.--id applicationId- Required. String. The application package will contain a.envwithAPPLICATION_IDset to this Value--application applicationPath- Required. Path. Path where the application will be deployeduserAtHost- Required. Strings. A list of space-separated values or arguments which match users at remote hosts. Due to shell quoting peculiarities you can pass in space-delimited arguments as single arguments.
Debugging settings
Append to the value of BUILD_DEBUG (a comma-delimited (,) list) and add these tokens to enable debugging:
ssh- Debug ssh commands with verbose optionsssh-debug- Debug ssh commands with LOTS of verbose options
Return codes
0- Success1- Environment error2- Argument error
Environment
- BUILD_DEBUG - CommaDelimitedList. Constant for turning debugging on during build to find errors in the build scripts. Enable debugging globally in the build scripts. Set to a comma (
,) delimited list string to enable specific debugging, ortruefor ALL debugging,false(or blank) for NO debugging.