Deployment Functions
Deployment to a remote host or hosts.
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 - File. Optional. Environment file to load- can handle any format.--debug- Flag. Optional. Enable debugging.--first- Flag. Optional. When it is the first deployment, use this flag.--home deployPath- Directory. Required. Path where the deployments database is on remote system. Uses--id applicationId- String. Required. If not specified, uses environment variable loaded from.build.env, orAPPLICATION_IDenvironment.--application applicationPath- String. Required. 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- Filename. Optional. 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
Usage
deployRemoteFinish [ --debug ] [ --deploy ] [ --revert ] [ --cleanup ] --home deployPath --id applicationId --application applicationPath [ --target targetPackage ]
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 - Flag. Optional. default setting- handles the remote deploy.--revert- Flag. Optional. Revert changes just made.--cleanup- Flag. Optional. Cleanup after success.--home deployPath- Directory. Required. Path where the deployments database is on remote system.--id applicationId- String. Required. Should matchAPPLICATION_IDin.env--application applicationPath- String. Required. Path on the remote system where the application is live--target targetPackage- Filename. Optional. Package name, defaults toapp.tar.gz
Return codes
0- Success1- Environment error2- Argument error
Usage
deployToRemote [ --target target ] [ --deploy ] [ --cleanup ] [ --revert ] [ --commands ] [ --skip-ssh-host ] [ --add-ssh-host ] [ --debug ] --versions --id applicationId --application applicationPath userAtHost [ --help ]
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 TheuserAtHostcan 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"
Arguments
--target target- String. Optional. Build target file base name, defaults toapp.tar.gz--deploy- Default. Flag. deploy an application to a remote host--cleanup- Flag. Optional. After all hosts have been--deployed successfully the--cleanupstep is run on all hosts to finish up (or clean up) the deployment.--revert- Flag. Optional. Reverses a deployment--commands- Flag. Optional. Display commands sent to server but do not execute them. For debugging or testing. Implies --skip-ssh-host--skip-ssh-host- Flag. Optional. Do not add ssh hosts to known hosts file.--add-ssh-host- Flag. Optional. Add hosts to known hosts file in SSH if not already added.--debug- Flag. Optional. Turn on debugging (defaults toBUILD_DEBUGenvironment variable)--versions - deployHome- Path. Required. Remote path where we can store deployment state files.--id applicationId- String. Required. The application package will contain a.envwithAPPLICATION_IDset to this Value--application applicationPath- Path. Required. Path where the application will be deployeduserAtHost- Strings. Required. 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.--help- Flag. Optional. Display this help.
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
Local cache
deployHome is considered a state directory so removing entries in this should be managed separately.
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.