forked from nasa/earthdata-search
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
170 lines (143 loc) · 5.05 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
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
service: earthdata-search
provider:
name: aws
runtime: nodejs16.x
versionFunctions: false
stage: ${opt:stage, 'dev'}
region: us-east-1
endpointType: PRIVATE
memorySize: 128
environment:
dbEndpoint:
Fn::ImportValue: ${self:provider.stage}-DatabaseEndpoint
dbPort:
Fn::ImportValue: ${self:provider.stage}-DatabasePort
dbUsername: edsc
dbName: edsc_${self:provider.stage}
colorMapQueueUrl:
Ref: ColorMapsProcessingQueue
tagQueueUrl:
Ref: TagProcessingQueue
legacyServicesQueueUrl:
Ref: LegacyServicesOrderQueue
catalogRestQueueUrl:
Ref: CatalogRestOrderQueue
harmonyQueueUrl:
Ref: HarmonyOrderQueue
optionDefinitionQueueUrl:
Ref: OptionDefinitionsQueue
userDataQueueUrl:
Ref: UserDataQueue
obfuscationSpin: ${self:custom.variables.obfuscationSpin}
obfuscationSpinShapefiles: ${self:custom.variables.obfuscationSpinShapefiles}
configSecretId:
Fn::ImportValue: ${self:provider.stage}-DbPasswordSecret
collectionCapabilitiesLambda: ${self:custom.siteName}-generateCollectionCapabilityTags
geocodingService: ${self:custom.variables.geocodingService}
geocodingIncludePolygons: ${self:custom.variables.geocodingIncludePolygons}
NODE_OPTIONS: '--enable-source-maps'
vpc:
securityGroupIds:
- Fn::ImportValue: ${self:provider.stage}-LambdaSecurityGroup
subnetIds:
- ${env:SUBNET_ID_A, 'subnetIdA'}
- ${env:SUBNET_ID_B, 'subnetIdB'}
iam:
role:
Fn::ImportValue: ${self:provider.stage}-EDSCServerlessAppRole
# Prevent Serverless from attempting to modify the deployment bucket policy as NGAP does not allow it
deploymentBucket:
skipPolicySetup: true
# Deprecation warning: Starting with next major version, API Gateway naming will be changed from "{stage}-{service}" to "{service}-{stage}".
# Set "provider.apiGateway.shouldStartNameWithService" to "true" to adapt to the new behavior now.
# More Info: https://www.serverless.com/framework/docs/deprecations/#AWS_API_GATEWAY_NAME_STARTING_WITH_SERVICE
apiGateway:
shouldStartNameWithService: true
plugins:
- serverless-finch
- serverless-webpack
- serverless-step-functions
- serverless-plugin-split-stacks
- serverless-plugin-log-subscription
- serverless-offline
- ./serverless-plugins/serverless-webpack-include-migrations.js
#
# Lambda Functions
#
functions: ${file(./serverless-configs/${self:provider.name}-functions.yml)}
#
# Additional AWS Resources
#
resources: ${file(./serverless-configs/${self:provider.name}-resources.yml)}
#
# Step functions to manage order status jobs
#
stepFunctions: ${file(./serverless-configs/${self:provider.name}-step-functions.yml)}
# Package each lambda into individual zip files. This reduces the size of
# each lambda but increases the complexity of the compilation process slightly
package:
individually: true
configValidationMode: error
custom:
siteName: earthdata-search-${self:provider.stage}
infrastructureStackName: earthdata-search-infrastructure-${self:provider.stage}
variables:
# Default values for environment variables used to set environment variables
obfuscationSpin: ${env:OBFUSCATION_SPIN, ''}
obfuscationSpinShapefiles: ${env:OBFUSCATION_SPIN_SHAPEFILES, ''}
geocodingService: ${env:GEOCODING_SERVICE, 'nominatim'}
geocodingIncludePolygons: ${env:GEOCODING_INCLUDE_POLYGONS, 'false'}
cloudfrontToCloudwatchBucketPrefixApi:
Fn::Join:
- '/'
- - 'cloudfront/AWSLogs'
- !Ref 'AWS::AccountId'
- ${self:provider.region}
- 'search_${self:provider.stage}_api/'
cloudfrontToCloudwatchBucketPrefixS3:
Fn::Join:
- '/'
- - 'cloudfront/AWSLogs'
- !Ref 'AWS::AccountId'
- ${self:provider.region}
- 'search_${self:provider.stage}_s3/'
# Finch (S3 sync plugin)
client:
bucketName: ${self:custom.siteName}
distributionFolder: static/dist
objectHeaders:
index.html:
- name: Cache-Control
value: no-store
'*.css':
- name: Cache-Control
value: 'max-age=31536000'
'*.js':
- name: Cache-Control
value: 'max-age=31536000'
assets/:
- name: Cache-Control
value: 'max-age=31536000'
# Prevent the plugin from attempting to change the bucket policy
manageResources: false
# Default is 3000 so to avoid conflicts with rails applications we'll define a new port
serverless-offline:
httpPort: 3001
reloadHandler: true
# Uncomment useInProcess to enable in-process run mode
# https://github.com/dherault/serverless-offline#run-modes
# useInProcess: true
# Serverless Webpack configurations
webpack:
webpackConfig: 'serverless.webpack.config.js'
includeModules:
forceExclude:
- aws-sdk
packager: 'npm'
excludeFiles: src/**/*.test.js
# Manage resource count (Maximum of 200) by splitting up the cloudformation templates
splitStacks:
perFunction: true
logSubscription:
enabled: true
destinationArn: ${env:LOG_DESTINATION_ARN, ''}