Releases: brefphp/bref
0.5.4
0.5.3
0.5.2
Quick summary:
- 🚢 Bref Docker images!
- 📈 Bref Dashboard!
- bug #394 fixed with #395 by @linuxjuggler: the
event
is not always an array
Docker images
Thanks to a huge contribution by @Guillaume-Rossignol, Bref now publishes Docker images on the Docker Hub: hub.docker.com/u/bref.
One use case for these images is local development. It is explained in details in the revamp "Local development for HTTP applications" guide, but here is an example using Docker Compose to run a HTTP app locally:
version: "3.5"
services:
web:
image: bref/fpm-dev-gateway
ports:
- '8000:80'
volumes:
- .:/var/task
depends_on:
- php
environment:
HANDLER: index.php
php:
image: bref/php-73-fpm-dev
volumes:
- .:/var/task:ro
After running docker-compose up
, the application is accessible at http://localhost:8000/
We think this is a good alternative to sam local
or serverless invoke local
because Docker is an environment which many developers are starting to use, and because of much better performances.
It is also easy with Docker Compose to setup a database, or run CLI commands with the same environment as the rest of the application.
Since we have changed a bit how layers are built, new layers are available. But if you are using Bref 0.5 you don't have anything extra to do, you will get them automatically when you update Bref :)
Bref Dashboard
After months of iterations, we are very happy to finally publish the Bref dashboard publicly.
The dashboard is an addition to Bref that provides a visual interface to manage your application. It is meant to complete and enhance the rest of Bref features.
Right now it provides:
- a view of all functions and APIs deployed in one application
- direct links to each components in the AWS dashboard
- graphs of the response time (duration) and number of invocations in the last 30 days
- average response time
- number of errors in the last 30 days
- a log viewer (I'm super happy with this!)
We have plenty of ideas to improve the dashboard over time.
The great thing with the dashboard is that it is not bundled in Bref (which keeps Bref lightweight). Instead it is a Docker image. To open the dashboard, simply run:
vendor/bin/bref dashboard
This command will automatically recognize the AWS stack name and region from serverless.yml
, pull the latest version of the dashboard and start it. The only requirement: Docker.
And the best thing is that the dashboard runs on your machine, with your own credentials.
You don't need to setup anything or give access to your AWS account to anyone. Anything your machine can access, the dashboard can show!
Log viewer
The log viewer helps you read and search your logs without having to go through the AWS console. We have tried to dim out the noise as much as possible to make the logs easy to read:
What does it mean for Bref?
The dashboard is close-source. The reason for that is that we are exploring the possibility of adding advanced and paid features to the dashboard in the future. The goal behind this is to find funding for the project. Note that the dashboard is a completely optional feature of Bref and it is not bundled in the open-source project.
Mixing open source with closed products and/or paid products is a delicate thing to do. I want to stress that we are being extremely careful with that. I have been thinking about this for more than a year, and I don't think I am done :)
My vision of a sane relationship between the open-source project and related products is:
- the open-source project must live and work on its own
- the open-source project must be usable and have its core features not impacted by other products
- other products (closed and/or paid) must live separately from the open-source project and not replace basic features that are already provided by the open-source project
In other words, Bref's mission is to help everybody create serverless PHP applications. Side projects or products can provide extra help around that (especially for power users or advanced scenarios), but do not strip away from Bref's mission. Basic features that are essential to create serverless applications must be open source.
As we move further with this I intend to make this a little bit clearer and more defined, but in the meantime I hope it helps.
If you have any questions or feedback, please share them in this Bref dashboard feedback issue. What you think is important. We try to make some decisions with the best intentions, but sometimes we get things wrong :)
0.5.1
The main feature of this new release: performance improvements!
New runtimes have been published: if you use Bref 0.5 with the Serverless plugin (default behavior) you don't have anything to do. If you include Lambda layers manually, check out runtimes.bref.sh for the new layer versions.
Improvements:
- #380, #378: PHP runtimes have been made lighter (by removing useless files) and faster (by optimizing PHP's compilation options): PHP's execution is 10% faster (for CPU-bound operations). You can check out updated benchmarks here: github.com/brefphp/benchmarks. By @TheNodi.
- #332, #373: Runtimes are now built against the new AmazonLinux version: 2018.03. AWS upgraded the version of Linux used in Lambda and we had to recompile PHP against it. By @TheNodi, @bubba-h57 and @mnapoli.
- #261, #377: the default timeout for console functions is now 30s (instead of 6s), by @Luitame
Documentation:
- #315, #376: the menu now reflects which page is currently open, by @Luitame.
- #312, #375: the list of case studies now contains a link to non-PHP case studies, by @Luitame.
Fixes:
- #379, #381:
bref cli
arguments are now correctly escaped and forwarded to the lambda, by @shadowhand.
0.5.0
This is a "major" version without BC break, but with major changes that affect the usage of Bref.
Logo
Bref now has a logo, thanks to Percola.top and null:
Switching to Serverless
AWS SAM is being replaced by Serverless as the tool to configure and deploy applications.
This is a major change because:
- Bref now recommends Serverless instead of SAM
- the documentation has been rewritten around Serverless
- tooling has been added around Serverless
SAM will continue to work with Bref, just like CloudFormation, Terraform, Now (#368), etc. Bref layers are independent of the tooling used. If you have created applications with SAM, you can keep using it. Most of the time however migrating template.yaml
to serverless.yml
is not too complex (migrating a production stack may be more effort).
Why?
Serverless offers a configuration format (serverless.yml
) that is much simpler and more concise (#320). Sometimes serverless.yml
is twice less YAML than template.yaml
for the same application. You can see an example of this with the configuration file for a simple HTTP application: https://gist.github.com/mnapoli/a9f690499160736a0a9f70e8492b1f5e
Another major simplification is that the stack name and the region are configured inside serverless.yml
. Deploying no longer take 3 steps and 10 lines of code, but only 2 words.
On top of that, Serverless offers a plugin system that lets us simplify a lot of things, especially around Bref (#351). For example, using Bref layers is now much simpler:
# Before
functions:
foo:
handler: index.php
layers:
- 'arn:aws:lambda:us-east-1:209497400698:layer:php-73:7'
# After
functions:
foo:
handler: index.php
layers:
- ${bref:layer.php-73}
Layer version numbers are now tied to a specific Bref version, and we no longer need to mess with the AWS region name. Upgrading layers is now as simple as upgrading Bref via Composer.
Additionally, serverless deploy
can deploy the same application in multiple stages.
Finally, Serverless offers a lot of plugins to create more advanced applications: https://serverless.com/plugins/
Want to benefit all of that? All the bref.sh documentation has been rewritten and expanded to help you use Serverless. Give it a try!
Creating websites with Bref
A new documentation article has been created to help you create serverless websites with Bref. You can read it here: Creating websites with Bref.
Several architectures are suggested, depending on what you need:
This is great news as the Maturity Matrix has a more ratings going to green!
Other changes
0.5.0-beta1
First beta release for v0.5. This is a "major" version without BC break, but with major changes that affect the usage of Bref.
This is a beta version, please test and report any problem. Note that the new documentation hasn't been published yet because this is not a stable release.
Switching from SAM to Serverless
AWS SAM is being replaced by Serverless as the tool to configure and deploy applications.
This is a major change because:
- Bref now recommends Serverless instead of SAM
- the documentation has been rewritten around Serverless
- tooling has been added around Serverless
SAM will continue to work with Bref, just like CloudFormation, Terraform, Now (#368), etc. Bref layers are independent of the tooling used. If you have created applications with SAM, you can keep using it. Most of the time however migrating template.yaml
to serverless.yml
is not too complex (migrating a production stack may be more effort).
Why?
Serverless offers a configuration format (serverless.yml
) that is much simpler and more concise (#320). Sometimes serverless.yml
is twice less YAML than template.yaml
for the same application.
Another major simplification is that the stack name and the region are configured inside serverless.yml
. Deploying no longer take 3 steps and 10 lines of code, but only 2 words:
# Before
aws s3 mb s3://<bucket-name>
sam package \
--output-template-file .stack.yaml \
--region eu-west-1 \
--s3-bucket <bucket-name>
sam deploy \
--template-file .stack.yaml \
--region eu-west-1 \
--capabilities CAPABILITY_IAM \
--stack-name <stack-name>
# After
serverless deploy
On top of that, Serverless offers a plugin system that lets us simplify a lot of things, especially around Bref (#351). For example, using Bref layers is now much simpler:
# Before
functions:
foo:
handler: index.php
layers:
- 'arn:aws:lambda:us-east-1:209497400698:layer:php-73:7'
# After
functions:
foo:
handler: index.php
layers:
- ${bref:layer.php-73}
Layer version numbers are now tied to a specific Bref version, and we no longer need to mess with the AWS region name. Upgrading layers is now as simple as upgrading Bref via Composer.
Additionally, serverless deploy
can deploy the same application in multiple stages.
Finally, Serverless offers a lot of plugins: https://serverless.com/plugins/
Other changes
0.4.1
Following the 0.4.0 release the runtimes need to be updated (see https://runtimes.bref.sh/ for the latest versions).
This release updates the version of the runtimes when using bref init
to start a project.
0.4.0
Bref has moved on GitHub and Packagist to its own organization:
- the project is now at https://github.com/brefphp/bref on GitHub
- the Composer package has been renamed from
mnapoli/bref
tobref/bref
To update to future releases you need to change your dependency in composer.json
to replace mnapoli/bref
with bref/bref
.
Other than that this 0.4.0 release contains no BC break.
Features
- #262, #263, #338: ALB is now supported as an alternative to API Gateway: this can be useful for applications with high traffic as ALB is cheaper than API Gateway at scale. (by @atrope)
- #269: Using a database is now documented at https://bref.sh/docs/environment/database.html (by @mnapoli)
- #334: Bref can now keep your HTTP lambdas warm using a scheduled event, this is documented here: https://bref.sh/docs/runtimes/http.html#cold-starts (by @thibaudlemaire)
- #335: The
bref deployment
command will now display the CloudFormation outputs. This makes it easier to retrieve the URL of the websites/APIs we deploy. (by @mnapoli)
Other changes
0.3.9
-
Fixed #316 (random FastCGI errors) with #319 by replacing the underlying library for FastCGI communication (we now use hollodotme/fast-cgi-client).
This brings a performance improvement as well (around 1ms shaved of HTTP responses, which is a 40% improvement).
-
#301 New PHP extension available:
sockets
(update to the latest runtimes) -
#311 The AWS Lambda context is now available in PHP as the second parameter for handlers, see https://bref.sh/docs/runtimes/function.html#context for the complete documentation. Example:
lambda(function (array $event, Context $context) { return /* response */; });
-
Fixed #323 Better handling of errors in
bref init
-
Fixed #275 with #321: avoid filling up
/tmp
with PHP-FPM core dumps -
#308 New
bref deployment
command to debug what went wrong with the last deploymentvendor/bin/bref deployment <stack-name>