-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserverless.yml
121 lines (116 loc) · 3.11 KB
/
serverless.yml
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
service: qgis-plugin-repo
configValidationMode: error
plugins:
- serverless-python-requirements
- serverless-wsgi
- serverless-apigw-binary
- serverless-plugin-git-variables
provider:
name: aws
runtime: python3.7
region: ap-southeast-2
environment:
STAGE: ${opt:stage, self:provider.stage}
RESOURCE_SUFFIX: ${param:resource-suffix, ''}
REPO_BUCKET_NAME: "${self:service}-${self:provider.environment.RESOURCE_SUFFIX}"
PLUGINS_TABLE_NAME: "${self:service}-${self:provider.environment.RESOURCE_SUFFIX}"
GIT_SHA: ${git:sha1}
GIT_TAG: ${git:describeLight}
iam:
role:
statements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DescribeTable
Resource: "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.PLUGINS_TABLE_NAME}"
- Effect: Allow
Action:
- s3:PutObject
Resource:
- Fn::Join:
- ""
- - "arn:aws:s3:::"
- "Ref" : "RepoBucket"
- '/*'
custom:
pythonRequirements:
usePoetry: false
noDeploy:
- boto3
- botocore
apigwBinary:
types:
- application/octet-stream
- application/zip
wsgi:
app: src/plugin/api.app
textMimeTypes:
- application/octet-stream
- application/zip
package:
patterns:
- '!./.venv/**'
functions:
app:
handler: wsgi_handler.handler
events:
- http:
path: /
method: ANY
cors: true
- http:
path: '{proxy+}'
method: ANY
cors: true
resources:
Resources:
# Configure Repo Bucket Policy
RepoBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: ${self:provider.environment.REPO_BUCKET_NAME}
AccessControl: PublicRead
RepoBucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: !Ref RepoBucket
PolicyDocument:
Id: RepoBucketPolicy
Version: '2012-10-17'
Statement:
- Sid: PublicGetObj
Effect: Allow
Principal: '*'
Action:
- "s3:GetObject"
Resource:
- Fn::Join:
- ""
- - "arn:aws:s3:::"
- "Ref" : "RepoBucket"
- '/*'
- Fn::Join:
- ""
- - "arn:aws:s3:::"
- "Ref" : "RepoBucket"
PluginsDynamoDBTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
TableName: ${self:provider.environment.PLUGINS_TABLE_NAME}
AttributeDefinitions:
- AttributeName: id
AttributeType: S
- AttributeName: item_version
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
- AttributeName: item_version
KeyType: RANGE
BillingMode: PAY_PER_REQUEST