Skip to content

Commit e2b37ff

Browse files
authored
Added installation docs about Blackfire (#4)
* Added installation docs about Blackfire * Rebase fix
1 parent 25113f4 commit e2b37ff

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

Readme.md

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ a limit of 5 layers per Lambda.
66

77
We are happy to get contributions for other extensions. Sky is the limit! (And also your knowledge with Docker...)
88

9+
## Install and configure
10+
11+
```cli
12+
composer require bref/extra-php-extensions
13+
```
14+
915
```yaml
1016
# serverless.yml
1117
service: app
@@ -33,7 +39,7 @@ functions:
3339
extension=/opt/bref-extra/amqp.so
3440
```
3541

36-
## Available layers
42+
### Available layers
3743

3844
| Name | Serverless config (php 7.4) | php.ini config |
3945
| ---- | ----------------------------| -------------- |
@@ -46,7 +52,42 @@ extension=/opt/bref-extra/amqp.so
4652

4753
Note that the "Memcached" layer provides both extension for [Memcache](https://pecl.php.net/package/memcache) and [Memcached](https://pecl.php.net/package/memcached).
4854

49-
## Deploy new versions
55+
### Blackfire installation
56+
57+
The Blackfire layer only have probe installed. You still need to install the agent.
58+
The agent is installed on a separate server (not a lambda function). The very smallest
59+
EC2 instance is sufficient to runt the Blackfire agent.
60+
61+
Create a `blackfire.ini` file for your lambda function where you load the extension
62+
and modify the `agent_socket`.
63+
64+
```ini
65+
extension=/opt/bref-extra/blackfire.so
66+
67+
blackfire.agent_socket = tcp://ip-172-40-40-40.eu-central-1.compute.internal:8307
68+
blackfire.agent_timeout = 0.25
69+
```
70+
71+
Then modify your [agent config](https://blackfire.io/docs/reference-guide/configuration#agent-configuration)
72+
to make sure you are listening to `tcp://0.0.0.0:8307`.
73+
74+
## For contributors and maintainers
75+
76+
### Creating a new layer
77+
78+
The idea is to start from bref/build-php-XX, install all libraries and extensions
79+
you want, then move all related files to `/opt`. Those files will be available in
80+
the same same location on the Lambda.
81+
82+
Note that one can't just move files/libraries around. Most of them are expected to
83+
be in their "standard" location.
84+
85+
1. Create a new folder in `layers` and name it to your extension name.
86+
2. Add your Dockerfile
87+
3. Update .travis.yml to include your extension
88+
4. Update the table in the readme
89+
90+
### Deploy new versions
5091

5192
```
5293
make publish

0 commit comments

Comments
 (0)