Merge remote-tracking branch 'upstream/master' into github-master

This commit is contained in:
xiagw 2019-05-26 01:07:20 +08:00
commit d5e83f8cfc
9 changed files with 126 additions and 1 deletions

2
.gitignore vendored
View File

@ -12,3 +12,5 @@
/nginx/ssl/*.crt
/nginx/ssl/*.key
/nginx/ssl/*.csr
.DS_Store

View File

@ -862,6 +862,67 @@ docker-compose up -d gitlab
<br>
<a name="Use-Gitlab-Runner"></a>
## 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=<value-in-step-1>
# 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
<br>
<a name="Use-Adminer"></a>
## Use Adminer

View File

@ -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

View File

@ -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

14
nginx/logrotate/nginx Normal file
View File

@ -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
}

View File

@ -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

View File

@ -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:
###########################################################################

8
php-fpm/xhprof.ini Normal file
View File

@ -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

View File

@ -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 \