-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.yml
More file actions
152 lines (139 loc) · 5.5 KB
/
serverless.yml
File metadata and controls
152 lines (139 loc) · 5.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# Welcome to Serverless!
#
# This file is the main config file for your service.
# It's very minimal at this point and uses default values.
# You can always add more config options for more control.
# We've included some commented out config examples here.
# Just uncomment any of them to get that config option.
#
# For full config options, check the docs:
# docs.serverless.com
#
# Happy Coding!
service: leroy-merlin # NOTE: update this with your service name
# You can pin your service to only deploy with a specific Serverless version
# Check out our docs for more details
# frameworkVersion: "=X.X.X"
provider:
vpc: ${file(config/configs-${opt:stage, self:provider.stage}.yml):globalVpc}
endpointType: ${file(config/configs-${opt:stage, self:provider.stage}.yml):globalEndPointType}
name: aws
memorySize: 512
region: ${opt:region, 'eu-west-1'}
runtime: python3.6
stage: ${opt:stage, 'dev'}
profile: ${opt:profile, 'leroy-merlin-dev'}
environment:
accountid: 'officina'
PROJECT_NAME: leroy-merlin-lambda
PLAYOFF_HOSTNAME: ${opt:playoff_hostname, 'playoff.cc'}
DYNAMODB_TOKEN_TABLE: lrm_playoff_token-${opt:stage, self:provider.stage}
DYNAMODB_TOKEN_TABLE_ARN: "arn:aws:dynamodb:${opt:region, self:provider.region}:${self:provider.environment.accountid}:table/${self:provider.environment.DYNAMODB_TOKEN_TABLE}"
DYNAMODB_USERS_INFO_TABLE: lrm_users_info-${opt:stage, self:provider.stage}
DYNAMODB_USERS_INFO_TABLE_ARN: "arn:aws:dynamodb:${opt:region, self:provider.region}:${self:provider.environment.accountid}:table/${self:provider.environment.DYNAMODB_USERS_INFO_TABLE}"
DYNAMODB_USERS_READY_INFO_TABLE: lrm_users_info_ready-${opt:stage, self:provider.stage}
DYNAMODB_USERS_READY_INFO_TABLE_ARN: "arn:aws:dynamodb:${opt:region, self:provider.region}:${self:provider.environment.accountid}:table/${self:provider.environment.DYNAMODB_USERS_READY_INFO_TABLE}"
# DYNAMODB_IP_AUTH_TABLE: ld_ipauth-${opt:stage, self:provider.stage}
# DYNAMODB_IP_AUTH_TABLE_ARN: "arn:aws:dynamodb:${opt:region, self:provider.region}:${self:provider.environment.accountid}:table/${self:provider.environment.DYNAMODB_IP_AUTH_TABLE}"
PLAYOFF_CLIENT_ID_READY: "${self:custom.secrets.PLAYOFF_CLIENT_ID_READY}"
PLAYOFF_CLIENT_SECRET_READY: "${self:custom.secrets.PLAYOFF_CLIENT_SECRET_READY}"
PLAYOFF_CLIENT_ID_PUBLISHED: "${self:custom.secrets.PLAYOFF_CLIENT_ID_PUBLISHED}"
PLAYOFF_CLIENT_SECRET_PUBLISHED: "${self:custom.secrets.PLAYOFF_CLIENT_SECRET_PUBLISHED}"
PLAYOFF_PROFILE_CACHE_DURATION_IN_MINUTES: '720'
PLAYOFF_RANKING_CACHE_DURATION_IN_MINUTES: '720'
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:DescribeTable
- dynamodb:Query
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
- dynamodb:Query
- dynamodb:Scan
Resource:
- "arn:aws:dynamodb:${self:provider.region}:*:table/${self:provider.environment.DYNAMODB_USERS_INFO_TABLE}"
- "arn:aws:dynamodb:${self:provider.region}:*:table/${self:provider.environment.DYNAMODB_USERS_READY_INFO_TABLE}"
- "arn:aws:dynamodb:${self:provider.region}:*:table/${self:provider.environment.DYNAMODB_TOKEN_TABLE}"
# - "arn:aws:dynamodb:${self:provider.region}:*:table/${self:provider.environment.DYNAMODB_IP_AUTH_TABLE}"
package:
exclude:
- 'node_modules/**'
- 'README.md'
- 'package.json'
- 'package-lock.json'
- '.eggs/**'
- '.idea/**'
- '.tests/**'
- 'testNick.py'
- 'schemas/**'
- 'scripts/**'
include:
- 'gamecontroller/**'
functions:
authorizerUser:
handler: handler_stub.auth
play_action:
handler: handler_stub.play_action
timeout: 10
events:
- http:
path: api/play/{player}
method: put
cors: true
authorizer: ${file(config/configs-${opt:stage, self:provider.stage}.yml):globalAuthorizer}
get_user_status:
handler: handler_stub.user_status_action
timeout: 10
events:
- http:
path: api/userstatus/{player}
method: get
cors: true
authorizer: ${file(config/configs-${opt:stage, self:provider.stage}.yml):globalAuthorizer}
level_upgrade:
handler: handler_stub.level_upgrade
timeout: 10
events:
- http:
path: api/levelupgrade/{player}
method: put
cors: true
get_lazy_users:
handler: handler_stub.get_lazy_users
timeout: 10
events:
- http:
path: api/lazyusers/{from}
method: get
cors: true
authorizer: ${file(config/configs-${opt:stage, self:provider.stage}.yml):globalAuthorizer}
# reset_players:
# handler: handler_stub.reset_players
# timeout: 300
# events:
# - schedule:
# rate: cron(0 9,13 ? * MON-FRI *)
# - schedule:
# rate: cron(0 15 ? * MON-THU *)
resources:
Resources:
${file(config/configs-${opt:stage, self:provider.stage}.yml):additionalResources}
custom:
capacities:
${file(config/configs-${opt:stage, self:provider.stage}.yml):customCapacities}
authorizer:
users:
name: authorizerUser
type: request
identitySource: method.request.header.X-Forwarded-For
resultTtlInSeconds: ${opt:resultTtlInSeconds, '0'}
prune:
automatic: true
number: 3
secrets: ${file(secrets_lrm.yml):${opt:stage, self:provider.stage}}
plugins:
- serverless-python-requirements
- serverless-prune-plugin
- serverless-dynamodb-autoscaling