From 06d90aa0ae4c121a272e0a5170182926363e1f6b Mon Sep 17 00:00:00 2001 From: Baptiste Bouchereau Date: Fri, 13 Nov 2020 11:26:44 +0100 Subject: [PATCH] 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. --- docker-xhprof-xhgui/Dockerfile-nginx-xhgui | 8 +++++--- docker-xhprof-xhgui/Dockerfile-php-app | 24 +++++++++++++--------- docker-xhprof-xhgui/Dockerfile-php-xhgui | 12 ++--------- docker-xhprof-xhgui/docker-compose.yml | 6 ++---- docker-xhprof-xhgui/index.php | 6 ++++-- docker-xhprof-xhgui/xhgui.conf | 11 +++++++--- docker-xhprof-xhgui/xhgui_config.php | 8 ++++---- 7 files changed, 39 insertions(+), 36 deletions(-) diff --git a/docker-xhprof-xhgui/Dockerfile-nginx-xhgui b/docker-xhprof-xhgui/Dockerfile-nginx-xhgui index 2eba683..b12f1a1 100644 --- a/docker-xhprof-xhgui/Dockerfile-nginx-xhgui +++ b/docker-xhprof-xhgui/Dockerfile-nginx-xhgui @@ -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 diff --git a/docker-xhprof-xhgui/Dockerfile-php-app b/docker-xhprof-xhgui/Dockerfile-php-app index a29a171..f8597f7 100644 --- a/docker-xhprof-xhgui/Dockerfile-php-app +++ b/docker-xhprof-xhgui/Dockerfile-php-app @@ -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 \ No newline at end of file +# 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 diff --git a/docker-xhprof-xhgui/Dockerfile-php-xhgui b/docker-xhprof-xhgui/Dockerfile-php-xhgui index 372197a..450c962 100644 --- a/docker-xhprof-xhgui/Dockerfile-php-xhgui +++ b/docker-xhprof-xhgui/Dockerfile-php-xhgui @@ -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 diff --git a/docker-xhprof-xhgui/docker-compose.yml b/docker-xhprof-xhgui/docker-compose.yml index 0c7b500..b747f27 100644 --- a/docker-xhprof-xhgui/docker-compose.yml +++ b/docker-xhprof-xhgui/docker-compose.yml @@ -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 diff --git a/docker-xhprof-xhgui/index.php b/docker-xhprof-xhgui/index.php index a2a04d4..759ffcb 100644 --- a/docker-xhprof-xhgui/index.php +++ b/docker-xhprof-xhgui/index.php @@ -2,8 +2,10 @@