Skip to content

3.4. Releases and Services

chaschev edited this page Jan 11, 2014 · 3 revisions

Though this part as well as SCM integration is currently is one of the most important, it's not written in stone and is a work in progress. It should not significantly change in future, but slight changes most probably will occur.

Deployment plugin

Deployment plugin is a tool which automates some of the operations. It has phases (similar to Maven).

For each single deployment there is a release which is provided by a ReleasePlugin. Each release is a self-contained set of files with which the user starts the service.

Releases have a following disk structure:

$ ls /var/lib/my-project/releases

releases
  |-- 20140103.142242.GMT
    |-- release file 1.html
    |-- release file 2.jar
  |-- 20140103.160025.GMT
    |-- release file 1.html
    |-- release file 2.jar
  |-- pending_20140103.183112.GMT   <-- release in progress, not activated
    |-- release file 1.html
    |-- release file 2.jar
current  -> /var/lib/drywall-demo/releases/20140103.160025.GMT
releases.json                       <-- cache file which contains information about revisions

DeploymentPlugin creates deployment task which uses ReleasePlugin to create releases. Each deployment consists of several phases. SetFileLocaltion phase creates a new pending release and StartService phase activates it at the beginning.

Phase Description Release Phase
SetFilesLocation Rarely used. Prepares local or network files before the build. Starts new pending release with $(releases.session).newPendingRelease()
CheckoutFiles User adds checkout checkout here. Does nothing.
BuildAndCopy User builds the app and copies files before a link switch.
StopService User stops the running service. Can wait for other parties.
UpdateLinks Will be removed.
StartService Updates the current release link. User starts the service and optionally monitors log files. Activates pending release with $(releases.pendingRelease).activate()
WhenStarted I.e. user sends an e-mail.
Rollback Executed when anything fails inside a session. There are two sub-phases, first one is a rollback for a current release state - i.e. user stops the service and deletes the files. The second one is after a link switch to a previous release - i.e. user starts a service.