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
xhguiandxhgui-collector. - Add
frxyt/xhgui-devto yourdocker-compose.ymlfile:xhgui: image: frxyt/xhgui-dev ports: - 127.0.0.1:80:80
- Make sure your
phpandxhguicontainers are on the samedocker-compose.ymlfile - Make sure you have
Tideways XHProf Extensionenabled on yourphpcontainer - Make sure your
phpandxhguicontainers are on the same networknetworks: private: services: php: networks: - private xhgui: networks: - private
- Share a volume with PHP vendor path from
xhguitophp: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-devcd docker-xhgui-dev/testsdocker-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,mongodborupload. Default and fallback ismongodbto respect the original behavior of the library.- With
file, you must setXHGUI_SAVE_HANDLER_FILENAMEto choose where the files will be saved inside your php container. - With
upload:- You can set
XHGUI_SAVE_HANDLER_UPLOAD_URIto change the full uri ofxhguiimport api, defaults to:http://xhgui/run/import. - You can set
XHGUI_SAVE_HANDLER_UPLOAD_HOSTto change the host ofxhgui, defaults to:xhgui. - You can set
XHGUI_SAVE_HANDLER_UPLOAD_TIMEOUTto change the timeout of uploads toxhguiin seconds, defaults to:3seconds.
- You can set
- With
mongodb:- You can set
XHGUI_MONGO_URIto change the host ofxhguiMongoDB database, defaults to:xhgui:27017. - You can set
XHGUI_MONGO_DBto 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.