A simple Laravel project configured to be deployed as a serverless application on AWS Lambda using bref.sh. The goal of this project is to fully understand how a serverless configuration changes the fundamentals of a Laravel project. (It does, trust me).
The documentation for setting up the local development enviroment for the project is based our Devilbox as this repository is more of a reminder for me, how to achieve the move to a serverless setup.
To have an easier time with the ever growing list of projects, I am using Devilbox to manage my developing enviroment.
If you want to use this project with Sail make sure to configure the vite.config.js
file to suit your enviroment.
To set up Devilbox, follow their documentation. (it's pretty good)
Just a heads up, I have renamed my suffix to be .loc
intsead of .dvl.to
, if you don't want that, make sure to edit the vite.config.js
file.
Make sure to follow the Getting started section of their documentation for Laravel. Don't forget the setup before it. This will explain how to run artisan commands as well. (Useful for migrations and such)
# Example to migrate the live version
serverless bref:cli --args="migrate --force"
This can be automated using CI/CD as well.
- Create the required parameters in the SSM Paramter Store.
You can find the required parameters in the
serverless.yml
file. - For the RDS to work, make sure to update the VPC's server rules to allow inbound MySQL / Aurora requests. (Note: You can find the rules inside the VPC settings under the RDS, not on the RDS Istance itself.)
You can find and example GitHub Action to deploy the project inside the .github/workflows/main.yml
file.