USAGE

orepan2-s3 Options Command

Script for maintaining a DarkPAN mirror using S3 + CloudFront

Commmands

  • create - Create a new index.html from the mirror's manifest file.

  • download - Download the mirror's manifest file (02packages.details.text.gz).

  • show - Print the manifest file to STDOUT or a file.

  • upload - Upload the index.html file to the mirror's root.

  • dump-template - Outputs the default index.html template.

Options

-h, --help         Display this help message
-c, --config-file  Name of the configuration file (default: ~/.orepan2-s3.json)
-o, --output       Name of the output file
-p, --profile      Name of a profile inside the config file
-t, --template     Name of a template that will be used as the index.html page

Configuration File

The configuration file for `orepan2-s3` is a JSON file that can contain multiple profiles (or none). The format should look something like this:

{
    "tbc" : {
        "AWS": {
            "profile" : "prod",
            "region" : "us-east-1",
            "bucket" : "tbc-cpan-mirror",
            "prefix" : "orepan2"
        },
        "CloudFront" : {
            "DistributionId" : "E2ABCDEFGHIJK"
        }
    },
    "default" : {
        "index" : {
            "template" : "/path/to/template",
            "files": {
               "src" : "dest"
            }
        },
        "AWS": {
            "profile" : "prod",
            "region" : "us-east-1",
            "bucket" : "cpan.openbedrock.net",
            "prefix" : "orepan2"
        },
        "CloudFront" : {
            "DistributionId" : "E2JKLMNOPQRXYZ",
            "InvalidationPaths" : []
        }
    }
}

Each profile can contain up to 3 secions (AWS, CloudFront, index). If you only have one profile you don't need place it in a 'default' section.

index

This section allows you to create custom template for the DarkPAN home page.

template

The name of a template file that will be parsed and uploaded as /index.html. If you do not provide a template file a default template. The default template is a Template::Toolkit style template. To see the default template use the dump-template command to the orepan2-index script.

orepan2-index dump-template

The templating process is provided with these variables:

utils

A blessed reference to an object with one method (module_name) that returns a verison of the module_name suitable for use as unique id.

repo

A hash of key value pairs where the key is the name of a DarkPAN distribution and value is an array or arrays. Each array is of the form:

[0] => Perl module name
[1] => Module version
localtime

The current time and date as a string.

files

A hash of source/destination pairs that specify additional files to upload.

Example:

"files" { 
   "/home/rlauer/git/some-project/foo.css" : "/css/foo.css",
   "/home/rlauer/git/some-project/foo.js" : "/javascript/foo.js"
}
AWS
profile

The IAM profile where the bucket is provisioned.

region

AWS region. Default: us-east-1

bucket

S3 bucket name

prefix

The prefix where the CPAN distribution files will be stored. Default: orepan2.

CloudFront
DistributionId

CloudFront distribution id

InvalidationPaths

An array of additional paths to invalidate when adding new distributions.

Note: There is no additional charge for adding additional paths. Each invalidation batch is considered as one billing unit by AWS. However, keep in mind you get 1000 invalidation paths for free each month. Thereafter each path costs $0.005 per path.

AUTHOR

Rob Lauer - <rlauer6@comcast.net>