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

v0.3 - Official PHP support on Lambda, better performances and AWS SAM #113

Open
wants to merge 297 commits into
base: master
from

Conversation

Projects
None yet
@mnapoli
Copy link
Owner

mnapoli commented Dec 16, 2018

This pull request will contain all the changes planned for v0.3 to keep master (v0.2.*) stable in the meantime.

The future website for Bref 0.3: bref.sh

Summary of changes

AWS has released an API to provide support for any language in Lambda. Bref will move from its Javascript-based hack to this new official API.

Bref will provide a PHP runtime optimized for CLI scripts (workers, CLI tasks, simple PHP lambdas, etc.) as well as another PHP runtime optimized for HTTP applications (based on PHP-FPM).

It is very likely that Bref will switch from the "serverless framework" to using AWS SAM instead for deployment and configuration (see #99). On top of advanced integration to other AWS services, this brings very useful tools for local development based on Docker.

With v0.3 it will be even easier to integrate HTTP applications and support any framework. Performances will also dramatically increase thanks to research and benchmarks as well as new experimental modes to run PHP faster in some scenarios (more information to come).

Finally, Bref v0.3 will come with a completely rewritten and extensive documentation.

v0.3

Check out the v0.3 Kanban board.

Detailed changes

  • #106 PHP runtime for AWS Lambda (built through the official support for 3rd party languages)
  • #112 Client for the Lambda runtime API
  • #115 PHP-FPM runtime optimized for HTTP applications
  • #122 A console runtime for Console applications
  • #124 The λ() function was replaced by a lambda() function
  • #127 Website and documentation
  • #126 Migrate to AWS SAM for deployments
  • #129 an industrialized build pipeline for the runtimes
@nealio82

This comment has been minimized.

Copy link
Contributor

nealio82 commented Dec 16, 2018

This is amazing! What's the long-term plan for building the runtime? Will bref provide stock runtimes for people who are just trying things out?

Also, will building the runtime be invoked as part of the first bref deploy or does the user always need to do it themselves? What about for using SAM local? It might be nice to have a single bref develop command in the Makefile which creates the runtime and sets up the config for SAM Local.

@mnapoli

This comment has been minimized.

Copy link
Owner

mnapoli commented Dec 18, 2018

@nealio82 I finally answered in #114: #114 (comment)

About building runtimes: ideally you shouldn't have to worry about this, it just works (see the WIP instructions in the diff: https://github.com/mnapoli/bref/pull/113/files#diff-279a8ca151371a6a63058dc411985dd1R9). And locally it just works too, SAM is incredibly awesome for this. The only thing I'm worried with SAM when running locally is performances because you get a cold start every time. But you can also still run Symfony/Laravel the only way locally, it still works that way. We'll see as we use it more.

Show resolved Hide resolved Makefile Outdated
Show resolved Hide resolved Makefile
Show resolved Hide resolved runtime/default/bootstrap Outdated
@@ -0,0 +1,105 @@
#!/bin/sh

This comment has been minimized.

@staabm

staabm Dec 24, 2018

Contributor

different then in the file above...?

This comment has been minimized.

@mnapoli

mnapoli Dec 26, 2018

Owner

This one doesn't run in Lambda, it runs on the build machine.

# Compile PHP
mkdir /tmp/bref
cd /tmp/bref
curl -sL https://github.com/php/php-src/archive/php-$PHP_VERSION.tar.gz | tar -zxv

This comment has been minimized.

@staabm

staabm Dec 24, 2018

Contributor

wget fallback when curl is not available?

This comment has been minimized.

@mnapoli

mnapoli Dec 26, 2018

Owner

Do you have a replacement that works for that line?

Show resolved Hide resolved runtime/default/php.ini Outdated
Show resolved Hide resolved src/functions.php Outdated

mnapoli added some commits Dec 26, 2018

Remove the `λ` function because it duplicated the `lambda` function
Having two ways to do one thing is confusing. It's better to remove choice to make everything more straightforward.

@mnapoli mnapoli added this to the 0.3 milestone Dec 26, 2018

staabm and others added some commits Dec 26, 2018

Apply suggestions from code review
Co-Authored-By: mnapoli <matthieu@mnapoli.fr>
Merge pull request #124 from mnapoli/0.3-remove-duplicated-function
Remove the `λ` function because it duplicated the `lambda` function
Remove the `λ` function because it duplicated the `lambda` function
Having two ways to do one thing is confusing. It's better to remove choice to make everything more straightforward.
Apply suggestions from code review
Co-Authored-By: mnapoli <matthieu@mnapoli.fr>
Merge pull request #122 from mnapoli/0.3-runtime-console
Add console runtime for Symfony Console and Laravel Artisan
Merge branch '0.3' into sam
# Conflicts:
#	bref

mnapoli and others added some commits Jan 12, 2019

Merge pull request #157 from bertrandjamin/patch-2
Fix url to install AWS SAM CLI
clear the docs
running `aws configure` ist the quick configuration according to the offical aws cli docs
Merge pull request #165 from swiffer/0.3
clarify the install docs
Merge pull request #153 from mnapoli/0.3-disable-cgi
Disable compiling php-cgi
Merge pull request #155 from mnapoli/0.3-merge-runtimes
Start merging the experimental build pipeline and the existing runtimes
Show the latest versions of the runtimes
This is done by including the https://runtimes.bref.sh/ website
Merge pull request #170 from ludofleury/fix-typo
Fix typo in Symfony doc
Merge pull request #168 from mnapoli/0.3-show-runtime-versions
Website: show the latest versions of the runtimes
Make sure that the status code header is not returned in the response
This breaks the cloudfront integration because API Gateway returns 2 `status` headers (the one added by the PHP script and the one added by API Gateway automatically).

Fixes #176
Merge pull request #177 from mnapoli/0.3-fix-status-code
Make sure that the status code header is not returned in the response
Automatically set the Content-Length header on POST requests
When a POST request is made without a Content-Length header the content of the request body is dropped by PHP-FPM.

This auto-adds the header when it's not set in POST requests.

Fixes #162
Merge pull request #179 from nealio82/update-symfony-development-docs
remove 0.2-specific Symfony documentation & update for 0.3/SAM local
Merge pull request #178 from mnapoli/fix-162
Automatically set the Content-Length header on POST requests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment