NAME

Footprintless::Deployment - A deployment manager

VERSION

version 1.13

SYNOPSIS

# Standard way of getting a deployment
use Footprintless;
my $deployment = Footprintless->new()->deployment('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.

ENTITIES

A simple deployment:

deployment => {
    clean => ['/opt/app/'],
    resources => {
        foo => 'http://download.com/foo.exe',
        bar => 'http://download.com/bar.exe'
    },
    to_dir => '/opt/app'
}

A more complex situation, perhaps a tomcat instance:

deployment => {
    'Config::Entities::inherit' => ['hostname', 'sudo_username'],
    clean => [
        '/opt/tomcat/conf/Catalina/localhost/',
        '/opt/tomcat/temp/',
        '/opt/tomcat/webapps/',
        '/opt/tomcat/work/'
    ],
    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'
        },
        foo => {
            url => 'http://pastdev.com/resources/foo.war',
            extract_to => 'ROOT'
        }
    },
    to_dir => '/opt/tomcat/webapps'
}

CONSTRUCTORS

new($entity, $coordinate)

Constructs a new deployment configured by $entities at $coordinate.

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 and to where the paths for each item in the clean entity will have the from portion of their path substituted by to. 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:

extra

A subroutine that is called during deployment allowing you to add to what is deployed before it is pushed to its destination. This subroutine will be called with a single argument containing the (possibly temporary) directory that you can write additional files to.

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 and to where the paths for each item in the clean entity will have the from portion of their path substituted by to. For example, if the path is /foo/bar and rebase is {from = '/foo', to => '/baz'}>, then the resulting path would be /baz/bar.

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.