From d505871faffe89e35a7e89eeb2b2b6069c962202 Mon Sep 17 00:00:00 2001 From: Ignacio Cabrera Date: Tue, 14 Mar 2017 11:05:22 -0300 Subject: [PATCH 1/4] Adding php-worker for Laravel --- php-worker/Dockerfile | 39 +++++++++++++++++++++++++++++++++++++ php-worker/supervisord.conf | 9 +++++++++ 2 files changed, 48 insertions(+) create mode 100644 php-worker/Dockerfile create mode 100644 php-worker/supervisord.conf diff --git a/php-worker/Dockerfile b/php-worker/Dockerfile new file mode 100644 index 00000000..c588b3d0 --- /dev/null +++ b/php-worker/Dockerfile @@ -0,0 +1,39 @@ +# +#-------------------------------------------------------------------------- +# Image Setup +#-------------------------------------------------------------------------- +# +# To take a look at the'php-worker' base Image, visit its DockerHub page +# https://hub.docker.com/r/nielsvdoorn/laravel-supervisor/ +# + +FROM nielsvdoorn/laravel-supervisor + +# +#-------------------------------------------------------------------------- +# Optional Supervisord Configuration +#-------------------------------------------------------------------------- +# +# Modify the ./supervisor.conf file to match your App's requirements. +# Make sure you rebuild your container with every change. +# +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf + +# +#-------------------------------------------------------------------------- +# Optional Software's Installation +#-------------------------------------------------------------------------- +# +# If you need to modify this image, feel free to do it right here. +# + # -- Your awesome modifications go here -- # + + +# +#-------------------------------------------------------------------------- +# Final Touch +#-------------------------------------------------------------------------- +# + +RUN rm -r /var/lib/apt/lists/* +WORKDIR /etc/supervisor/conf.d/supervisord.conf \ No newline at end of file diff --git a/php-worker/supervisord.conf b/php-worker/supervisord.conf new file mode 100644 index 00000000..78156750 --- /dev/null +++ b/php-worker/supervisord.conf @@ -0,0 +1,9 @@ +[supervisord] +nodaemon=true +[program:laravel-worker] +process_name=%(program_name)s_%(process_num)02d +command=php /var/www/laravel/artisan queue:work --sleep=3 --tries=3 --daemon +autostart=true +autorestart=true +numprocs=8 +redirect_stderr=true \ No newline at end of file From cbd3cf7c20f25d058d9f11d7daa03d5210a8a9c0 Mon Sep 17 00:00:00 2001 From: Ignacio Cabrera Date: Tue, 14 Mar 2017 11:06:45 -0300 Subject: [PATCH 2/4] Adding php-worker container to docker-compose --- docker-compose.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 283d7770..10eee553 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -74,6 +74,15 @@ services: environment: # IMPORTANT: Set the Remote Interpreter entry matching name to `laravel` - PHP_IDE_CONFIG=serverName=laravel + +### PHP Worker Container ################################# + php-worker: + build: + context: ./php-worker + volumes: + - ../:/var/www/laravel + links: + - workspace ### Nginx Server Container ################################## From 528b60eb17afc4b69c85d863ca1d7cbb61beb678 Mon Sep 17 00:00:00 2001 From: Ignacio Cabrera Date: Thu, 16 Mar 2017 21:03:04 -0300 Subject: [PATCH 3/4] fixing Volumes and Workdir --- docker-compose.yml | 4 ++-- php-worker/Dockerfile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 10eee553..ee6606b1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -79,8 +79,8 @@ services: php-worker: build: context: ./php-worker - volumes: - - ../:/var/www/laravel + volumes_from: + - applications links: - workspace diff --git a/php-worker/Dockerfile b/php-worker/Dockerfile index c588b3d0..13c6d95f 100644 --- a/php-worker/Dockerfile +++ b/php-worker/Dockerfile @@ -36,4 +36,4 @@ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf # RUN rm -r /var/lib/apt/lists/* -WORKDIR /etc/supervisor/conf.d/supervisord.conf \ No newline at end of file +WORKDIR /etc/supervisor/conf.d/ From f2805bca529507f945378fc23559d9b6f031423c Mon Sep 17 00:00:00 2001 From: Ignacio Cabrera Date: Thu, 16 Mar 2017 22:21:26 -0300 Subject: [PATCH 4/4] Update docker-compose.yml --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 48b860e7..4e046c29 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -70,7 +70,7 @@ services: extra_hosts: - "dockerhost:${DOCKER_HOST_IP}" environment: - - PHP_IDE_CONFIG=serverName=laravel + - PHP_IDE_CONFIG=${PHP_IDE_CONFIG} ### PHP Worker Container ##################################### php-worker: