I’m happy to write about the new solution from Taylor Otwell, the founder of Laravel, the most impressive PHP Framework of this century.
What is Laravel Vapor?
Let me say it with the words of Taylor Otwell:
Laravel Vapor is a serverless deployment platform for Laravel, powered by AWS. Launch your Laravel infrastructure on Vapor and fall in love with the scalable simplicity of serverless.
Important to know
In general, the docs from Vapor are quite straightforward, but there are some important things you have to know before you’re trying to deploy a project to Vapor.
- Laravel 5.8 is required
- Use the `asset()` function to implement assets.
- Certificates: If you’re new to AWS or your account has increased limits in regions like EU (like in my case) then you have to increase your Certificate Manager Limits in us-east-1 soon! For example, our account has revenue from roundabout 2k $ per month in eu-central-1, and we have great limit increases at AWS in this area, but AWS just increases limits depending on location. So you have to make a new support request for a limit-increase in us-east-1 (N. Virginia)
Of course, you can deploy Vapor from your local machine quite easy. But if you’re working with a team it's difficult to decide who must deploy. And there are so many other reasons for CD.
I tested it with CodeShip and I can say: It’s awesome.
The only thing you have to know is, that you have to install the vapor-cli in the project. After that, you can define specific deployment stages for different branches, that's it!
While tinkering around with bref, I instantly had issues with the project size. A normal lambda function can hold 250MB of function and 50MB in zipped format. I had issues with the zipped limitation because you have to modify manually which files are uploaded with your function and I was tinkering around hours and hours which files are necessary and which can be removed or moved to an S3 bucket.
After all, I stopped working with bref and I’d wait for Vapor. I was surprised about the easiness. Vapor just zips the necessary files and moves automatically the assets to an S3 bucket. My biggest laravel-projects are deployed to lambda now and I don't have any storage issues!
In which project we can use Vapor?
I’m going to use it in all of my future projects! Of course, it can be more expensive if you have a high-frequented platform or website. But all that server-hustling is over forever!
And you can decrease your costs with an ELB instead of an API-Gateway (at a larger scale). But it’s combined with a higher flat on lower request-rates, so you should take your calculator and compare it for big projects.
The good thing is, that you can process so many jobs you want at once, without any performance decrease. The thing you have to remember:
Not everything is scaleable like lambda, for example MySQL. If you have to many connections you run into errors. For example RDS instances in small scales can hold 30–50 connections at the same time.
Vapors answer: Limitations of concurrently running CLI lambdas.