Skip to content

Docker images for easy php development, using php-fpm with Blackfire.

License

Notifications You must be signed in to change notification settings

yappabe/docker-blackfire-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker pulls

Yappa PHP FPM Docker Image with Blackfire

Usage

Add the following to your docker-compose.yml file:

php:
    image: yappabe/blackfire-php
    volumes_from:
        - app
    links:
        - mysql
    environment:
        BLACKFIRE_SERVER_TOKEN: ${BLACKFIRE_SERVER_TOKEN}
        BLACKFIRE_CLIENT_TOKEN: ${BLACKFIRE_CLIENT_TOKEN}
        BLACKFIRE_SERVER_ID: ${BLACKFIRE_SERVER_ID}
        BLACKFIRE_CLIENT_ID: ${BLACKFIRE_CLIENT_ID}

PHP version

To use a specific PHP version, append the version number to the image name.

Eg: image: yappabe/blackfire-php:7.0

The following PHP versions are available:

  • PHP 7.0, 7.1, 7.2, 7.3 (jessie stable)

Configurations

Following environment vars are required to correctly run Blackfire:

ENV BLACKFIRE_SERVER_ID
ENV BLACKFIRE_SERVER_TOKEN
ENV BLACKFIRE_CLIENT_ID
ENV BLACKFIRE_CLIENT_TOKEN

You can find the values for these vars at your blackfire account page.

The following environment vars are not required, these are the defaults.

ENV BLACKFIRE_LOG_LEVEL 1
ENV BLACKFIRE_LOG_FILE /tmpfs/logs/blackfire.log
ENV BLACKFIRE_SOCKET unix:///var/run/blackfire/agent.sock

Blackfire

Both the agent and the probe are installed. This way it's possible to profile requests and cli commands. Using the Blackfire official image did not suffice as we need the agent to be present on the php container to be able to profile cli commands.

Profiling requests

Follow the instructions for the Chrome Companion, if the environment vars are correctly set, this should be all that needs to be done.

Profiling cli commands

Since the agent is present on this container, profiling cli commands is nothing more than running the command through the agent. This is done like this: blackfire run <command>. If all goes well, a url will be provided where the generated profile can be found.

About

Docker images for easy php development, using php-fpm with Blackfire.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published