forked from code4romania/war-support-dopomoha
-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
105 lines (98 loc) · 2.53 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: ctsf
provider:
profile: taskforce
name: aws
# The AWS region in which to deploy (us-east-1 is the default)
region: eu-west-1
# The stage of the application, e.g. dev, production, staging… ('dev' is the default)
stage: production
runtime: provided.al2
apiGateway:
binaryMediaTypes:
- '*/*'
environment:
BREF_BINARY_RESPONSES: '1'
APP_ENV: ${sls:stage}
APP_DEBUG: false
DB_CONNECTION: pgsql
DB_HOST: ${ssm:/ctsf/db-host}
DB_PORT: 5432
DB_DATABASE: ce_trebuie_sa_fac
DB_USERNAME: postgres
DB_PASSWORD: ${ssm:/ctsf/db-password}
SESSION_DRIVER: database
CACHE_DRIVER: database
FILESYSTEM_DRIVER: s3
FILESYSTEM_CLOUD: s3
AWS_BUCKET: !Ref Storage
iam:
role:
statements:
# Allow Lambda to read and write files in the S3 buckets
- Effect: Allow
Action: s3:*
Resource:
- !Sub '${Storage.Arn}' # the storage bucket
- !Sub '${Storage.Arn}/*' # and everything inside
package:
# 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
timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
layers:
- ${bref:layer.php-80-fpm}
- ${bref-extra:gd-php-80}
events:
- httpApi: '*'
- schedule:
rate: rate(5 minutes)
input:
warmer: true
# This function lets us run artisan commands in Lambda
artisan:
handler: artisan
timeout: 120 # in seconds
layers:
- ${bref:layer.php-80} # PHP
- ${bref-extra:gd-php-80}
- ${bref:layer.console} # The "console" layer
constructs:
website:
domain:
- dopomoha.ro
- www.dopomoha.ro
redirectToMainDomain: true
certificate: ${ssm:/ctsf/certificate-arn}
type: server-side-website
assets:
'/assets/*': public/assets
'/favicon.ico': public/favicon.ico
'/robots.txt': public/robots.txt
# add here any file or directory that needs to be served from S3
forwardedHeaders:
- Accept
- Accept-Language
- Authorization
- Content-Type
- Origin
- Referer
- X-Forwarded-Host
- X-XSRF-TOKEN
- X-INERTIA
- X-INERTIA-VERSION
plugins:
- ./vendor/bref/bref
- ./vendor/bref/extra-php-extensions
- serverless-lift
resources:
Resources:
Storage:
Type: AWS::S3::Bucket