NAME
Footprintless::Deployment - A deployment manager
VERSION
version 1.0
SYNOPSIS
# Standard way of getting a deployment
use Footprintless;
my $deployment = Footprintless->new()->deployment('deployment');
# Or using inline configuration
use Config::Entities;
use Footprintless::Deployment;
my $deployment = Footprintless::Deployment->new(
Config::Entities->new(
entities => {
deployment => {
'Config::Entities::inherit' => ['hostname', 'sudo_username'],
configuration => {
clean => [
'/opt/tomcat/webapps/',
'/opt/tomcat/temp/',
'/opt/tomcat/work/'
],
to_dir => '/opt/tomcat/webapps'
},
resources => {
bar => '/home/me/.m2/repository/com/pastdev/bar/1.2/bar-1.2.war',
baz => {
coordinate => 'com.pastdev:baz:war:1.0',
'as' => 'foo.war',
type => 'maven'
}
}
},
hostname => 'test.pastdev.com',
sudo_username => 'developer'
}
),
'deployment');
# Standard deploy procedure
$deployment->clean();
$deployment->deploy();
# Deploy to temp instead of the entity configured location
my $rebase = {
from => '/opt/tomcat',
to => '/tmp/tomcat'
};
$deployment->clean(rebase => $rebase);
$deployment->deploy(rebase => $rebase);
# Only deploy selected resources
$deployment->deploy(names => ['bar']);
DESCRIPTION
Manages deployments. A deployment is a set of files and directories that are all associated with a single component. For example, if you are using tomcat, a deployment might refer to all of the webapps deployed to the container, and the folders and files that are NOT part of the tomcat container itself.
CONSTRUCTORS
new($entity, $coordinate, %options)
Constructs a new deployment configured by $entities
at $coordinate
. The supported options are:
- agent
-
If no
resource_manager
is provided, then this value is used when constructing the default provider(s) for the default resource manager. - command_options_factory
-
The command options factory to use. Defaults to an instance of Footprintless::CommandOptionsFactory using the
localhost
instance of this object. - command_runner
-
The command runner to use. Defaults to an instance of Footprintless::CommandRunner::IPCRun.
- localhost
-
The localhost alias resolver to use. Defaults to an instance of Footprintless::Localhost configured with
load_all()
. - resource_manager
-
The resource manager to use. Defaults to an instance of Footprintless::ResourceManager configured to use a Footprintless::MavenProvider if Maven::Agent is available, and a Footprintless::UrlProvider in that order.
METHODS
clean(%options)
Cleans the deployment. Each path in the configuration.clean
entity, will be removed from the destination. If the path ends in a /
, then after being removed, the directory will be recreated. The supported options are:
- rebase
-
A hash containing
from
andto
where the paths for each item in the clean entity will have thefrom
portion of their path substituted byto
. For example, if the path is/foo/bar
and rebase is{from =
'/foo', to => '/baz'}>, then the resulting path would be/baz/bar
.
deploy(%options)
Deploys all the resources listed in the resource
entity to the location specified in the configuration.to_dir
entity. The supported options are:
- names
-
A list of names of resources that should be deployed. If this option is provided, any names not in this list will be ignored.
- rebase
-
A hash containing
from
andto
where the paths for each item in the clean entity will have thefrom
portion of their path substituted byto
. For example, if the path is/foo/bar
and rebase is{from =
'/foo', to => '/baz'}>, then the resulting path would be/baz/bar
. - status
-
If truthy, then status information will be provided to the command runner. In order for this information to be useful, the command runner should be supplied with the
{err_buffer =
\*STDERR}> runner option so that it will, in turn, be written to STDERR. Also, status is implemented using thepv
command which MAY NOT already be installed. If it is missing, this option will cause the command itself to fail.
AUTHOR
Lucas Theisen <lucastheisen@pastdev.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2016 by Lucas Theisen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
SEE ALSO
Please see those modules/websites for more information related to this module.