Implement Gearman Message broker & PHP Extension

This commit is contained in:
Stefan Neuhaus 2019-07-25 12:03:21 +02:00
parent 196f145ff5
commit 044261b06f
8 changed files with 135 additions and 2 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

@ -149,6 +149,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}
@ -157,6 +158,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}
@ -225,6 +227,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}
@ -622,6 +625,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
@ -163,6 +164,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
@ -208,6 +210,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_PUID=1000
PHP_WORKER_PGID=1000
@ -766,4 +769,49 @@ CASSANDRA_ENABLE_RPC=true
# Datacenter name for the cluster. Ignored in SimpleSnitch endpoint snitch. Default: dc1.
CASSANDRA_DATACENTER=dc1
# Rack name for the cluster. Ignored in SimpleSnitch endpoint snitch. Default: rack1.
CASSANDRA_RACK=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

@ -306,6 +306,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

@ -437,6 +437,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
###########################################################################