Skip to content

Instantly share code, notes, and snippets.

@azole
Last active November 27, 2020 01:56
Show Gist options
  • Save azole/8e8e7e6f1d1ac03687f88cf681c4f049 to your computer and use it in GitHub Desktop.
Save azole/8e8e7e6f1d1ac03687f88cf681c4f049 to your computer and use it in GitHub Desktop.
serverless.yml for Laravel8 + bref1.0 + redis extension
service: laravel
provider:
name: aws
# The AWS region in which to deploy (us-east-1 is the default)
region: ap-northeast-1
# The stage of the application, e.g. dev, production, staging… ('dev' is the default)
stage: dev
runtime: provided.al2
package:
# Directories to exclude from deployment
exclude:
- 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-74-fpm}
# for laravel redis
- ${bref:extra.redis-php-74}
events:
- httpApi: '*'
vpc: # for redis
securityGroupIds:
- sg-xxxxxxx
subnetIds:
- subnet-xxxxxxx
# This function lets us run artisan commands in Lambda
artisan:
handler: artisan
timeout: 120 # in seconds
layers:
- ${bref:layer.php-74} # PHP
- ${bref:layer.console} # The "console" layer
plugins:
# We need to include the Bref plugin
- ./vendor/bref/bref
# add for redis
- ./vendor/bref/extra-php-extensions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment