wodby / drupal-php

PHP docker container image for Drupal
https://wodby.com/stacks/drupal
MIT License
60 stars 81 forks source link

Xhprof extension support #49

Closed divined closed 6 years ago

divined commented 6 years ago

Can you add support to your build?

https://hub.docker.com/r/divined/drupal-php/

docker pull divined/drupal-php:5.6 - not tested docker pull divined/drupal-php:71 - tested

csandanov commented 6 years ago

AFAIK, PECL extension is no longer maintained https://github.com/phacility/xhprof/issues/85#issuecomment-196489773. Latest release dated 2013. Also it does not officially support php7

khiminrm-lemberg commented 6 years ago

Hi! I was looking for Xhprof extension support too. It would be great to have it in docker4drupal! We can use tideways from https://tideways.io instead of old xhprof.

I was able to build image from wodby/drupal-php:7.1-dev-4.4.1 and use it in docker-compose.yml on local environment.

My Dockerfile for tideways v4.1.6:

FROM wodby/drupal-php:7.1-dev-4.4.1
RUN curl "https://github.com/tideways/php-xhprof-extension/archive/v4.1.6.tar.gz" -fsL -o ./a.tar.gz  && \
     tar xf ./a.tar.gz && \
     ls -la && cd ./php-xhprof-extension-4.1.6 && \
     ls -la && \
     sudo apk add --update --no-cache build-base autoconf && \
     sudo phpize && \
     sudo ./configure && \
     sudo make && \
     sudo make install && \
     cd .. && sudo rm -rf ./a.tar.gz ./php-xhprof-extension-4.1.6 && \
     sudo docker-php-ext-enable tideways

My Dockerfile for tideways v5.0-beta2:

FROM wodby/drupal-php:7.1-dev-4.4.1

RUN curl "https://github.com/tideways/php-xhprof-extension/archive/v5.0-beta2.tar.gz" -fsL -o ./a.tar.gz && \ tar xf ./a.tar.gz && \ ls -la && cd ./php-xhprof-extension-5.0-beta2 && \ ls -la && \ sudo apk add --update --no-cache build-base autoconf && \ sudo phpize && \ sudo ./configure && \ sudo make && \ sudo make install && \ cd .. && sudo rm -rf ./a.tar.gz ./php-xhprof-extension-5.0-beta2 && \ sudo docker-php-ext-enable tideways_xhprof

After building image with command docker build -t mytideways:v1 . I used name of built image instead of 'wodby/drupal-php:7.1-dev-4.4.1' in docker-compose.yaml for php container:

  php:
    image: mytideways:v1

I've also add tmp folder to volumes

    volumes:
      - ./:/var/www/html
      - /tmp:/tmp

and used wpalmer/xhprof for xhprof container:

  xhprof:
    image: wpalmer/xhprof
    container_name: "${PROJECT_NAME}_xhprof"
    volumes:
      - /tmp:/tmp
    labels:
      - 'traefik.backend=xhprof'
      - 'traefik.port=80'
      - 'traefik.frontend.rule=Host:xhprof.${PROJECT_BASE_URL}'

I used xhprof module with Drupal 8 and could investigate profiling results on page by url http://xhprof.drupal.docker.localhost:8000/

csandanov commented 6 years ago

Tideways xhprof extension has been added in -4.5.1, disabled by default, to enable add env var PHP_XHPROF=1