Skip to content

Commit

Permalink
Publish runtimes for PHP 7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
mnapoli committed Dec 18, 2019
1 parent c713a0b commit be2d60d
Show file tree
Hide file tree
Showing 9 changed files with 140 additions and 96 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ docker-images:
docker push bref/php-73:latest
docker push bref/php-73-fpm:latest
docker push bref/php-73-fpm-dev:latest
docker push bref/php-74:latest
docker push bref/php-74-fpm:latest
docker push bref/php-74-fpm-dev:latest
docker push bref/build-php-72:latest
docker push bref/build-php-73:latest
docker push bref/build-php-74:latest
docker push bref/fpm-dev-gateway:latest

# Generate and deploy the production version of the website using http://couscous.io
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.5"

services:
console:
image: bref/php-73
image: bref/php-74
volumes:
- .:/var/task:ro # Read only, like a lambda function
entrypoint: php
Expand All @@ -19,6 +19,6 @@ services:
environment:
HANDLER: demo/http.php
php:
image: bref/php-73-fpm-dev
image: bref/php-74-fpm-dev
volumes:
- .:/var/task:ro # Read only, like a lambda function
14 changes: 8 additions & 6 deletions docs/runtimes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ This page is an introduction to the runtimes. The next sections (e.g. PHP functi

## Bref runtimes

### PHP functions: `php-73` and `php-72`
### PHP functions: `php-74` and `php-73`

The simplest way to write a lambda is to write one in the form of a PHP function.

This runtime works great for **non-HTTP applications**.

[Read more about the `php-73` runtime here](/docs/runtimes/function.md).
[Read more about the `php-74` runtime here](/docs/runtimes/function.md).

### HTTP applications: `php-73-fpm` and `php-72-fpm`
### HTTP applications: `php-74-fpm` and `php-73-fpm`

This runtime uses PHP-FPM to run **HTTP applications** on AWS Lambda.

This runtime is **the easiest to start with**: it works like traditional PHP hosting and is compatible with Symfony and Laravel.

[Read more about the `php-73-fpm` runtime here](/docs/runtimes/http.md).
[Read more about the `php-74-fpm` runtime here](/docs/runtimes/http.md).

### Console: `console`

Expand Down Expand Up @@ -62,15 +62,17 @@ functions:
The `${...}` notation is the [syntax to use variables](https://serverless.com/framework/docs/providers/aws/guide/variables/) in `serverless.yml`. Bref provides a serverless plugin ("`./vendor/bref/bref`") that provides those variables:

- `${bref:layer.php-74}`
- `${bref:layer.php-73}`
- `${bref:layer.php-72}`
- `${bref:layer.php-74-fpm}`
- `${bref:layer.php-73-fpm}`
- `${bref:layer.php-72-fpm}`
- `${bref:layer.console}`

Bref currently provides runtimes for PHP 7.2 and 7.3.
Bref currently provides runtimes for PHP 7.2, 7.3 and 7.4.

> `php-73` means PHP 7.3.\*. It is not possible to require a specific "patch" version.
> `php-74` means PHP 7.4.\*. It is not possible to require a specific "patch" version.

You can read more about this in the next sections.

Expand Down
196 changes: 116 additions & 80 deletions layers.json
Original file line number Diff line number Diff line change
@@ -1,92 +1,128 @@
{
"php-74": {
"ca-central-1": 1,
"eu-central-1": 1,
"eu-north-1": 1,
"eu-west-1": 1,
"eu-west-2": 1,
"eu-west-3": 1,
"sa-east-1": 1,
"us-east-1": 1,
"us-east-2": 1,
"us-west-1": 1,
"us-west-2": 1,
"ap-south-1": 1,
"ap-northeast-1": 1,
"ap-northeast-2": 1,
"ap-southeast-1": 1,
"ap-southeast-2": 1
},
"php-74-fpm": {
"ca-central-1": 1,
"eu-central-1": 1,
"eu-north-1": 1,
"eu-west-1": 1,
"eu-west-2": 1,
"eu-west-3": 1,
"sa-east-1": 1,
"us-east-1": 1,
"us-east-2": 1,
"us-west-1": 1,
"us-west-2": 1,
"ap-south-1": 1,
"ap-northeast-1": 1,
"ap-northeast-2": 1,
"ap-southeast-1": 1,
"ap-southeast-2": 1
},
"php-73": {
"ca-central-1": 14,
"eu-central-1": 14,
"eu-north-1": 13,
"eu-west-1": 14,
"eu-west-2": 14,
"eu-west-3": 14,
"sa-east-1": 14,
"us-east-1": 14,
"us-east-2": 14,
"us-west-1": 14,
"us-west-2": 14,
"ap-south-1": 14,
"ap-northeast-1": 14,
"ap-northeast-2": 14,
"ap-southeast-1": 14,
"ap-southeast-2": 14
"ca-central-1": 15,
"eu-central-1": 15,
"eu-north-1": 14,
"eu-west-1": 15,
"eu-west-2": 15,
"eu-west-3": 15,
"sa-east-1": 15,
"us-east-1": 15,
"us-east-2": 15,
"us-west-1": 16,
"us-west-2": 15,
"ap-south-1": 15,
"ap-northeast-1": 15,
"ap-northeast-2": 15,
"ap-southeast-1": 15,
"ap-southeast-2": 15
},
"php-73-fpm": {
"ca-central-1": 14,
"eu-central-1": 14,
"eu-north-1": 13,
"eu-west-1": 14,
"eu-west-2": 14,
"eu-west-3": 14,
"sa-east-1": 14,
"us-east-1": 14,
"us-east-2": 14,
"us-west-1": 14,
"us-west-2": 14,
"ap-south-1": 14,
"ap-northeast-1": 14,
"ap-northeast-2": 14,
"ap-southeast-1": 14,
"ap-southeast-2": 14
"ca-central-1": 15,
"eu-central-1": 15,
"eu-north-1": 14,
"eu-west-1": 15,
"eu-west-2": 15,
"eu-west-3": 15,
"sa-east-1": 15,
"us-east-1": 15,
"us-east-2": 15,
"us-west-1": 15,
"us-west-2": 15,
"ap-south-1": 15,
"ap-northeast-1": 15,
"ap-northeast-2": 15,
"ap-southeast-1": 15,
"ap-southeast-2": 15
},
"php-72": {
"ca-central-1": 14,
"eu-central-1": 14,
"eu-north-1": 13,
"eu-west-1": 14,
"eu-west-2": 14,
"eu-west-3": 14,
"sa-east-1": 14,
"us-east-1": 14,
"us-east-2": 14,
"us-west-1": 14,
"us-west-2": 14,
"ap-south-1": 14,
"ap-northeast-1": 14,
"ap-northeast-2": 14,
"ap-southeast-1": 14,
"ap-southeast-2": 14
"ca-central-1": 15,
"eu-central-1": 15,
"eu-north-1": 14,
"eu-west-1": 15,
"eu-west-2": 15,
"eu-west-3": 15,
"sa-east-1": 15,
"us-east-1": 15,
"us-east-2": 15,
"us-west-1": 15,
"us-west-2": 15,
"ap-south-1": 15,
"ap-northeast-1": 15,
"ap-northeast-2": 15,
"ap-southeast-1": 15,
"ap-southeast-2": 15
},
"php-72-fpm": {
"ca-central-1": 14,
"eu-central-1": 14,
"eu-north-1": 13,
"eu-west-1": 14,
"eu-west-2": 14,
"eu-west-3": 14,
"sa-east-1": 14,
"us-east-1": 14,
"us-east-2": 14,
"us-west-1": 14,
"us-west-2": 14,
"ap-south-1": 14,
"ap-northeast-1": 14,
"ap-northeast-2": 14,
"ap-southeast-1": 14,
"ap-southeast-2": 14
"ca-central-1": 15,
"eu-central-1": 15,
"eu-north-1": 14,
"eu-west-1": 15,
"eu-west-2": 15,
"eu-west-3": 15,
"sa-east-1": 15,
"us-east-1": 15,
"us-east-2": 15,
"us-west-1": 15,
"us-west-2": 15,
"ap-south-1": 15,
"ap-northeast-1": 15,
"ap-northeast-2": 15,
"ap-southeast-1": 15,
"ap-southeast-2": 15
},
"console": {
"ca-central-1": 14,
"eu-central-1": 14,
"eu-north-1": 13,
"eu-west-1": 14,
"eu-west-2": 14,
"eu-west-3": 14,
"sa-east-1": 14,
"us-east-1": 14,
"us-east-2": 14,
"us-west-1": 14,
"us-west-2": 14,
"ap-south-1": 14,
"ap-northeast-1": 14,
"ap-northeast-2": 14,
"ap-southeast-1": 14,
"ap-southeast-2": 14
"ca-central-1": 15,
"eu-central-1": 15,
"eu-north-1": 14,
"eu-west-1": 15,
"eu-west-2": 15,
"eu-west-3": 15,
"sa-east-1": 15,
"us-east-1": 15,
"us-east-2": 15,
"us-west-1": 15,
"us-west-2": 15,
"ap-south-1": 15,
"ap-northeast-1": 15,
"ap-northeast-2": 15,
"ap-southeast-1": 15,
"ap-southeast-2": 15
}
}
2 changes: 2 additions & 0 deletions runtime/layers/layer-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
require_once __DIR__ . '/../../vendor/autoload.php';

const LAYER_NAMES = [
'php-74',
'php-74-fpm',
'php-73',
'php-73-fpm',
'php-72',
Expand Down
6 changes: 3 additions & 3 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ functions:
handler: demo/function.php
description: 'Bref CLI demo'
layers:
- ${bref:layer.php-73}
- ${bref:layer.php-74}

http:
handler: demo/http.php
description: 'Bref HTTP demo'
timeout: 5 # in seconds (API Gateway has a timeout of 29 seconds)
memory: 1024
layers:
- ${bref:layer.php-73-fpm}
- ${bref:layer.php-74-fpm}
events:
- http: 'ANY /'
- http: 'ANY /{proxy+}'
Expand All @@ -41,5 +41,5 @@ functions:
handler: demo/console.php
description: 'Bref console command demo'
layers:
- ${bref:layer.php-73}
- ${bref:layer.php-74}
- ${bref:layer.console}
2 changes: 1 addition & 1 deletion tests/Sam/PhpFpmRuntimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public function test php config()
'error_log' => null,
// This is the default production value
'error_reporting' => (string) (E_ALL & ~E_DEPRECATED & ~E_STRICT),
'extension_dir' => '/opt/bref/lib/php/extensions/no-debug-zts-20180731',
'extension_dir' => '/opt/bref/lib/php/extensions/no-debug-zts-20190902',
// Same limit as API Gateway
'max_execution_time' => '30',
// Use the max amount of memory possibly available, lambda will limit us
Expand Down
2 changes: 1 addition & 1 deletion tests/Sam/PhpRuntimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public function test php config()
'error_log' => null,
// This is the default production value
'error_reporting' => (string) (E_ALL & ~E_DEPRECATED & ~E_STRICT),
'extension_dir' => '/opt/bref/lib/php/extensions/no-debug-zts-20180731',
'extension_dir' => '/opt/bref/lib/php/extensions/no-debug-zts-20190902',
// No need for HTML formatting on the CLI
'html_errors' => '0',
// Let lambda deal with the max execution time
Expand Down
6 changes: 3 additions & 3 deletions tests/Sam/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Resources:
Handler: tests/Sam/Php/function.php
Runtime: provided
Layers:
- 'arn:aws:lambda:us-east-1:209497400698:layer:php-73:13'
- 'arn:aws:lambda:us-east-1:209497400698:layer:php-74:1'
Environment:
Variables:
FOO: bar
Expand All @@ -23,7 +23,7 @@ Resources:
Handler: tests/Sam/PhpFpm/index.php
Runtime: provided
Layers:
- 'arn:aws:lambda:us-east-1:209497400698:layer:php-73-fpm:13'
- 'arn:aws:lambda:us-east-1:209497400698:layer:php-74-fpm:1'
Events:
HttpRoot:
Type: Api
Expand All @@ -42,7 +42,7 @@ Resources:
Handler: tests/Sam/PhpFpm/UNKNOWN.php
Runtime: provided
Layers:
- 'arn:aws:lambda:us-east-1:209497400698:layer:php-73-fpm:13'
- 'arn:aws:lambda:us-east-1:209497400698:layer:php-74-fpm:1'
Events:
HttpRoot:
Type: Api
Expand Down

0 comments on commit be2d60d

Please sign in to comment.