+ profiler things
* fix custom node version install in workspace
This commit is contained in:
22
README.md
22
README.md
@ -47,6 +47,28 @@ For start debugging in php-fpm, also in workspace
|
||||
|
||||
`./stop-xdebug.sh` or `./stop-xdebug.sh 73` if you launch start with php-version 73
|
||||
|
||||
#### Xdebug with profiler
|
||||
|
||||
Profiler saved your profiles into `/tmp` directory in own container.
|
||||
|
||||
In docker-compose.base.yml exists volume that represent `/tmp` directory to `./data/profiler`.
|
||||
In this case `./data/profiler` must be have `777` chmod`s.
|
||||
|
||||
For starting xdebug with profiler enable you might:
|
||||
|
||||
`./start-xdebug.sh 74 1`
|
||||
|
||||
Or
|
||||
|
||||
`./start-xdebug.sh 74 profiler` if you like
|
||||
|
||||
Second argument must be have any string
|
||||
|
||||
For disable profiler - just simple launch
|
||||
|
||||
`./quit-xdebug.sh`
|
||||
|
||||
|
||||
### Mysql
|
||||
|
||||
For import dumps from `hostfiles` directory you might be enter to mysql console:
|
||||
|
@ -2,8 +2,9 @@
|
||||
DIR="$(realpath $(dirname "$(readlink -f "$0")")/..)"
|
||||
|
||||
PHP_VERSION=$1 # Without dot
|
||||
WITH_PROFILER=$2
|
||||
|
||||
if [[ -z "${PHP_VERSION}" ]]; then PHP_VERSION=74; fi
|
||||
|
||||
${DIR}/dockerfiles/php-fpm/xdebug.sh stop ${PHP_VERSION}
|
||||
${DIR}/dockerfiles/workspace/xdebug.sh stop ${PHP_VERSION}
|
||||
${DIR}/dockerfiles/php-fpm/xdebug.sh stop ${PHP_VERSION} ${WITH_PROFILER}
|
||||
${DIR}/dockerfiles/workspace/xdebug.sh stop ${PHP_VERSION} ${WITH_PROFILER}
|
@ -2,8 +2,9 @@
|
||||
DIR="$(realpath $(dirname "$(readlink -f "$0")")/..)"
|
||||
|
||||
PHP_VERSION=$1 # Without dot
|
||||
WITH_PROFILER=$2
|
||||
|
||||
if [[ -z "${PHP_VERSION}" ]]; then PHP_VERSION=74; fi
|
||||
|
||||
${DIR}/dockerfiles/php-fpm/xdebug.sh start ${PHP_VERSION}
|
||||
${DIR}/dockerfiles/workspace/xdebug.sh start ${PHP_VERSION}
|
||||
${DIR}/dockerfiles/php-fpm/xdebug.sh start ${PHP_VERSION} ${WITH_PROFILER}
|
||||
${DIR}/dockerfiles/workspace/xdebug.sh start ${PHP_VERSION} ${WITH_PROFILER}
|
||||
|
@ -14,7 +14,7 @@ services:
|
||||
- "443:443"
|
||||
expose:
|
||||
- 80
|
||||
php-fpm:
|
||||
php:
|
||||
build:
|
||||
context: ./dockerfiles/php-fpm
|
||||
args:
|
||||
@ -27,6 +27,7 @@ services:
|
||||
restart: always
|
||||
volumes:
|
||||
- ${PROJECTS_DIR}:/usr/share/nginx/html
|
||||
- ./data/profiler:/tmp
|
||||
expose:
|
||||
- 9000
|
||||
workspace:
|
||||
|
@ -12,13 +12,13 @@ services:
|
||||
php73:
|
||||
extends:
|
||||
file: docker-compose.base.yml
|
||||
service: php-fpm
|
||||
service: php
|
||||
build:
|
||||
dockerfile: php73.Dockerfile
|
||||
php74:
|
||||
extends:
|
||||
file: docker-compose.base.yml
|
||||
service: php-fpm
|
||||
service: php
|
||||
build:
|
||||
dockerfile: php74.Dockerfile
|
||||
workspace73:
|
||||
|
@ -5,11 +5,11 @@ xdebug.remote_connect_back=1
|
||||
xdebug.remote_port=9000
|
||||
xdebug.idekey=PHPSTORM
|
||||
|
||||
xdebug.remote_autostart=1
|
||||
xdebug.remote_enable=1
|
||||
xdebug.remote_autostart=0
|
||||
xdebug.remote_enable=0
|
||||
xdebug.cli_color=0
|
||||
xdebug.profiler_enable=1
|
||||
xdebug.profiler_enable_trigger=1
|
||||
xdebug.profiler_enable=0
|
||||
xdebug.profiler_enable_trigger=0
|
||||
xdebug.profiler_output_dir=/tmp
|
||||
|
||||
xdebug.remote_handler=dbgp
|
||||
|
@ -3,6 +3,7 @@
|
||||
# NOTE: At the moment, this has only been confirmed to work with PHP 7
|
||||
|
||||
PHP_VERSION=$2 # Without dot
|
||||
WITH_PROFILER=$3
|
||||
|
||||
# Grab full name of php-fpm container
|
||||
PHP_FPM_CONTAINER=$(docker ps | grep php${PHP_VERSION} | awk '{print $1}')
|
||||
@ -12,6 +13,10 @@ if [[ -z "${PHP_FPM_CONTAINER}" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -z "${WITH_PROFILER}" ]]; then
|
||||
echo "With profiler option".
|
||||
fi
|
||||
|
||||
# Grab OS type
|
||||
if [[ "$(uname)" == "Darwin" ]]; then
|
||||
OS_TYPE="OSX"
|
||||
@ -43,6 +48,7 @@ xdebug_start ()
|
||||
ON_CMD="sed -i 's/^;zend_extension=/zend_extension=/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
|
||||
REMOTE_AUTOSTART_CMD="sed -i 's/^xdebug.remote_autostart=0/xdebug.remote_autostart=1/g' /usr/local/etc/php/conf.d/xdebug.ini"
|
||||
REMOTE_ENABLE_CMD="sed -i 's/^xdebug.remote_enable=0/xdebug.remote_enable=1/g' /usr/local/etc/php/conf.d/xdebug.ini"
|
||||
PROFILER_ENABLE_CDM="sed -i 's/^xdebug.profiler_enable=0/xdebug.profiler_enable=1/g' /usr/local/etc/php/conf.d/xdebug.ini"
|
||||
|
||||
# If running on Windows, need to prepend with winpty :(
|
||||
if [[ $OS_TYPE == "MINGW" ]]; then
|
||||
@ -52,12 +58,19 @@ xdebug_start ()
|
||||
docker restart $PHP_FPM_CONTAINER
|
||||
winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
|
||||
|
||||
if [[ ! -z "${WITH_PROFILER}" ]]; then
|
||||
winpty docker exec -it $PHP_FPM_CONTAINER bash -c "${PROFILER_ENABLE_CDM}"
|
||||
fi
|
||||
else
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c "${ON_CMD}"
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c "${REMOTE_AUTOSTART_CMD}"
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c "${REMOTE_ENABLE_CMD}"
|
||||
docker restart $PHP_FPM_CONTAINER
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
|
||||
|
||||
if [[ ! -z "${WITH_PROFILER}" ]]; then
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c "${PROFILER_ENABLE_CDM}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@ -70,6 +83,7 @@ xdebug_stop ()
|
||||
OFF_CMD="sed -i 's/^zend_extension=/;zend_extension=/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
|
||||
REMOTE_AUTOSTART_CMD="sed -i 's/^xdebug.remote_autostart=1/xdebug.remote_autostart=0/g' /usr/local/etc/php/conf.d/xdebug.ini"
|
||||
REMOTE_ENABLE_CMD="sed -i 's/^xdebug.remote_enable=1/xdebug.remote_enable=0/g' /usr/local/etc/php/conf.d/xdebug.ini"
|
||||
PROFILER_DISABLE_CMD="sed -i 's/^xdebug.profiler_enable=1/xdebug.profiler_enable=0/g' /usr/local/etc/php/conf.d/xdebug.ini"
|
||||
|
||||
# If running on Windows, need to prepend with winpty :(
|
||||
if [[ $OS_TYPE == "MINGW" ]]; then
|
||||
@ -82,7 +96,7 @@ xdebug_stop ()
|
||||
docker restart $PHP_FPM_CONTAINER
|
||||
#docker-compose restart php-fpm
|
||||
winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
|
||||
|
||||
winpty docker exec -it $PHP_FPM_CONTAINER bash -c "${PROFILER_DISABLE_CMD}"
|
||||
else
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c "${OFF_CMD}"
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c "${REMOTE_AUTOSTART_CMD}"
|
||||
@ -90,6 +104,7 @@ xdebug_stop ()
|
||||
# docker-compose restart php-fpm
|
||||
docker restart $PHP_FPM_CONTAINER
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c "${PROFILER_DISABLE_CMD}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -40,16 +40,6 @@ USER laradock
|
||||
COPY ./minio/auth.json /home/laradock/.mc/config.json
|
||||
|
||||
###########################################################################
|
||||
# Crontab
|
||||
###########################################################################
|
||||
|
||||
USER root
|
||||
|
||||
COPY ./crontab74 /etc/cron.d
|
||||
|
||||
RUN chmod -R 644 /etc/cron.d
|
||||
|
||||
###########################################################################
|
||||
# Install custom node version
|
||||
###########################################################################
|
||||
|
||||
@ -58,10 +48,20 @@ USER root
|
||||
ARG CUSTOM_NODE_VERSION
|
||||
ENV CUSTOM_NODE_VERSION ${CUSTOM_NODE_VERSION}
|
||||
|
||||
RUN if [ ${CUSTOM_NODE_VERSION} = true ]; then \
|
||||
. ~/.bashrc && nvm install lts/erbium \
|
||||
&& . ~/.bashrc && nvm alias default lts/erbium \
|
||||
RUN if [ ! -z "${CUSTOM_NODE_VERSION}" ]; then \
|
||||
. ~/.bashrc && nvm install ${CUSTOM_NODE_VERSION} \
|
||||
&& . ~/.bashrc && nvm alias default ${CUSTOM_NODE_VERSION} \
|
||||
&& cp -R ~/.nvm/alias /home/laradock/.nvm \
|
||||
&& cp -R ~/.nvm/versions /home/laradock/.nvm \
|
||||
&& chown -R ${CUSTOM_PUID}:${CUSTOM_PGID} /home/laradock/.nvm \
|
||||
;fi
|
||||
;fi
|
||||
|
||||
###########################################################################
|
||||
# Crontab
|
||||
###########################################################################
|
||||
|
||||
USER root
|
||||
|
||||
COPY ./crontab74 /etc/cron.d
|
||||
|
||||
RUN chmod -R 644 /etc/cron.d
|
Reference in New Issue
Block a user