-
-
Notifications
You must be signed in to change notification settings - Fork 374
Make function layer support normal lambda and runtime #1034
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This change couples Bref internal runtime with something that is very Symfony Runtime specific in such a way that if a Bref user, by sheer luck, defines an environment variable called APP_RUNTIME just for the sake of their own application, their deployment would break without any sense |
|
Thank you for the review. I see a few ways forward: What would you prefer? Do you see other alternatives? |
|
I don't really have a suggestion at this time. From my personal perspective, this PR touches upon the foundation of Bref in a way that doesn't really make much sense for Bref. To put it in other words, if the #889 brings more layers per PHP version into maintenance scope and support for a specific framework and a specific package which doesn't fully fit Bref's position. I interpret #1032 as Bref making a suggestion about an approach which at present isn't simple. From an end-user standpoint, if they're already trying to lift-and-shift their application into Serverless, the less friction we have the better it is. The more options the end user have, the more overwhelming the exercise becomes. You can see that even though you can deploy with Terraform, SAM or CDK, Bref only documents the Serverless Framework to make things simpler. Having to learn Bref and Symfony Runtime for it wouldn't be a good recommendation. In different circumstances when Serverless is much more mainstream and/or Runtime is much more mainstream, such a suggestion could make more sense. On a more fundamental level, Bref is here to provide the PHP Binary for people that want to build Serverless Application. There are 2 major flavours: lift-and-shift 25+ years of knowledge into AWS Lambda (Web Apps) or building from scratch (Function). One is much closer to PHP existing ecosystem and the other is much closer to AWS Lambda ecosystem. Symfony Runtime end up reimplementing things that have been solved on Bref already in a way that adds less friction to the end user given the current state of Serverless. Take Requests with Super Global as an example, Symfony Runtime is hiding Perhaps if you try to implement a strategy where Symfony Runtime only replaces PHP-FPM portion of Bref, which is the actual Runtime, instead of replacing the root of Bref, the current state of Bref would probably serve better that approach. One challenge here is the fact that Bref delegates the execution process to it's user only when a Runtime execution As for internal classes, I think a good way to interpret them is that any PHP file that is natively embedded into the layer are classified as internal and any file that comes via I apologize for the apparent difficulty I bring into this, but as open source maintainers we can all agree that we're looking out for what we think is best for our users with the information we have at hand. Having a single source of runtime is a bold move and as such it's only natural for it to face a lot of challenges. |
Excellent.
Yes. NodeJS would just do execute PHP with my index.php file.
That is exactly what the runtime component is doing.
That is not 100% true. The function layer will call autoload.php before the request comes in.
One could argue that this is overhead. And a more "normal" process should not be do this. We should do what other AWS Lambda Runtime do. Which is exactly what I propose with the Symfony Runtime component.
So you are saying that you don't see my use case in |
From what I saw, the runtime is replacing the bootstrap file and the entire start up process, it's not just replacing FPM.
We could implement the entire
if you use the FPM Layer and return the HTTP Kernel on your handler, does it not work? |
Thank you for this suggestion and for trying to think of a solution. It does work. However you have the following problem/issues:
For these reasons, I would like that Symfony 5.3+ applications (and other Symfony/Laravel applications) to be able to use the Runtime component in a more native way. Ie, without PHP-FPM. Is there another way that you think we can move forward with this? |
|
As discussed on Slack, could #694 be used to run whatever Symfony Runtime needs to run to resolve handlers? |
|
@mnapoli in the current state, no, because Symfony Runtime hijacks the bootstrap and call |
|
Thanks for sparking all these discussions, glad we finally have Symfony Runtime implemented in https://github.com/brefphp/symfony-bridge |
This is an alternative to #889
It will reuse the function layer. It will avoid using
bootstrap.phpifAPP_RUNTIMEis defined.FYI @deleugpn