2019-10-23 07:03:54 +02:00
|
|
|
AWSTemplateFormatVersion: '2010-09-09'
|
|
|
|
Description: Nakama ECS Task
|
|
|
|
Parameters:
|
|
|
|
ServerName:
|
|
|
|
Type: String
|
|
|
|
Default: "nakama-default"
|
2019-11-03 23:34:28 +01:00
|
|
|
|
|
|
|
#----------------------------
|
|
|
|
# Admin Portal Configuration
|
|
|
|
#----------------------------
|
|
|
|
NakamaUsername:
|
|
|
|
Type: String
|
|
|
|
Description: Username to access the Nakama admin portal
|
|
|
|
Default: "admin"
|
|
|
|
NakamaPasswordOverride:
|
|
|
|
Type: String
|
|
|
|
Description: Override Nakama admin portal password
|
|
|
|
Default: ""
|
|
|
|
|
|
|
|
#------------------------
|
|
|
|
# Database Configuration
|
|
|
|
#------------------------
|
2019-10-23 07:03:54 +02:00
|
|
|
DatabaseUsername:
|
|
|
|
Type: String
|
|
|
|
Description: Username of the Postgres server
|
|
|
|
Default: postgres
|
|
|
|
DatabasePassword:
|
|
|
|
Type: String
|
|
|
|
Description: Password for the Postgres server
|
|
|
|
DatabaseEndpoint:
|
|
|
|
Type: String
|
|
|
|
Description: Endpoint for the Postgres server
|
|
|
|
DatabasePort:
|
|
|
|
Type: Number
|
|
|
|
Description: Port for the Postgres server
|
|
|
|
Default: 5432
|
|
|
|
|
2019-11-03 23:34:28 +01:00
|
|
|
Conditions:
|
|
|
|
CreateSecret: !Equals [!Ref NakamaPasswordOverride, ""]
|
|
|
|
|
2019-10-23 07:03:54 +02:00
|
|
|
Resources:
|
2019-11-03 23:34:28 +01:00
|
|
|
|
|
|
|
AdminPortalPassword:
|
|
|
|
Type: AWS::SecretsManager::Secret
|
|
|
|
Condition: CreateSecret
|
|
|
|
Properties:
|
|
|
|
Name: !Sub "nakama/admin/password"
|
|
|
|
Description: "Admin portal password for Nakama"
|
|
|
|
GenerateSecretString:
|
|
|
|
ExcludePunctuation: true
|
|
|
|
ExcludeCharacters: '"@/\'
|
|
|
|
|
2019-10-23 07:03:54 +02:00
|
|
|
LogGroup:
|
|
|
|
Type: AWS::Logs::LogGroup
|
|
|
|
Properties:
|
|
|
|
RetentionInDays: 7
|
|
|
|
LogGroupName: "sumu-nakama"
|
|
|
|
|
|
|
|
TaskDefinition:
|
|
|
|
Type: AWS::ECS::TaskDefinition
|
|
|
|
Properties:
|
|
|
|
ContainerDefinitions:
|
|
|
|
- Name: nakama
|
|
|
|
Essential: 'true'
|
|
|
|
Image: "heroiclabs/nakama:2.7.0"
|
|
|
|
MemoryReservation: 800
|
|
|
|
PortMappings:
|
2019-11-11 00:45:38 +01:00
|
|
|
- HostPort: 0
|
|
|
|
ContainerPort: 7348
|
2019-10-23 07:03:54 +02:00
|
|
|
- HostPort: 0
|
|
|
|
ContainerPort: 7349
|
|
|
|
- HostPort: 0
|
|
|
|
ContainerPort: 7350
|
|
|
|
- HostPort: 0
|
|
|
|
ContainerPort: 7351
|
|
|
|
LogConfiguration:
|
|
|
|
LogDriver: awslogs
|
|
|
|
Options:
|
|
|
|
awslogs-region:
|
|
|
|
Ref: AWS::Region
|
|
|
|
awslogs-group:
|
|
|
|
Ref: LogGroup
|
2019-11-03 23:34:28 +01:00
|
|
|
MountPoints:
|
|
|
|
- ContainerPath: /nakama/volume
|
|
|
|
SourceVolume: "nakama-volume"
|
|
|
|
EntryPoint:
|
2019-10-23 07:03:54 +02:00
|
|
|
- "/bin/sh"
|
|
|
|
- "-ecx"
|
2019-11-03 23:34:28 +01:00
|
|
|
- !Join ["", [
|
|
|
|
!Sub "/nakama/nakama migrate up --database.address ${DatabaseUsername}:${DatabasePassword}@${DatabaseEndpoint}:${DatabasePort} &&\n",
|
|
|
|
!Sub "exec /nakama/nakama --name ${ServerName} --database.address ${DatabaseUsername}:${DatabasePassword}@${DatabaseEndpoint}:${DatabasePort} --console.username ${NakamaUsername} --console.password \"",
|
|
|
|
!If [CreateSecret, !Join ["", ["{{resolve:secretsmanager:", !Ref AdminPortalPassword,":SecretString}}" ]], !Ref NakamaPasswordOverride ], "\""
|
|
|
|
]]
|
|
|
|
Volumes:
|
|
|
|
- Name: "nakama-volume"
|
2019-10-23 07:03:54 +02:00
|
|
|
Outputs:
|
|
|
|
TaskArn:
|
|
|
|
Description: ARN of the TaskDefinition
|
|
|
|
Value: !Ref TaskDefinition
|