diff --git a/.gitignore b/.gitignore index affb5c63..06732062 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ /nginx/ssl/*.crt /nginx/ssl/*.key /nginx/ssl/*.csr + +.DS_Store \ No newline at end of file diff --git a/DOCUMENTATION/content/documentation/index.md b/DOCUMENTATION/content/documentation/index.md index c93d173c..0704aba4 100644 --- a/DOCUMENTATION/content/documentation/index.md +++ b/DOCUMENTATION/content/documentation/index.md @@ -862,6 +862,67 @@ docker-compose up -d gitlab +
+ +## Use Gitlab Runner + +1 - Retrieve the registration token in your gitlab project (Settings > CI / CD > Runners > Set up a specific Runner manually) + +2 - Open the `.env` file and set the following changes: +``` +# so that gitlab container will pass the correct domain to gitlab-runner container +GITLAB_DOMAIN_NAME=http://gitlab + +GITLAB_RUNNER_REGISTRATION_TOKEN= + +# so that gitlab-runner container will send POST request for registration to correct domain +GITLAB_CI_SERVER_URL=http://gitlab +``` + +3 - Open the `docker-compose.yml` file and add the following changes: +```yml + gitlab-runner: + environment: # these values will be used during `gitlab-runner register` + - RUNNER_EXECUTOR=docker # change from shell (default) + - DOCKER_IMAGE=alpine + - DOCKER_NETWORK_MODE=laradock_backend + networks: + - backend # connect to network where gitlab service is connected +``` + +4 - Run the Gitlab-Runner Container (`gitlab-runner`) with the `docker-compose up` command. Example: + +```bash +docker-compose up -d gitlab-runner +``` + +5 - Register the gitlab-runner to the gitlab container + +```bash +docker-compose exec gitlab-runner bash +gitlab-runner register +``` + +6 - Create a `.gitlab-ci.yml` file for your pipeline + +```yml +before_script: + - echo Hello! + +job1: + scripts: + - echo job1 +``` + +7 - Push changes to gitlab + +8 - Verify that pipeline is run successful + + + + + +
## Use Adminer diff --git a/env-example b/env-example index d7bbc988..b5986c19 100644 --- a/env-example +++ b/env-example @@ -153,6 +153,7 @@ PHP_FPM_INSTALL_IMAGE_OPTIMIZERS=true PHP_FPM_INSTALL_PHPREDIS=true PHP_FPM_INSTALL_MEMCACHED=false PHP_FPM_INSTALL_XDEBUG=false +PHP_FPM_INSTALL_XHPROF=false PHP_FPM_INSTALL_PHPDBG=false PHP_FPM_INSTALL_IMAP=false PHP_FPM_INSTALL_MONGO=false diff --git a/nginx/Dockerfile b/nginx/Dockerfile index 12c456d8..c98498f3 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -14,6 +14,7 @@ RUN if [ ${CHANGE_SOURCE} = true ]; then \ RUN apk update \ && apk upgrade \ + && apk --update add logrotate \ && apk add --no-cache openssl \ && apk add --no-cache bash \ && adduser -D -H -u 1000 -s /bin/bash www-data @@ -21,6 +22,12 @@ RUN apk update \ ARG PHP_UPSTREAM_CONTAINER=php-fpm ARG PHP_UPSTREAM_PORT=9000 +# Create 'messages' file used from 'logrotate' +RUN touch /var/log/messages + +# Copy 'logrotate' config file +COPY logrotate/nginx /etc/logrotate.d/ + # Set upstream conf and remove the default conf RUN echo "upstream php-upstream { server ${PHP_UPSTREAM_CONTAINER}:${PHP_UPSTREAM_PORT}; }" > /etc/nginx/conf.d/upstream.conf \ && rm /etc/nginx/conf.d/default.conf diff --git a/nginx/logrotate/nginx b/nginx/logrotate/nginx new file mode 100644 index 00000000..8c89a83a --- /dev/null +++ b/nginx/logrotate/nginx @@ -0,0 +1,14 @@ +/var/log/nginx/*.log { + daily + missingok + rotate 32 + compress + delaycompress + nodateext + notifempty + create 644 www-data root + sharedscripts + postrotate + [ -f /var/run/nginx.pid ] && kill -USR1 `cat /var/run/nginx.pid` + endscript +} diff --git a/nginx/startup.sh b/nginx/startup.sh index 069d1418..f8e7b229 100644 --- a/nginx/startup.sh +++ b/nginx/startup.sh @@ -6,4 +6,8 @@ if [ ! -f /etc/nginx/ssl/default.crt ]; then openssl x509 -req -days 365 -in "/etc/nginx/ssl/default.csr" -signkey "/etc/nginx/ssl/default.key" -out "/etc/nginx/ssl/default.crt" fi +# Start crond in background +crond -l 2 -b + +# Start nginx in foreground nginx diff --git a/php-fpm/Dockerfile b/php-fpm/Dockerfile index 17a98410..9d90ee68 100644 --- a/php-fpm/Dockerfile +++ b/php-fpm/Dockerfile @@ -239,6 +239,34 @@ RUN if [ ${INSTALL_MONGO} = true ]; then \ docker-php-ext-enable mongodb \ ;fi +########################################################################### +# Xhprof: +########################################################################### + +ARG INSTALL_XHPROF=false + +RUN if [ ${INSTALL_XHPROF} = true ]; then \ + # Install the php xhprof extension + if [ $(php -r "echo PHP_MAJOR_VERSION;") = 7 ]; then \ + curl -L -o /tmp/xhprof.tar.gz "https://github.com/tideways/php-xhprof-extension/archive/v4.1.6.tar.gz"; \ + else \ + curl -L -o /tmp/xhprof.tar.gz "https://codeload.github.com/phacility/xhprof/tar.gz/master"; \ + fi \ + && mkdir -p xhprof \ + && tar -C xhprof -zxvf /tmp/xhprof.tar.gz --strip 1 \ + && ( \ + cd xhprof \ + && phpize \ + && ./configure \ + && make \ + && make install \ + ) \ + && rm -r xhprof \ + && rm /tmp/xhprof.tar.gz \ +;fi + +COPY ./xhprof.ini /usr/local/etc/php/conf.d + ########################################################################### # AMQP: ########################################################################### diff --git a/php-fpm/xhprof.ini b/php-fpm/xhprof.ini new file mode 100644 index 00000000..1b010b9f --- /dev/null +++ b/php-fpm/xhprof.ini @@ -0,0 +1,8 @@ +[xhprof] +; extension=xhprof.so +extension=tideways.so +xhprof.output_dir=/var/www/xhprof +; no need to autoload, control in the program +tideways.auto_prepend_library=0 +; set default rate +tideways.sample_rate=100 \ No newline at end of file diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 7dd79bd2..d286ecef 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -345,7 +345,7 @@ ARG BLACKFIRE_CLIENT_TOKEN ENV BLACKFIRE_CLIENT_TOKEN ${BLACKFIRE_CLIENT_TOKEN} RUN if [ ${INSTALL_XDEBUG} = false -a ${INSTALL_BLACKFIRE} = true ]; then \ - curl -L https://packagecloud.io/gpg.key | apt-key add - && \ + curl -L https://packages.blackfire.io/gpg.key | apt-key add - && \ echo "deb http://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list && \ apt-get update -yqq && \ apt-get install blackfire-agent \