Docker Image for xhgui
, a GUI for XHProf, by FEROX
This image packages xhgui
with MongoDB and NGINX so you can just focus on using it instead of how to install it!
- Docker Hub: https://hub.docker.com/r/frxyt/xhgui-dev
- GitHub: https://github.com/frxyt/docker-xhgui-dev
frxyt/xhgui-dev
- See documentation of
xhgui
andxhgui-collector
. - Add
frxyt/xhgui-dev
to yourdocker-compose.yml
file:xhgui: image: frxyt/xhgui-dev ports: - 127.0.0.1:80:80
- Make sure your
php
andxhgui
containers are on the samedocker-compose.yml
file - Make sure you have
Tideways XHProf Extension
enabled on yourphp
container - Make sure your
php
andxhgui
containers are on the same networknetworks: private: services: php: networks: - private xhgui: networks: - private
- Share a volume with PHP vendor path from
xhgui
tophp
:volumes: xhgui-vendor: services: php: volumes: - xhgui-vendor:/xhgui/vendor:ro xhgui: volumes: - xhgui-vendor:/xhgui/vendor:rw
- Start profiling on the first script called by your webserver, typically
index.php
:if ($_SERVER['XHGUI_PROFILING'] && \file_exists('/xhgui/vendor/perftools/xhgui-collector/external/header.php')) { require_once('/xhgui/vendor/perftools/xhgui-collector/external/header.php'); }
- Configure and enable the profiling
php: environment: - XHGUI_PROFILING=1 - XHGUI_SAVE_HANDLER=upload
You can see a full example here: tests/docker-compose.yml
, tests/index.php
.
git checkout https://github.com/frxyt/docker-xhgui-dev
cd docker-xhgui-dev/tests
docker-compose up
- Browse:
- The example app: http://localhost
- XhGui : http://xhgui.localhost
This image embed a custom configuration file for xhgui-collector
if you mount its volume to your php container and incude /xhgui/vendor/perftools/xhgui-collector/external/header.php
in your code. You can take advantage of this by setting environment variables on your php container:
XHGUI_PROFILING
: This variable is not set by default, set it to any value to enable the profiling.XHGUI_SAVE_HANDLER
: This variable can be set tofile
,mongodb
orupload
. Default and fallback ismongodb
to respect the original behavior of the library.- With
file
, you must setXHGUI_SAVE_HANDLER_FILENAME
to choose where the files will be saved inside your php container. - With
upload
:- You can set
XHGUI_SAVE_HANDLER_UPLOAD_URI
to change the full uri ofxhgui
import api, defaults to:http://xhgui/run/import
. - You can set
XHGUI_SAVE_HANDLER_UPLOAD_HOST
to change the host ofxhgui
, defaults to:xhgui
. - You can set
XHGUI_SAVE_HANDLER_UPLOAD_TIMEOUT
to change the timeout of uploads toxhgui
in seconds, defaults to:3
seconds.
- You can set
- With
mongodb
:- You can set
XHGUI_MONGO_URI
to change the host ofxhgui
MongoDB database, defaults to:xhgui:27017
. - You can set
XHGUI_MONGO_DB
to change the name of the database used byxhgui
, defaults to:xhprof
.
- You can set
- With
docker build -f Dockerfile -t frxyt/xhgui-dev:latest .
This project and images are published under the MIT License.
MIT License
Copyright (c) 2019 FEROX YT EIRL, www.ferox.yt <devops@ferox.yt>
Copyright (c) 2019 Jérémy WALTHER <jeremy.walther@golflima.net>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.