forked from eatvio/eatvio-infra
Merge pull request 'ci(worker): worker separated' (#14) from apoloz/eatvio-infra:main into main
Reviewed-on: eatvio/eatvio-infra#14
This commit is contained in:
6
Makefile
6
Makefile
@@ -17,6 +17,12 @@ status:
|
||||
bash:
|
||||
docker-compose exec php-fpm bash
|
||||
|
||||
worker-restart:
|
||||
docker-compose exec worker supervisorctl restart laravel-worker:*
|
||||
|
||||
clear-images:
|
||||
docker-compose exec php-fpm ./artisan clear:orphaned-images
|
||||
|
||||
tinker:
|
||||
docker-compose exec php-fpm ./artisan tinker
|
||||
|
||||
|
||||
@@ -46,7 +46,6 @@ services:
|
||||
working_dir: /application
|
||||
environment:
|
||||
- TZ=Europe/Moscow
|
||||
command: ["/usr/bin/supervisord"]
|
||||
depends_on:
|
||||
- mysql
|
||||
networks:
|
||||
@@ -55,7 +54,42 @@ services:
|
||||
volumes:
|
||||
- "./app:/application"
|
||||
- "./phpdocker/php-fpm/php-ini-overrides.ini:/etc/php/8.2/fpm/conf.d/99-overrides.ini"
|
||||
- "./phpdocker/php-fpm/laravel-worker.conf:/etc/supervisor/conf.d/laravel-worker.conf"
|
||||
labels:
|
||||
- "traefik.enable=false"
|
||||
restart: always
|
||||
|
||||
frontend:
|
||||
build: phpdocker/front-end
|
||||
command: "npm run watch"
|
||||
working_dir: /application
|
||||
environment:
|
||||
- TZ=Europe/Moscow
|
||||
depends_on:
|
||||
- mysql
|
||||
- php-fpm
|
||||
networks:
|
||||
- ns-eatvio
|
||||
volumes:
|
||||
- "./app:/application"
|
||||
labels:
|
||||
- "traefik.enable=false"
|
||||
restart: always
|
||||
|
||||
worker:
|
||||
build: phpdocker/worker
|
||||
working_dir: /application
|
||||
environment:
|
||||
- TZ=Europe/Moscow
|
||||
command: "service supervisor start"
|
||||
depends_on:
|
||||
- mysql
|
||||
- php-fpm
|
||||
networks:
|
||||
- ns-eatvio
|
||||
volumes:
|
||||
- "./app:/application"
|
||||
- "./phpdocker/worker/php-ini-overrides.ini:/etc/php/8.2/fpm/conf.d/99-overrides.ini"
|
||||
- "./phpdocker/worker/laravel-worker.conf:/etc/supervisor/conf.d/laravel-worker.conf"
|
||||
labels:
|
||||
- "traefik.enable=false"
|
||||
restart: always
|
||||
|
||||
16
phpdocker/front-end/Dockerfile
Normal file
16
phpdocker/front-end/Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
||||
FROM phpdockerio/php:8.2-fpm
|
||||
WORKDIR "/application"
|
||||
|
||||
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash -
|
||||
RUN apt-get update && \
|
||||
apt-get -y --no-install-recommends install \
|
||||
git \
|
||||
php8.2-gd \
|
||||
php8.2-mysql \
|
||||
php8.2-sqlite3 \
|
||||
php8.2-pgsql \
|
||||
nodejs && npm install -g npm@10.1.0 \
|
||||
apt-get clean; \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
|
||||
|
||||
ENV PATH=node_modules/.bin:$PATH
|
||||
23
phpdocker/front-end/laravel-worker.conf
Normal file
23
phpdocker/front-end/laravel-worker.conf
Normal file
@@ -0,0 +1,23 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
|
||||
[program:laravel-worker]
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
command=php /application/artisan queue:work --sleep=3 --tries=3 --max-time=3600
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stopasgroup=true
|
||||
killasgroup=true
|
||||
user=www-data
|
||||
numprocs=2
|
||||
redirect_stderr=true
|
||||
stdout_logfile=/application/storage/logs/worker.log
|
||||
stopwaitsecs=3600
|
||||
|
||||
[program:php-fpm]
|
||||
command=php-fpm8.2 -F
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stdderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
2
phpdocker/front-end/php-ini-overrides.ini
Normal file
2
phpdocker/front-end/php-ini-overrides.ini
Normal file
@@ -0,0 +1,2 @@
|
||||
upload_max_filesize = 100M
|
||||
post_max_size = 108M
|
||||
@@ -9,7 +9,7 @@ autorestart=true
|
||||
stopasgroup=true
|
||||
killasgroup=true
|
||||
user=www-data
|
||||
numprocs=4
|
||||
numprocs=2
|
||||
redirect_stderr=true
|
||||
stdout_logfile=/application/storage/logs/worker.log
|
||||
stopwaitsecs=3600
|
||||
|
||||
9
phpdocker/worker/Dockerfile
Normal file
9
phpdocker/worker/Dockerfile
Normal file
@@ -0,0 +1,9 @@
|
||||
FROM phpdockerio/php:8.2-fpm
|
||||
WORKDIR "/application"
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get -y --no-install-recommends install git \
|
||||
php8.2-gd php8.2-mysql php8.2-sqlite3 php8.2-pgsql \
|
||||
python3-pkg-resources supervisor && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
|
||||
15
phpdocker/worker/laravel-worker.conf
Normal file
15
phpdocker/worker/laravel-worker.conf
Normal file
@@ -0,0 +1,15 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
|
||||
[program:laravel-worker]
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
command=php /application/artisan queue:work --sleep=3 --tries=3 --max-time=3600
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stopasgroup=true
|
||||
killasgroup=true
|
||||
user=www-data
|
||||
numprocs=2
|
||||
redirect_stderr=true
|
||||
stdout_logfile=/application/storage/logs/worker.log
|
||||
stopwaitsecs=3600
|
||||
2
phpdocker/worker/php-ini-overrides.ini
Normal file
2
phpdocker/worker/php-ini-overrides.ini
Normal file
@@ -0,0 +1,2 @@
|
||||
upload_max_filesize = 100M
|
||||
post_max_size = 108M
|
||||
Reference in New Issue
Block a user