Integrated cluster into stack

Update pipes

Update actions/checkout

Fix s3 url
This commit is contained in:
Layla 2020-04-25 23:39:27 -04:00
parent 5dd3816d50
commit 89c10fffde
5 changed files with 40 additions and 9 deletions

View File

@ -11,7 +11,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout Repo - name: Checkout Repo
uses: actions/checkout@v1 uses: actions/checkout@v2.1.0
with:
submodules: 'true'
- name: Ship to S3 - name: Ship to S3
uses: jakejarvis/s3-sync-action@master uses: jakejarvis/s3-sync-action@master
with: with:

View File

@ -11,7 +11,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout Repo - name: Checkout Repo
uses: actions/checkout@v1 uses: actions/checkout@v2.1.0
with:
submodules: 'true'
- name: Ship to S3 - name: Ship to S3
uses: jakejarvis/s3-sync-action@master uses: jakejarvis/s3-sync-action@master
with: with:
@ -22,4 +24,11 @@ jobs:
DEST_DIR: nakama/production/cloudformation DEST_DIR: nakama/production/cloudformation
AWS_S3_BUCKET: sumu-stacks AWS_S3_BUCKET: sumu-stacks
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Deploy to AWS CloudFormation
uses: aws-actions/aws-cloudformation-github-deploy@v1
with:
name: ecs-nakama-stack
template: top.yaml
capabilities: "CAPABILITY_NAMED_IAM,CAPABILITY_IAM"
parameter-overrides: VpcId=${{ secrets.VPC_ID }},Domain=${{ secrets.DOMAIN }},SubDomain=nakama,PortalCertificate=${{ secrets.CERTIFICATE_ARN }},PublicSubnets=${{ secrets.SUBNET_IDS }}

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "cloudformation/cluster"]
path = cloudformation/cluster
url = git@github.com:josephbmanley/aws-cluster-stack.git

@ -0,0 +1 @@
Subproject commit a7d7961c271839c625718e42f7ac8d6171456892

View File

@ -21,15 +21,16 @@ Parameters:
#------------------- #-------------------
# ECS Configuration # ECS Configuration
#------------------- #-------------------
EcsCluster: EcsClusterOverride:
Type: String Type: String
Description: The cluster to run the Nakama service on. Description: The cluster to run the Nakama service on, if empty will create new cluster
Default: ""
#----------------- #-----------------
# Load Balancing # Load Balancing
#----------------- #-----------------
PublicSubnets: PublicSubnets:
Description: The public subnets for the ALB to run in. Description: The public subnets for the ALB to run in. (Seperate by spaces)
Type: String Type: String
PortalCertificate: PortalCertificate:
Description: Arn of AWS Certificate Description: Arn of AWS Certificate
@ -111,6 +112,7 @@ Parameters:
Conditions: Conditions:
CreateRdsStack: !Equals [!Ref CreateDatabase, "true"] CreateRdsStack: !Equals [!Ref CreateDatabase, "true"]
CreateDns: !Not [!Equals [!Ref Domain, ""]] CreateDns: !Not [!Equals [!Ref Domain, ""]]
CreateCluster: !Equals [!Ref EcsClusterOverride, ""]
Resources: Resources:
@ -154,14 +156,28 @@ Resources:
LoadBalancing: LoadBalancing:
Type: AWS::CloudFormation::Stack Type: AWS::CloudFormation::Stack
Properties: Properties:
TemplateURL: !Sub 'https://s3.${AWS::Region}.amazonaws.com/sumu-stacks/${release}/cloudformation/nakama/load_balancing.yaml' TemplateURL: !Sub 'https://s3.${AWS::Region}.amazonaws.com/sumu-stacks/nakama/${release}/cloudformation/nakama/load_balancing.yaml'
Parameters: Parameters:
environment: !Ref environment environment: !Ref environment
release: !Ref release release: !Ref release
VpcId: !Ref VpcId VpcId: !Ref VpcId
PublicSubnets: !Ref PublicSubnets PublicSubnets: !Join [",", !Split [" ", !Ref PublicSubnets]]
PortalCertificate: !Ref PortalCertificate PortalCertificate: !Ref PortalCertificate
#-------------
# ECS Cluster
#-------------
EcsCluster:
Condition: CreateCluster
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: !Sub 'https://s3.${AWS::Region}.amazonaws.com/sumu-stacks/nakama/${release}/cloudformation/cluster/top.yaml'
Parameters:
Environment: !Ref environment
VpcId: !Ref VpcId
SubnetIds: !Join [",", !Split [" ", !Ref PublicSubnets]]
Project: "Nakama"
#------------------- #-------------------
# ECS Task & Service # ECS Task & Service
#------------------- #-------------------
@ -181,7 +197,7 @@ Resources:
DependsOn: LoadBalancing DependsOn: LoadBalancing
Type: AWS::ECS::Service Type: AWS::ECS::Service
Properties: Properties:
Cluster: !Ref EcsCluster Cluster: !If ["CreateCluster", !GetAtt EcsCluster.Outputs.Cluster, !Ref EcsClusterOverride]
DesiredCount: 1 DesiredCount: 1
TaskDefinition: !GetAtt TaskDefinition.Outputs.TaskArn TaskDefinition: !GetAtt TaskDefinition.Outputs.TaskArn
LoadBalancers: LoadBalancers: