Sha256: 1db809680f317bf8d73cbfd0067f9a847b6b7d284734cb26b0d703116ed79191

Contents?: true

Size: 1.53 KB

Versions: 3

Compression:

Stored size: 1.53 KB

Contents

#!/usr/bin/env bash
set -e

export RAILS_ENV=${RAILS_ENV:="production"}
export AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:=us-east-1}
export CLOUDFORMATION_BUCKET=${CLOUDFORMATION_BUCKET:="lamby.cloudformation.$(whoami)"}

# 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/myorg/APPNAMEHERE"

./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:]' ','
)}

sam build \
  --parameter-overrides \
  RailsEnv="${RAILS_ENV}"

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 "APPNAMEHERE-${RAILS_ENV}"

echo "== SAM deploy..."
sam deploy \
  --region "$AWS_DEFAULT_REGION" \
  --template-file ./.aws-sam/build/packaged.yaml \
  --stack-name "APPNAMEHERE-${RAILS_ENV}" \
  --image-repository "$IMAGE_REPOSITORY" \
  --capabilities "CAPABILITY_IAM" \
  --parameter-overrides \
    RailsEnv="${RAILS_ENV}" \
    VpcId=${VPCID} \
    Subnets=${SUBNETS}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lamby-2.5.3 lib/lamby/templates/alb/_deploy
lamby-2.5.2 lib/lamby/templates/alb/_deploy
lamby-2.5.1 lib/lamby/templates/alb/_deploy