ci(queue): separate worker, fornt-end and php

This commit is contained in:
Anatoliy Poloz
2024-03-05 09:57:23 +03:00
parent 7e4da4b574
commit 81d7132a4f
8 changed files with 104 additions and 3 deletions

View File

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

View 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

View 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

View File

@@ -0,0 +1,2 @@
upload_max_filesize = 100M
post_max_size = 108M

View File

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

View 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/*

View 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

View File

@@ -0,0 +1,2 @@
upload_max_filesize = 100M
post_max_size = 108M