Merge pull request #2 from josephbmanley/feature/cluster
Integrated cluster into stack
This commit is contained in:
commit
770a3fe7b8
6
.github/workflows/push_develop.yml
vendored
6
.github/workflows/push_develop.yml
vendored
@ -4,14 +4,16 @@ name: Push Develop Release
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- develop
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@v1
|
||||
uses: actions/checkout@v2.1.0
|
||||
with:
|
||||
submodules: 'true'
|
||||
- name: Ship to S3
|
||||
uses: jakejarvis/s3-sync-action@master
|
||||
with:
|
||||
|
15
.github/workflows/push_production.yml
vendored
15
.github/workflows/push_production.yml
vendored
@ -4,14 +4,16 @@ name: Push Production Release
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@v1
|
||||
uses: actions/checkout@v2.1.0
|
||||
with:
|
||||
submodules: 'true'
|
||||
- name: Ship to S3
|
||||
uses: jakejarvis/s3-sync-action@master
|
||||
with:
|
||||
@ -22,4 +24,11 @@ jobs:
|
||||
DEST_DIR: nakama/production/cloudformation
|
||||
AWS_S3_BUCKET: sumu-stacks
|
||||
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
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "cloudformation/cluster"]
|
||||
path = cloudformation/cluster
|
||||
url = git@github.com:josephbmanley/aws-cluster-stack.git
|
1
cloudformation/cluster
Submodule
1
cloudformation/cluster
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit a7d7961c271839c625718e42f7ac8d6171456892
|
@ -21,15 +21,16 @@ Parameters:
|
||||
#-------------------
|
||||
# ECS Configuration
|
||||
#-------------------
|
||||
EcsCluster:
|
||||
EcsClusterOverride:
|
||||
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
|
||||
#-----------------
|
||||
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
|
||||
PortalCertificate:
|
||||
Description: Arn of AWS Certificate
|
||||
@ -111,6 +112,7 @@ Parameters:
|
||||
Conditions:
|
||||
CreateRdsStack: !Equals [!Ref CreateDatabase, "true"]
|
||||
CreateDns: !Not [!Equals [!Ref Domain, ""]]
|
||||
CreateCluster: !Equals [!Ref EcsClusterOverride, ""]
|
||||
|
||||
Resources:
|
||||
|
||||
@ -154,14 +156,28 @@ Resources:
|
||||
LoadBalancing:
|
||||
Type: AWS::CloudFormation::Stack
|
||||
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:
|
||||
environment: !Ref environment
|
||||
release: !Ref release
|
||||
VpcId: !Ref VpcId
|
||||
PublicSubnets: !Ref PublicSubnets
|
||||
PublicSubnets: !Join [",", !Split [" ", !Ref PublicSubnets]]
|
||||
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
|
||||
#-------------------
|
||||
@ -181,7 +197,7 @@ Resources:
|
||||
DependsOn: LoadBalancing
|
||||
Type: AWS::ECS::Service
|
||||
Properties:
|
||||
Cluster: !Ref EcsCluster
|
||||
Cluster: !If ["CreateCluster", !GetAtt EcsCluster.Outputs.Cluster, !Ref EcsClusterOverride]
|
||||
DesiredCount: 1
|
||||
TaskDefinition: !GetAtt TaskDefinition.Outputs.TaskArn
|
||||
LoadBalancers:
|
||||
|
Loading…
Reference in New Issue
Block a user