lib/lamby/templates/alb/_deploy in lamby-2.8.0 vs lib/lamby/templates/alb/_deploy in lamby-3.0.0

- old
+ new

@@ -1,62 +1,31 @@ -#!/usr/bin/env bash +#!/bin/sh set -e -export DEPLOYMENT_NAME="myorg/APPNAMEHERE" -export RAILS_ENV=${RAILS_ENV:="production"} -export AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:=us-east-1} -export CLOUDFORMATION_BUCKET=${CLOUDFORMATION_BUCKET:="lamby.cloudformation.${DEPLOYMENT_NAME/\//-}"} - # https://github.com/aws/aws-sam-cli/issues/2447 -export AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text) -export IMAGE_REPOSITORY="${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/${DEPLOYMENT_NAME}" +AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text) +IMAGE_REPOSITORY="${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/APPNAMEHERE" -echo '== Creating ECR repository ==' -echo 'You can safely ignore any RepositoryAlreadyExistsException errors...' -aws ecr create-repository \ - --repository-name "$DEPLOYMENT_NAME" \ - --image-tag-mutability MUTABLE \ - --image-scanning-configuration scanOnPush=true \ - --region "$AWS_DEFAULT_REGION" || true - -# Build our application code into a deployment folder +echo "== Lamby build ==" ./bin/_build -export VPCID=${VPCID:=$( - aws ec2 describe-vpcs \ - --output text \ - --filters 'Name=state,Values=available' \ - --query 'Vpcs[0].VpcId' -)} - -export SUBNETS=${SUBNETS:=$( - aws ec2 describe-subnets \ - --output text \ - --filters 'Name=state,Values=available' "Name=vpc-id,Values=$VPCID" \ - --query 'Subnets[*].SubnetId' | \ - tr -s '[:blank:]' ',' -)} - +echo "== SAM build ==" sam build \ --parameter-overrides \ - RailsEnv="${RAILS_ENV}" + RailsEnv="${RAILS_ENV}" -echo "== SAM package..." +echo "== SAM package ==" sam package \ --region "$AWS_DEFAULT_REGION" \ --template-file ./.aws-sam/build/template.yaml \ --output-template-file ./.aws-sam/build/packaged.yaml \ --image-repository "$IMAGE_REPOSITORY" \ - --s3-bucket "${CLOUDFORMATION_BUCKET}" \ - --s3-prefix "${DEPLOYMENT_NAME/\//-}-${RAILS_ENV}" -echo "== SAM deploy..." +echo "== SAM deploy ==" sam deploy \ --region "$AWS_DEFAULT_REGION" \ --template-file ./.aws-sam/build/packaged.yaml \ - --stack-name "${DEPLOYMENT_NAME/\//-}-${RAILS_ENV}" \ + --stack-name "APPNAMEHERE-${RAILS_ENV}" \ --image-repository "$IMAGE_REPOSITORY" \ --capabilities "CAPABILITY_IAM" \ --parameter-overrides \ - RailsEnv="${RAILS_ENV}" \ - VpcId=${VPCID} \ - Subnets=${SUBNETS} + RailsEnv="${RAILS_ENV}"