Merge pull request #2215 from stefnats/gearman

Implement Gearman Message broker & PHP Extension
This commit is contained in:
Shao Yu-Lung (Allen) 2019-10-07 17:08:29 +08:00 committed by GitHub
commit 04c6aaf338
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 134 additions and 1 deletions

View File

@ -31,7 +31,7 @@ env:
- PHP_VERSION=NA BUILD_SERVICE="mssql rethinkdb aerospike"
- PHP_VERSION=NA BUILD_SERVICE="blackfire minio percona nginx caddy apache2 mysql mariadb postgres postgres-postgis neo4j mongo redis cassandra"
- PHP_VERSION=NA BUILD_SERVICE="adminer phpmyadmin pgadmin"
- PHP_VERSION=NA BUILD_SERVICE="memcached beanstalkd beanstalkd-console rabbitmq elasticsearch certbot mailhog maildev selenium jenkins proxy proxy2 haproxy"
- PHP_VERSION=NA BUILD_SERVICE="memcached beanstalkd beanstalkd-console rabbitmq elasticsearch certbot mailhog maildev selenium jenkins proxy proxy2 haproxy gearman"
- PHP_VERSION=NA BUILD_SERVICE="kibana grafana laravel-echo-server"
- PHP_VERSION=NA BUILD_SERVICE="ipython-controller manticore"
# - PHP_VERSION=NA BUILD_SERVICE="aws"

View File

@ -194,6 +194,7 @@ That's it! enjoy :)
- Eclipse Mosquitto
- PHP Worker
- Laravel Horizon
- Gearman
- **Mail Servers:**
- Mailu

View File

@ -70,6 +70,7 @@ services:
- INSTALL_MONGO=${WORKSPACE_INSTALL_MONGO}
- INSTALL_AMQP=${WORKSPACE_INSTALL_AMQP}
- INSTALL_CASSANDRA=${WORKSPACE_INSTALL_CASSANDRA}
- INSTALL_GEARMAN=${WORKSPACE_INSTALL_GEARMAN}
- INSTALL_PHPREDIS=${WORKSPACE_INSTALL_PHPREDIS}
- INSTALL_MSSQL=${WORKSPACE_INSTALL_MSSQL}
- INSTALL_NODE=${WORKSPACE_INSTALL_NODE}
@ -159,6 +160,7 @@ services:
- INSTALL_MONGO=${PHP_FPM_INSTALL_MONGO}
- INSTALL_AMQP=${PHP_FPM_INSTALL_AMQP}
- INSTALL_CASSANDRA=${PHP_FPM_INSTALL_CASSANDRA}
- INSTALL_GEARMAN=${PHP_FPM_INSTALL_GEARMAN}
- INSTALL_MSSQL=${PHP_FPM_INSTALL_MSSQL}
- INSTALL_BCMATH=${PHP_FPM_INSTALL_BCMATH}
- INSTALL_GMP=${PHP_FPM_INSTALL_GMP}
@ -230,6 +232,7 @@ services:
- INSTALL_MYSQL_CLIENT=${PHP_WORKER_INSTALL_MYSQL_CLIENT}
- INSTALL_AMQP=${PHP_WORKER_INSTALL_AMQP}
- INSTALL_CASSANDRA=${PHP_WORKER_INSTALL_CASSANDRA}
- INSTALL_GEARMAN=${PHP_WORKER_INSTALL_GEARMAN}
- INSTALL_GHOSTSCRIPT=${PHP_WORKER_INSTALL_GHOSTSCRIPT}
- INSTALL_SWOOLE=${PHP_WORKER_INSTALL_SWOOLE}
- INSTALL_TAINT=${PHP_WORKER_INSTALL_TAINT}
@ -629,6 +632,39 @@ services:
networks:
- backend
### Gearman ############################################
gearman:
build: ./gearman
ports:
- "${GEARMAN_PORT}:4730"
privileged: true
environment:
- GEARMAN_VERSION=${GEARMAN_VERSION}
- GEARMAN_VERBOSE=${GEARMAN_VERBOSE}
- GEARMAN_QUEUE_TYPE=${GEARMAN_QUEUE_TYPE}
- GEARMAN_THREADS=${GEARMAN_THREADS}
- GEARMAN_BACKLOG=${GEARMAN_BACKLOG}
- GEARMAN_FILE_DESCRIPTORS=${GEARMAN_FILE_DESCRIPTORS}
- GEARMAN_JOB_RETRIES=${GEARMAN_JOB_RETRIES}
- GEARMAN_ROUND_ROBIN=${GEARMAN_ROUND_ROBIN}
- GEARMAN_WORKER_WAKEUP=${GEARMAN_WORKER_WAKEUP}
- GEARMAN_KEEPALIVE=${GEARMAN_KEEPALIVE}
- GEARMAN_KEEPALIVE_IDLE=${GEARMAN_KEEPALIVE_IDLE}
- GEARMAN_KEEPALIVE_INTERVAL=${GEARMAN_KEEPALIVE_INTERVAL}
- GEARMAN_KEEPALIVE_COUNT=${GEARMAN_KEEPALIVE_COUNT}
- GEARMAN_MYSQL_HOST=${GEARMAN_MYSQL_HOST}
- GEARMAN_MYSQL_PORT=${GEARMAN_MYSQL_PORT}
- GEARMAN_MYSQL_USER=${GEARMAN_MYSQL_USER}
- GEARMAN_MYSQL_PASSWORD=${GEARMAN_MYSQL_PASSWORD}
- GEARMAN_MYSQL_PASSWORD_FILE=${GEARMAN_MYSQL_PASSWORD_FILE}
- GEARMAN_MYSQL_DB=${GEARMAN_MYSQL_DB}
- GEARMAN_MYSQL_TABLE=${GEARMAN_MYSQL_TABLE}
hostname: laradock-gearman
depends_on:
- php-fpm
networks:
- backend
### Beanstalkd Console ###################################
beanstalkd-console:
build: ./beanstalkd-console

View File

@ -107,6 +107,7 @@ WORKSPACE_INSTALL_IMAP=false
WORKSPACE_INSTALL_MONGO=false
WORKSPACE_INSTALL_AMQP=false
WORKSPACE_INSTALL_CASSANDRA=false
WORKSPACE_INSTALL_GEARMAN=false
WORKSPACE_INSTALL_MSSQL=false
WORKSPACE_INSTALL_DRUSH=false
WORKSPACE_DRUSH_VERSION=8.1.17
@ -164,6 +165,7 @@ PHP_FPM_INSTALL_IMAP=false
PHP_FPM_INSTALL_MONGO=false
PHP_FPM_INSTALL_AMQP=false
PHP_FPM_INSTALL_CASSANDRA=false
PHP_FPM_INSTALL_GEARMAN=false
PHP_FPM_INSTALL_MSSQL=false
PHP_FPM_INSTALL_SSH2=false
PHP_FPM_INSTALL_SOAP=false
@ -210,6 +212,7 @@ PHP_WORKER_INSTALL_TAINT=false
PHP_WORKER_INSTALL_FFMPEG=false
PHP_WORKER_INSTALL_GMP=false
PHP_WORKER_INSTALL_CASSANDRA=false
PHP_WORKER_INSTALL_GEARMAN=false
PHP_WORKER_INSTALL_REDIS=false
PHP_WORKER_PUID=1000
@ -775,3 +778,48 @@ CASSANDRA_ENABLE_RPC=true
CASSANDRA_DATACENTER=dc1
# Rack name for the cluster. Ignored in SimpleSnitch endpoint snitch. Default: rack1.
CASSANDRA_RACK=rack1
### GEARMAN ##################################################
# Gearman version to use. See available tags at https://hub.docker.com/r/artefactual/gearmand
GEARMAN_VERSION=latest
# Port to use (Default: 6379)
GEARMAN_PORT=6379
# Logging Level (Default: INFO)
GEARMAN_VERBOSE=INFO
# Persistent queue type to use (Default: builtin)
GEARMAN_QUEUE_TYPE=builtin
# Number of I/O threads to use (Default: 4)
GEARMAN_THREADS=4
# Number of backlog connections for listen (Default: 32)
GEARMAN_BACKLOG=32
# Number of file descriptors to allow for the process (Default is max allowed for user)
GEARMAN_FILE_DESCRIPTORS=
# Number of attempts to run the job before the job server removes it. (Default: no limit = 0)
GEARMAN_JOB_RETRIES=0
# Assign work in round-robin order per worker connection (Default: 0)
GEARMAN_ROUND_ROBIN=0
# Number of workers to wakeup for each job received (Default: 0)
GEARMAN_WORKER_WAKEUP=0
# Enable keepalive on sockets (Default: 0)
GEARMAN_KEEPALIVE=0
# The duration between two keepalive transmissions in idle condition (Default: 30)
GEARMAN_KEEPALIVE_IDLE=30
# The duration between two successive keepalive retransmissions, if acknowledgement to the previous keepalive transmission is not received (Default: 10)
GEARMAN_KEEPALIVE_INTERVAL=10
# The number of retransmissions to be carried out before declaring that remote end is not available (Default: 5)
GEARMAN_KEEPALIVE_COUNT=5
# Mysql server host (Default: localhost)
GEARMAN_MYSQL_HOST=localhost
# Mysql server port (Default: 3306)
GEARMAN_MYSQL_PORT=3306
# Mysql server user (Default: root)
GEARMAN_MYSQL_USER=root
# Mysql password
GEARMAN_MYSQL_PASSWORD=
# Path to file with mysql password(Docker secrets)
GEARMAN_MYSQL_PASSWORD_FILE=
# Database to use by Gearman (Default: Gearmand)
GEARMAN_MYSQL_DB=Gearmand
# Table to use by Gearman (Default: gearman_queue)
GEARMAN_MYSQL_TABLE=gearman_queue

5
gearman/Dockerfile Normal file
View File

@ -0,0 +1,5 @@
ARG GEARMAN_VERSION=latest
FROM artefactual/gearmand:${GEARMAN_VERSION}
LABEL maintainer="Stefan Neuhaus <https://www.github.com/stefnats>"

View File

@ -319,6 +319,30 @@ RUN if [ ${INSTALL_AMQP} = true ]; then \
docker-php-ext-install sockets \
;fi
###########################################################################
# GEARMAN:
###########################################################################
ARG INSTALL_GEARMAN=false
RUN if [ ${INSTALL_GEARMAN} = true ]; then \
apt-get update && \
apt-get -y install libgearman-dev && \
cd /tmp && \
curl -L https://github.com/wcgallego/pecl-gearman/archive/gearman-2.0.5.zip -O && \
unzip gearman-2.0.5.zip && \
mv pecl-gearman-gearman-2.0.5 pecl-gearman && \
cd /tmp/pecl-gearman && \
phpize && \
./configure && \
make -j$(nproc) && \
make install && \
cd / && \
rm /tmp/gearman-2.0.5.zip && \
rm -r /tmp/pecl-gearman && \
docker-php-ext-enable gearman \
;fi
###########################################################################
# pcntl
###########################################################################

View File

@ -85,6 +85,13 @@ RUN if [ ${INSTALL_AMQP} = true ]; then \
docker-php-ext-install sockets \
;fi
# Install Gearman:
ARG INSTALL_GEARMAN=false
RUN if [ ${INSTALL_GEARMAN} = true ]; then \
docker-php-ext-install gearman \
;fi
# Install Cassandra drivers:
ARG INSTALL_CASSANDRA=false
RUN if [ ${INSTALL_CASSANDRA} = true ]; then \

View File

@ -436,6 +436,18 @@ RUN if [ ${INSTALL_CASSANDRA} = true ]; then \
ln -s /etc/php/${LARADOCK_PHP_VERSION}/mods-available/cassandra.ini /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/30-cassandra.ini \
;fi
###########################################################################
# Gearman:
###########################################################################
ARG INSTALL_GEARMAN=false
RUN if [ ${INSTALL_GEARMAN} = true ]; then \
add-apt-repository -y ppa:ondrej/pkg-gearman && \
apt-get update && \
apt-get install php-gearman -y \
;fi
###########################################################################
# PHP REDIS EXTENSION
###########################################################################