Last active
June 19, 2024 03:06
-
-
Save bizmate/c2796ed960b9761ac55ce4b039c0200c to your computer and use it in GitHub Desktop.
Blackfire dockerisation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[blackfire] | |
; setting: log-file | |
; desc : Sets the path of the log file. Use stderr to log to stderr | |
; default: stderr | |
log-file=/tmp/blackfire-agent.log | |
; | |
; setting: log-level | |
; desc : log verbosity level (4: debug, 3: info, 2: warning, 1: error) | |
; default: 1 | |
log-level=4 | |
; | |
; setting: server-id | |
; desc : Sets the server id used to authenticate with Blackfire API | |
; default: | |
server-id=1aXXXXXXXXc16 | |
; | |
; setting: server-token | |
; desc : Sets the server token used to authenticate with Blackfire API. It is unsafe to set this from the command line | |
; default: | |
server-token=XXXXXXXX |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blackfire: | |
image: blackfire/blackfire | |
ports: | |
- 8707 | |
environment: | |
# Exposes the host BLACKFIRE_SERVER_ID and TOKEN environment variables. | |
- BLACKFIRE_SERVER_ID=1aXXX16 | |
- BLACKFIRE_SERVER_TOKEN=fcXXXc1 | |
# You can also use global environment credentials : | |
# BLACKFIRE_SERVER_ID: SERVER-ID | |
# BLACKFIRE_SERVER_TOKEN: SERVER-TOKEN | |
- BLACKFIRE_CLIENT_ID=a83XXX15e | |
- BLACKFIRE_CLIENT_TOKEN=ed6XXb18 | |
- BLACKFIRE_LOG_FILE=/tmp/blackfire-agent.log | |
- BLACKFIRE_LOG_LEVEL=4 | |
command: ["blackfire-agent", "--socket", "tcp://0.0.0.0:8707", "--config", "/root/blackfire-agent.cfg"] | |
volumes: | |
- ./docker/config/blackfire-agent.cfg:/root/blackfire-agent.cfg:ro |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PHP Container OS | |
root@b3298114fb83:/var/www/html# cat /etc/*-release | |
PRETTY_NAME="Debian GNU/Linux 8 (jessie)" | |
NAME="Debian GNU/Linux" | |
VERSION_ID="8" | |
VERSION="8 (jessie)" | |
ID=debian | |
HOME_URL="http://www.debian.org/" | |
SUPPORT_URL="http://www.debian.org/support" | |
BUG_REPORT_URL="https://bugs.debian.org/" | |
# PHP -v | |
php -v | |
PHP 7.0.7 (cli) (built: Jun 8 2016 18:31:28) ( NTS ) | |
Copyright (c) 1997-2016 The PHP Group | |
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies | |
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies | |
with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans | |
with blackfire v1.10.6, https://blackfire.io, by Blackfireio Inc. | |
# Blackfire startup errors | |
root@b3298114fb83:/var/www/html# php -d display_startup_errors=on --ri blackfire | |
blackfire | |
Blackfire => enabled | |
Blackfire => 1.10.6 | |
Timing measurement => cgt | |
Num of CPU => 1 | |
Profiling heap memory => 0 Kb | |
Main instance trigger mode => HTTP header triggered | |
Main instance => enabled | |
Main instance info | |
Output stream => file | |
Signature validated => no | |
EnvId validated => no | |
Fully decoded => no | |
Directive => Local Value => Master Value | |
blackfire.agent_socket => tcp://blackfire:8707 => tcp://blackfire:8707 | |
blackfire.agent_timeout => 0.25 => 0.25 | |
blackfire.env_id => no value => no value | |
blackfire.env_token => no value => no value | |
blackfire.log_level => 4 => 4 | |
blackfire.log_file => /tmp/blackfire.log => /tmp/blackfire.log | |
blackfire.server_id => 1aXXX16 => 1aXXX16 | |
blackfire.server_token => fcXXXc1 => fcXXXc1 | |
Blackfire developed by Blackfireio Inc. | |
# Blackfire agent version - This is from a container instance based on the blackfire/blackfire image in docker hub | |
docker exec -it project_blackfire_1 sh | |
/ # blackfire-agent -v | |
blackfire-agent 1.7.3 linux amd64 gc 2016-06-14T14:11:50+0000 | |
# Content of the probe file | |
Fri Jun 17 10:33:38 2016 (5): [Debug] Found signature : RWQUOK8zFv1ASlmJeF8r2hvnR5qvYYa9y4QkzhY5JTYb42Byj5pinAYGu2Z-xo7ZHSQCa3HT_mnHSWWFLxVc0QDpbbQAAGUCqgM= | |
Fri Jun 17 10:33:38 2016 (5): [Info] No key found in memory or key expired, continuing without validation | |
Fri Jun 17 10:33:38 2016 (5): [Info] agent id is not valid | |
# Content of the agent log file - i cannot enable it, the blackfire/blackfire container uses /dev/null as config, not sure how else | |
# i can pass the log file location and log level directives other than putting them in env variables to pass to the container ? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes 4; | |
http { | |
tcp_nopush on; | |
tcp_nodelay on; | |
keepalive_timeout 65; | |
types_hash_max_size 2048; | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
access_log /logs/nginx/access.log; | |
error_log /logs/nginx/error.log; | |
gzip on; | |
gzip_disable "msie6"; | |
server { | |
listen 80 default_server; | |
root /new; | |
location / { | |
proxy_pass http://localhost:8090; | |
proxy_redirect http://localhost:8090/ /; | |
proxy_set_header Host $host; | |
proxy_intercept_errors on; | |
error_page 404 = @old; | |
} | |
location @old { | |
proxy_pass http://localhost:8091; | |
proxy_redirect http://localhost:8090/ /; | |
proxy_set_header Host $host; | |
} | |
} | |
server { | |
listen 8090; | |
root /new/public; | |
index index.php index.html index.htm; | |
try_files $uri /$uri /index.php?$query_string; | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
root /new/public; | |
add_header thisisfrom v3assets$document_root$fastcgi_script_name; | |
} | |
location ~ ^/.+\.php(/|$) { | |
fastcgi_pass phpnew:9000; | |
fastcgi_split_path_info ^(.+\.php)(/.*)$; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param HTTPS off; | |
} | |
} | |
server { | |
listen 8091; | |
root /old/public; | |
index index.php index.html index.htm; | |
try_files $uri /$uri /index.php?$query_string; | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
root /old/public; | |
add_header thisisfrom v2assets$document_root$fastcgi_script_name; | |
} | |
location ~ ^/.+\.php(/|$) { | |
fastcgi_pass phpold:9000; | |
fastcgi_split_path_info ^(.+\.php)(/.*)$; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param HTTPS off; | |
} | |
} | |
} | |
events { | |
worker_connections 768; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@4d2c7fb14cef:/var/www/html# php -i | grep blackfire | |
with blackfire v1.10.6, https://blackfire.io, by Blackfireio Inc. | |
blackfire | |
blackfire.agent_socket => tcp://blackfire:8707 => tcp://blackfire:8707 | |
blackfire.agent_timeout => 0.25 => 0.25 | |
blackfire.env_id => no value => no value | |
blackfire.env_token => no value => no value | |
blackfire.log_file => /tmp/blackfire.log => /tmp/blackfire.log | |
blackfire.log_level => 4 => 4 | |
blackfire.server_id => XXX => XXX | |
blackfire.server_token => XXX => XXX |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment