Status: in development
This component automates installation (deployment) of products which are represented by artifacts in maven repositories. download
and install
are different actions, and if we want to install product without network connection we must download product and all dependencies before installation. If scm4j-deployer-engine
can't find valid repository in portable
or working folder
then they downloads from network.
product list
: artifact (yaml file) which listsproducts
and maven repositoriesproduct
: jar-artifact whose main class has public methodgetProductStructure
which returnsproduct structure
product structure
: listscomponent's
anddependent products
if they are existsdependent products
: without which it is impossible to install the current productcomponent
: represented by artifact coordinates (<groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>
) and one or fewdeployment procedure
deployment procedure
: listsactions
action
: represented bycomponent deployer
class andparams
component deployer
: is instantiated duringdeployment procedure
, action paremeters are passed usinginit
methodworking folder
: used to keep downloaded components and internal data structuresportable folder
: if specified used as a target fordownload
command and as an implicit repository. Scenario: download all components to aportable folder
(normally located at the USB flash drive), go to a place where internet is not presented and install products there usingportable folder
as a sourcelegacy version
: product version who deploys withoutscm4j-installer
immutable product
: product, each version of which is a separate product
Thus all dependencies of product artifact are "deployers" and their dependencies i.e. implement deployment logic. Deployment "data" is represented by artifacts which are listed by IProductStructure
interface.
Ref. data-structure.md
Scenarious are represeneted by methods of DeployerEngine
DeployerEngine
: Constructor does NOT do any network operationlistProducts
: gets data from offline cache ofproduct list
refreshProducts
: refreshes cache forlistProducts
listProductVersions
: gets data from offline cache (products-versions.yml)refreshProductVersions
: refreshes offline cachedownload
: downloads given productdeploy
: deploys given product. Downgrade disabled. To downgradeproduct
need undeployproduct
and install older versionlistDeployedProducts
: lists all deployed product fromdeployed-products.yml
- Deployment result: OK, NEWER_VERSION_EXISTS, NEED_REBOOT(only for Inno Setup .exe who provide param /restartexitcode={value}), REEBOOT_CONTINUE, INCOMPATIBLE_API_VERSION, ALREADY_INSTALLED, FAILED
- INCOMPATIBLE_API_VERSION: Product should depend on
deployer-api
which is compatible with one used by engine - NEED_REBOOT: Only for Inno Setup .exe who provide param /restartexitcode=$restartexitcode. It means that installation succesfully but PC need to restart before work with installed
product
- DP - deployed product. Contains IProductStructure, Coords, and deployment URL
- RP - required product
Steps
- API compatibility is checked
- Previously
DP
version is queried (deployed-products.yml), if not found and product implementILegacyProduct
interface, ILegacyProduct.queryLegacyDeployedProduct
is used to getDP
- Install dependencies (If product has
dependency products
)- all
dependency products
are installed recursively - if one of
dependency products
installation fails -DP
installation fails - if
dependency product
installation returnsREBOOT_CONTINUE
-DP
returnsREBOOT_CONTINUE
- all
- If
DP
.version equals toRP
.version thenALREADY_INSTALLED
is returned - If
DP
.version greater thenRP
.version thenNEWER_VERSION_EXISTS
is returned - Stop
DP
DP
deployers and components are downloaded- All
DP
components are stopped in reverse order - If
stop
fails allDP
-components aredisabled
,REBOOT_CONTINUE
returns
- Deployment
- Components which does not exist anymore are undeployed, updated components redeployed (stop/undeploy/deploy), new components deployed
- Start
- All components started
- If
portable folder
is specified it is implicitly used as a main repository (before all repos listed inproduct list
)
- product which uses
scm4j-deployer-engine
must implementIImmutable
- new product deploys in
IProduct.getDefaultDeploymentPath
and creates child directory, which is called the same as the product version - file
latest
with latest product version writes inIProduct.getDefaultDeploymentPath
directory
scm4j-deployer-engine
works with scm4j-deployer-api
and scm4j-deployer-installers
. installers
is a project with few classes who knows how to run specific deployer(for example Copy
, Unzip
, Exec
).
Main class in scm4j-deployer-engine
is DeployerEngine
who describes in # Scenarious Overview. He invokes methods from
Downloader
- checks API compatibility and downloads products and their depsDeployer
- deploys product and returns deployment result
We create a repository in temporary folder and write test artifacts there. After we download them and their deps from this repository and check equality. To test deployment procedure we use test products (from directory org.scm4j.deployer.engine.products
) and test deployers(from directory org.scm4j.deployer.engine.deployers
) and mocked IDownloader
.