view release on metacpan or search on metacpan
command provides a shorthand syntax to do this. You only need to
provide an overall application name, a service type, a service name,
and the container image to use.
This command will create a file named `my-stack.yml` in your current
directory. Make sure you have your AWS profile configured in your
environment or pass it using the `--profile` option.
app-FargateStack create-stack my-stack daemon:my-stack-daemon image:my-stack-daemon:latest
This will produce a configuration stub that looks like this:
app:
name: my-stack
tasks:
my-stack-daemon:
image: my-stack-daemon:latest
type: daemon
This file contains the three key pieces of information you provided:
the application name, the task name, and the image to use.
both a **private** and **public** hosted zone for your domain._
Your task type will also determine which type of subnet is required
and where to search for an existing ALB to use. If you want to prevent
re-use of an existing ALB and force the creation of a new one use the
`--create-alb` option when you run your first plan.
In your initial configuration you do not need to specify the subnets
or the hosted zone id. The framework will discover those and report
if any required resources are unavailable. If the task type is
"https", the script looks for a public zone, public subnets and an
internet-facing ALB otherwise it looks for a private zone, private
subnets and an internal ALB.
## ACM Certificate Management
If the task type is "https" and no ACM certificate currently exists
for your domain, the framework will automatically provision one. The
certificate will be created in the same region as the ALB and issued
via AWS Certificate Manager. If the certificate is validated via DNS
and subsequently attached to the listener on port 443.
discovered to be missing from your environment.
## Application Load Balancer
When you provision an HTTP service, whether or not it is secure, the
service will placed behind an application load balancer. Your Fargate
service is created in private subnets, so your VPC must contain at
least two private subnets. Your load balancer can either be
_internally_ or _externally facing_.
By default, the framework looks for and will reuse a load balancer
with the correct scheme (internal or internet-facing), in a subnet
aligned with your task type. The ALB will be placed in public subnets
if it is internet-facing. You can override that behavior by either
explicitly setting the ALB arn in the `alb:` section of the
configuration or pass `--create-alb` when you run our plan and apply.
If no ALB is found or you passed the `--create-alb` option, a new ALB
is provisioned. When creating a new ALB, `app-FargateStack` will also
create the necessary listeners and listener rules for the ports you
have configured.
lib/App/FargateStack.pm view on Meta::CPAN
use CLI::Simple;
use CLI::Simple::Constants qw(:booleans :chars %LOG_LEVELS);
use Cwd qw(realpath);
use Data::Dumper;
use Date::Parse qw(str2time);
use English qw(no_match_vars);
use File::Basename qw(basename fileparse);
use List::Util qw(none any);
use Log::Log4perl;
use Pod::Usage;
use Scalar::Util qw(reftype looks_like_number);
use Text::ASCIITable::EasyTable;
use Term::ANSIColor;
use YAML qw(LoadFile);
use Role::Tiny::With;
# command methods
with 'App::FargateStack::Init';
with 'App::FargateStack::Logs';
with 'App::FargateStack::Route53';
lib/App/FargateStack.pm view on Meta::CPAN
########################################################################
sub cmd_deploy_service {
########################################################################
my ($self) = @_;
my ( $config, $tasks ) = $self->common_args(qw(config tasks));
my ( $task_name, $desired_count ) = $self->get_args;
if ( $task_name && looks_like_number $task_name ) {
$desired_count = $task_name;
$task_name = $EMPTY;
}
if ( !$task_name || !exists $tasks->{$task_name} ) {
( $task_name, my $err ) = $self->get_default_service_name($TRUE); # skip arg
if ( $err || !$task_name ) {
if ($err) {
$self->log_error('ERROR: multiple services in configuration.');
}
elsif ( !$task_name ) {
$self->log_error( 'ERROR: %s',
$task_name ? "service: [$task_name] not found in configuration" : 'no service types in configuration' );
}
die sprintf "usage: %s deploy-service service-name\n", $ENV{SCRIPT_NAME};
}
}
if ( !$desired_count || !looks_like_number $desired_count ) {
$desired_count = $tasks->{$task_name}->{desired_count} // 1;
}
$self->log_info('service: checking to see if task and latest image are aligned...');
$self->check_latest_image($task_name);
return $self->build_service( $task_name, $desired_count );
}
lib/App/FargateStack.pm view on Meta::CPAN
return $result;
}
########################################################################
sub cmd_start_stop_service {
########################################################################
my ($self) = @_;
my ( $task_name, $count ) = $self->get_args;
if ( looks_like_number $task_name ) {
$count = $task_name;
$task_name = $EMPTY;
}
$task_name = $self->check_service_name($task_name);
my $command = $self->command;
if ( $command eq 'start-service' ) {
$count ||= 1;
}
lib/App/FargateStack/Builder/Utils.pm view on Meta::CPAN
# callstack issue when covering Log4perl methods.
Log::Log4perl->wrapper_register(__PACKAGE__);
}
use Carp;
use Data::Dumper;
use Date::Parse qw(str2time);
use English qw(no_match_vars);
use JSON;
use List::Util qw(any none);
use Scalar::Util qw(blessed reftype refaddr looks_like_number);
use Term::ANSIColor;
use Time::Piece;
use Time::HiRes qw(time);
use Text::Diff;
use JSON;
use Role::Tiny;
use parent qw(Exporter Class::Accessor::Fast);
lib/App/FargateStack/Builder/Utils.pm view on Meta::CPAN
if !defined $status;
return $status;
}
########################################################################
sub _log {
########################################################################
my ( $logger, $level, @args ) = @_;
# If first arg looks like a sprintf format string AND we have more args, call sprintf
if ( @args > 1 && $args[0] =~ /%/xsm ) {
return $logger->$level( sprintf shift(@args), @args );
}
else {
return $logger->$level(@args);
}
}
sub log_info { return _log( shift->get_logger, 'info', @_ ) }
sub log_debug { return _log( shift->get_logger, 'debug', @_ ) }
lib/App/FargateStack/Checker.pm view on Meta::CPAN
if ( $sts_arn =~ m{\A arn:aws:sts::\Q$account_id\E:assumed-role/([^/]+)/}xsm ) {
my $role = $1;
return sprintf 'arn:aws:iam::%s:role/%s', $account_id, $role;
}
if ( $sts_arn =~ m{\A arn:aws:iam::\Q$account_id\E:(user|role)/}xsm ) {
return $sts_arn;
}
# Fallback: try to coerce to iam::role if it looks like an sts assumed role
return $sts_arn;
}
########################################################################
sub _role_arns_from_names {
########################################################################
my ( $account_id, $role_names ) = @_;
$role_names ||= [];
my @arns;
lib/App/FargateStack/Pod.pm view on Meta::CPAN
command provides a shorthand syntax to do this. You only need to
provide an overall application name, a service type, a service name,
and the container image to use.
This command will create a file named F<my-stack.yml> in your current
directory. Make sure you have your AWS profile configured in your
environment or pass it using the C<--profile> option.
app-FargateStack create-stack my-stack daemon:my-stack-daemon image:my-stack-daemon:latest
This will produce a configuration stub that looks like this:
app:
name: my-stack
tasks:
my-stack-daemon:
image: my-stack-daemon:latest
type: daemon
This file contains the three key pieces of information you provided:
the application name, the task name, and the image to use.
lib/App/FargateStack/Pod.pm view on Meta::CPAN
both a B<private> and B<public> hosted zone for your domain.>
Your task type will also determine which type of subnet is required
and where to search for an existing ALB to use. If you want to prevent
re-use of an existing ALB and force the creation of a new one use the
C<--create-alb> option when you run your first plan.
In your initial configuration you do not need to specify the subnets
or the hosted zone id. The framework will discover those and report
if any required resources are unavailable. If the task type is
"https", the script looks for a public zone, public subnets and an
internet-facing ALB otherwise it looks for a private zone, private
subnets and an internal ALB.
=head2 ACM Certificate Management
If the task type is "https" and no ACM certificate currently exists
for your domain, the framework will automatically provision one. The
certificate will be created in the same region as the ALB and issued
via AWS Certificate Manager. If the certificate is validated via DNS
and subsequently attached to the listener on port 443.
lib/App/FargateStack/Pod.pm view on Meta::CPAN
discovered to be missing from your environment.
=head2 Application Load Balancer
When you provision an HTTP service, whether or not it is secure, the
service will placed behind an application load balancer. Your Fargate
service is created in private subnets, so your VPC must contain at
least two private subnets. Your load balancer can either be
I<internally> or I<externally facing>.
By default, the framework looks for and will reuse a load balancer
with the correct scheme (internal or internet-facing), in a subnet
aligned with your task type. The ALB will be placed in public subnets
if it is internet-facing. You can override that behavior by either
explicitly setting the ALB arn in the C<alb:> section of the
configuration or pass C<--create-alb> when you run our plan and apply.
If no ALB is found or you passed the C<--create-alb> option, a new ALB
is provisioned. When creating a new ALB, C<app-FargateStack> will also
create the necessary listeners and listener rules for the ports you
have configured.
share/README.md view on Meta::CPAN
command provides a shorthand syntax to do this. You only need to
provide an overall application name, a service type, a service name,
and the container image to use.
This command will create a file named `my-stack.yml` in your current
directory. Make sure you have your AWS profile configured in your
environment or pass it using the `--profile` option.
app-FargateStack create-stack my-stack daemon:my-stack-daemon image:my-stack-daemon:latest
This will produce a configuration stub that looks like this:
app:
name: my-stack
tasks:
my-stack-daemon:
image: my-stack-daemon:latest
type: daemon
This file contains the three key pieces of information you provided:
the application name, the task name, and the image to use.
share/README.md view on Meta::CPAN
both a **private** and **public** hosted zone for your domain._
Your task type will also determine which type of subnet is required
and where to search for an existing ALB to use. If you want to prevent
re-use of an existing ALB and force the creation of a new one use the
`--create-alb` option when you run your first plan.
In your initial configuration you do not need to specify the subnets
or the hosted zone id. The framework will discover those and report
if any required resources are unavailable. If the task type is
"https", the script looks for a public zone, public subnets and an
internet-facing ALB otherwise it looks for a private zone, private
subnets and an internal ALB.
## ACM Certificate Management
If the task type is "https" and no ACM certificate currently exists
for your domain, the framework will automatically provision one. The
certificate will be created in the same region as the ALB and issued
via AWS Certificate Manager. If the certificate is validated via DNS
and subsequently attached to the listener on port 443.
share/README.md view on Meta::CPAN
discovered to be missing from your environment.
## Application Load Balancer
When you provision an HTTP service, whether or not it is secure, the
service will placed behind an application load balancer. Your Fargate
service is created in private subnets, so your VPC must contain at
least two private subnets. Your load balancer can either be
_internally_ or _externally facing_.
By default, the framework looks for and will reuse a load balancer
with the correct scheme (internal or internet-facing), in a subnet
aligned with your task type. The ALB will be placed in public subnets
if it is internet-facing. You can override that behavior by either
explicitly setting the ALB arn in the `alb:` section of the
configuration or pass `--create-alb` when you run our plan and apply.
If no ALB is found or you passed the `--create-alb` option, a new ALB
is provisioned. When creating a new ALB, `app-FargateStack` will also
create the necessary listeners and listener rules for the ports you
have configured.