Update the files to use version 5.0.2 of the tidways_xhprof php extension, with php in its version 7.4 and xhgui in its version 0.16.3.

master
Baptiste Bouchereau 2020-11-13 11:26:44 +01:00
rodzic 45687e1dfa
commit 06d90aa0ae
7 zmienionych plików z 39 dodań i 36 usunięć

Wyświetl plik

@ -1,7 +1,9 @@
FROM nginx:1.12.2
FROM nginx:1.18.0
RUN apt-get update
RUN apt-get install -y git
RUN git clone https://github.com/perftools/xhgui.git /var/xhgui
RUN chmod -R 0777 /var/xhgui/cache
RUN git clone https://github.com/perftools/xhgui.git /var/www/xhgui
RUN chmod -R 0777 /var/www/xhgui/cache
COPY xhgui.conf /etc/nginx/conf.d/default.conf

Wyświetl plik

@ -1,26 +1,30 @@
FROM php:7.1-fpm-alpine
FROM php:7.4-fpm-alpine
# php configuration
COPY php.ini /usr/local/etc/php/
# install the xhprof extension to profile requests
RUN curl "https://github.com/tideways/php-xhprof-extension/archive/v4.1.7.tar.gz" -fsL -o ./php-xhprof-extension.tar.gz && \
RUN curl "https://github.com/tideways/php-xhprof-extension/archive/v5.0.2.tar.gz" -fsL -o ./php-xhprof-extension.tar.gz && \
tar xf ./php-xhprof-extension.tar.gz && \
cd php-xhprof-extension-4.1.7 && \
cd php-xhprof-extension-5.0.2 && \
apk add --update --no-cache build-base autoconf && \
phpize && \
./configure && \
make && \
make install
RUN rm -rf ./php-xhprof-extension.tar.gz ./php-xhprof-extension-4.1.7
RUN docker-php-ext-enable tideways
RUN rm -rf ./php-xhprof-extension.tar.gz ./php-xhprof-extension-5.0.2
RUN docker-php-ext-enable tideways_xhprof
# install mongodb extension. The xhgui-collector will send xprof data to mongo
RUN apk add --no-cache autoconf alpine-sdk
RUN pecl install mongodb && docker-php-ext-enable mongodb
# install xhgui
# we just need the perftools/xhgui-collector but the installation is much easier this way
RUN git clone https://github.com/perftools/xhgui.git /var/xhgui
RUN cd /var/xhgui && php install.php
COPY xhgui_config.php /var/xhgui/config/config.php
# install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# install the package that will collect data
WORKDIR /var/xhgui
RUN composer require perftools/php-profiler perftools/xhgui-collector alcaeus/mongo-php-adapter
# copy the configuration file
COPY xhgui_config.php /var/xhgui/config/config.php

Wyświetl plik

@ -1,11 +1,3 @@
FROM php:7.1-fpm-alpine
FROM xhgui/xhgui:0.16.3
RUN apk add --no-cache git
RUN apk add --no-cache autoconf alpine-sdk zlib-dev
RUN pecl install mongodb && docker-php-ext-enable mongodb
RUN docker-php-ext-install zip # useful for composer
RUN git clone https://github.com/perftools/xhgui.git /var/xhgui
RUN cd /var/*xhgui && php install.php
COPY xhgui_config.php /var/xhgui/config/config.php
COPY xhgui_config.php /var/www/xhgui/config/config.php

Wyświetl plik

@ -10,7 +10,7 @@ services:
- ./:/var/www/html
nginx_app:
image: nginx:1.17.0-alpine
image: nginx:1.18.0-alpine
ports:
- 8080:80
volumes:
@ -30,10 +30,8 @@ services:
dockerfile: Dockerfile-nginx-xhgui
ports:
- 8081:80
volumes:
- ./xhgui.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- php_xhgui
mongo:
image: mongo:3.7.9
image: mongo:4.4.1

Wyświetl plik

@ -2,8 +2,10 @@
<ul>
<?php
define('XHGUI_CONFIG_DIR', '/var/xhgui/config/');
require_once '/var/xhgui/vendor/perftools/xhgui-collector/external/header.php';
require '/var/xhgui/vendor/autoload.php';
$config = include '/var/xhgui/config/config.php';
$profiler = new \Xhgui\Profiler\Profiler($config);
$profiler->start();
for ($i = 0; $i < 10; $i++) {
echo sprintf("<li>%s * 5 = %s</li>", $i, $i*5);

Wyświetl plik

@ -1,7 +1,10 @@
# see https://github.com/perftools/xhgui#configuration
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/xhgui/webroot/;
root /var/www/xhgui/webroot;
index index.php;
location / {
@ -10,9 +13,11 @@ server {
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
include /etc/nginx/fastcgi_params;
fastcgi_pass php_xhgui:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
client_body_buffer_size 1M;
}
}
}

Wyświetl plik

@ -1,16 +1,16 @@
<?php
return array(
return [
'save.handler' => 'mongodb',
'db.host' => 'mongodb://mongo:27017',
'db.db' => 'xhprof',
'db.options' => array(),
'db.options' => [],
'profiler.enable' => function() {
return true;
},
'profiler.simple_url' => null,
'profiler.options' => array(),
'profiler.options' => [],
'date.format' => 'M jS H:i:s',
'detail.count' => 6,
'page.limit' => 25,
);
];