-
Notifications
You must be signed in to change notification settings - Fork 2
/
serverless.yml
105 lines (96 loc) · 3.18 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
service: benbjurstrom
provider:
name: aws
# The AWS region in which to deploy (us-east-1 is the default)
region: us-east-1
stage: 'prod'
apiGateway:
binaryMediaTypes:
- 'image/webp'
# Environment variables
environment:
APP_KEY: ${ssm:/benbjurstrom-com/APP_KEY}
TORCHLIGHT_TOKEN: ${ssm:/benbjurstrom-com/TORCHLIGHT_TOKEN}
APP_ENV: production # Or use ${sls:stage} if you want the environment to match the stage
APP_NAME: benbjurstrom
APP_DEBUG: true
APP_URL: https://benbjurstrom.com
SESSION_DRIVER: array
CACHE_STORE: array
BREF_BINARY_RESPONSES: '1'
AWS_BUCKET: !Ref PrezetBucket
PREZET_FILESYSTEM_DISK: s3
iam:
role:
statements:
# Allow Lambda to read and write files in the S3 buckets
- Effect: Allow
Action: s3:*
Resource:
- !Sub '${PrezetBucket.Arn}' # the storage bucket
- !Sub '${PrezetBucket.Arn}/*' # and everything inside
resources:
Resources:
PrezetBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: benbjurstrom-prezet-storage
package:
# Files and directories to exclude from deployment
patterns:
- '!node_modules/**'
- '!public/storage'
- '!resources/assets/**'
- '!storage/**'
- '!tests/**'
functions:
# This function runs the Laravel website/API
web:
handler: public/index.php
runtime: php-83-fpm
reservedConcurrency: 10
timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
layers:
- ${bref-extra:gd-php-83}
events:
- httpApi: '*'
# This function lets us run artisan commands in Lambda
artisan:
handler: artisan
runtime: php-83-console
reservedConcurrency: 5
timeout: 720 # in seconds
# Uncomment to also run the scheduler every minute
#events:
# - schedule:
# rate: rate(1 minute)
# input: '"schedule:run"'
plugins:
- ./vendor/bref/bref
- ./vendor/bref/extra-php-extensions
- serverless-lift
- serverless-s3-sync
- serverless-api-gateway-throttling
constructs:
website:
domain: benbjurstrom.com
certificate: arn:aws:acm:us-east-1:221576664686:certificate/67c7fb10-bce7-4904-b109-cfdd99fbb8c0
type: server-side-website
assets:
'/build/*': public/build
'/favicon/*': public/favicon
'/favicon.ico': public/favicon.ico
'/favicon.svg': public/favicon.svg
'/ogimage.png': public/ogimage.png
'/robots.txt': public/robots.txt
'/prezet_sitemap.xml': public/prezet_sitemap.xml
# add here any file or directory that needs to be served from S3
custom:
apiGatewayThrottling:
maxRequestsPerSecond: 20
maxConcurrentRequests: 10
s3Sync:
# A simple configuration for copying static assets
- bucketName: benbjurstrom-prezet-storage # required
localDir: storage/prezet # required
deleteRemoved: true # optional, indicates whether sync deletes files no longer present in localDir. Defaults to 'true'