Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/edyan/docker-xhgui

An xhgui (with nginx, mongodb and php) container for profiling PHP Applications.
https://github.com/edyan/docker-xhgui

docker-image php profiler xhgui

Last synced: 8 days ago
JSON representation

An xhgui (with nginx, mongodb and php) container for profiling PHP Applications.

Awesome Lists containing this project

README

        

# Xhgui docker image
[![Build Status](https://travis-ci.com/edyan/docker-xhgui.svg?branch=master)](https://travis-ci.com/edyan/docker-xhgui)
[![Docker Pulls](https://img.shields.io/docker/pulls/edyan/xhgui.svg)](https://hub.docker.com/r/edyan/xhgui/)

Docker Hub: https://hub.docker.com/r/edyan/xhgui

Docker containers that runs [xhgui](https://github.com/perftools/xhgui) (which needs mongodb and PHP).

It's based on :
* [edyan/php:5.6](https://github.com/edyan/docker-php/tree/master/5.6) image (jessie stable).
* or [edyan/php:7.2](https://github.com/edyan/docker-php/tree/master/7.2) image (Ubuntu 18.04).
* or [edyan/php:7.4](https://github.com/edyan/docker-php/tree/master/7.4) image (Ubuntu 20.04).
Use that one as a preview version, xhgui is not officially compatible with PHP > 7.3

It's made for development purposes. You need to find the right version for your project.
Use 5.6 for PHP 5.6 projects and 7.2 / 7.4 for PHP 7.x projects. Just make sure you have the
`mongodb` extension enabled on your main PHP container.

To use it in an integrated environment, try [Stakkr](https://github.com/stakkr-org/stakkr)

## Example

To make it work, you need to link it to an existing PHP environment. Example via `docker-compose.yml` :

The Docker Compose configuration is different for Compose versions 2 and 3:

```yaml
version: '2'
services:
xhgui:
image: edyan/xhgui:php7.2
# I need to access xhgui
ports:
- "9000:80"
php:
hostname: php
command: /usr/bin/php -S 0.0.0.0:80 -t /var/www
image: edyan/php:7.2 # That image contains mongodb extension from PECL
# To have xhgui sources mount xhgui's volumes
volumes_from: [xhgui]
ports:
- "8000:80"
volumes:
- "./src:/var/www"
```

The `volumes_from` is no longer supported in the Docker Compose version 3 syntax. We have to define a volume for *xhgui* in the global section of the config file and reference it in each of the services:

```yaml
version: '3'

volumes:
xhgui:

services:
xhgui:
image: edyan/xhgui:php7.2
# I need to access xhgui
ports:
- "9000:80"
volumes:
- xhgui:/usr/local/src
php:
hostname: php
command: /usr/bin/php -S 0.0.0.0:80 -t /var/www
image: edyan/php:7.2 # That image contains mongodb extension from PECL
# To have the new mounted volumes as well as the default volumes of xhgui (its source code)
ports:
- "8000:80"
volumes:
- ./src:/var/www
- xhgui:/usr/local/src
```

You need to set an environment variable to define the right mongodb server
and then include the prepared profiler to your file, for example `src/index.php`:
```php
src/index.php
$ docker-compose -f docker-compose.sample.yml up --force-recreate -d
```

Now open http://localhost:8000/index.php to read the new file created.
Then http://localhost:9000 to see the report.

Clean :
```bash
$ docker-compose -f docker-compose.sample.yml down
```