4 ms·
I wrote a library [1] for Laravel that lets you put a kind of "microservice" inside of your monolith. It lets you develop, deploy, and execute AWS Lambda funct
by aarondf 4y ago
I wrote a library [1] for Laravel that lets you put a kind of "microservice" inside of your monolith.
It lets you develop, deploy, and execute AWS Lambda functions from your Laravel application.
The theory here is that sometimes you need some other language/infrastructure beyond what you're comfortable devops-ing yourself, and Lambda is actually quite good at providing you with an entire stack of stuff you don't have to own.
So if you need a single Node, Python, or Ruby function you can put just that part on Lambda and still call it from Laravel as if it were a native PHP function. No API gateway or anything to muck about with, either.
Is it a true microservice? Not really, although who knows what that actually means. It does allow you to take advantage of some parts of microservices without the pain though!
[1] https://github.com/hammerstonedev/sidecar https://github.com/hammerstonedev/sidecar
- upupandup 4y agoThe problem I find with these plugin serverless is that they rarely work well. Even with a framework produced by Chalice, there are issues that are largely so minor in detail but required to work well with AWS. Often they are not even code related but infrastructure. IMHO, AWS Chalice remains the goto method to generate REST API serverless manner but also curious how yours also differ from the paid Laravel solution that lets you deploy your stack serverless.
- aarondf 4y ago> IMHO, AWS Chalice remains the goto method to generate REST API serverless manner Sidecar (my library) provides no REST API. You just... call the function from PHP. So you'd call it like <?php MyNeatServerlessFunction::execute(['foo' => 'bar']); And that would run the function _on Lambda._ Whether that function is JS, Ruby, Python, whatever. With Sidecar, you never have to configure anything in the AWS console, besides the initial IAM configuration. You give Sidecar admin keys, it configures all the permissions, roles, etc, and then self-destructs the admin keys. So you don't have to muck around with anything at all. > also curious how yours also differ from the paid Laravel solution that lets you deploy your stack serverless. Sidecar deploys and executes _non-PHP_ functions from your Laravel app. So it's completely different. Vapor deploys your whole app and runs it on Lambda, I just deploy single functions at a time.
- upupandup 4y agoSo it doesn't configure API gateway? Not sure how useful this is since that is the entry point for all the lambda functions. If I want to create functions easily I would just use pure functions in Chalice @app.lambda_function(name='MyFunction') def myfunc: return 'OK' and then I could go into MyFunction and modify the code. I just don't see why I would need to use PHP for this.
- aarondf 4y agoCorrect, no API gateway. > Not sure how useful this is since that is the entry point for all the lambda functions. Well that's just not accurate! You can also call them via API. Which is what Sidecar does. > I just don't see why I would need to use PHP for this. Because you're already using Laravel! If you're not using Laravel, you wouldn't use this. If you want to see me doing a live-demo of this at a conference, it might make a bit more sense: https://youtu.be/0Rq-yHAwYjQ?t=11751 https://youtu.be/0Rq-yHAwYjQ?t=11751