Skip to content

Releases: brefphp/bref

0.5.4

23 Aug 07:58
a0fc2fa
Compare
Choose a tag to compare

This release contains 2 improvements for the bref dashboard command:

  • #406 and #424: a new --profile option to let bref dasboard use a specific AWS profile, by @j0k3r
  • #416: a new --host option to let bref dasboard serve requests on a specific host (instead of just localhost), by @geschke

0.5.3

09 Aug 11:46
6de2ceb
Compare
Choose a tag to compare

#400 Fix the auto-update of the dashboard (docker pull command)

0.5.2

09 Aug 10:26
Compare
Choose a tag to compare

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 :)

Read more here.

Bref Dashboard

After months of iterations, we are very happy to finally publish the Bref dashboard publicly.

Capture d’écran 2019-08-09 à 11 39 05

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:

Capture d’écran 2019-08-09 à 11 59 36

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

30 Jul 08:42
Compare
Choose a tag to compare

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:

Fixes:

  • #379, #381: bref cli arguments are now correctly escaped and forwarded to the lambda, by @shadowhand.

0.5.0

17 Jul 11:30
5f2d626
Compare
Choose a tag to compare

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:

bref-logo-source-01

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.

7-1

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!

Maturity Matrix

Other changes

0.5.0-beta1

10 Jul 12:06
Compare
Choose a tag to compare
0.5.0-beta1 Pre-release
Pre-release

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

  • #347 fixed in #349: the console layer now logs everything. Note that I haven't rebuilt the layers yet, I will probably do for the final 0.5.0 release.
  • #362 Fix non-clickable titles in the documentation
  • #360 Document using the bref/logger package
  • #364 New case study by MyBuilder

0.4.1

14 Jun 09:43
Compare
Choose a tag to compare

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

13 Jun 07:56
f17a750
Compare
Choose a tag to compare

Bref has moved on GitHub and Packagist to its own organization:

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

Other changes

  • #340: Classes that are meant to be used only internally to Bref are now clearly marked as @internal: these are not covered by backward compatibility. (by @mnapoli)

0.3.9

05 May 10:00
Compare
Choose a tag to compare
  • 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 deployment

    vendor/bin/bref deployment <stack-name>
    

0.3.8

08 Apr 11:16
4183429
Compare
Choose a tag to compare

#297 Fix some bugs with PUT and PATCH requests when the HTTP request did not contain a Content-Length header, by @TimoSchaefer (related to #162).