wip: uses supervisord for worker and scheduler

This commit is contained in:
Brock H Caldwell
2025-11-02 21:29:48 -06:00
parent b67781fe23
commit b86028acee
5 changed files with 103 additions and 23 deletions

View File

@@ -1,10 +1,40 @@
FROM code.caldwell.digital/home/torsearch-base-worker:php8.4-alpine
###
# This version of Torsearch runs the scheduler, downloader, and worker
# in this one container. Each process is managerd by supervisord
# and can be configured via environment variables and more
# than one of these containers cans till be run.
###
ARG APP_VERSION="latest"
ARG APP_VERSION="0.0.0-dev"
ENV APP_VERSION="${APP_VERSION}"
FROM code.caldwell.digital/home/torsearch-app:${APP_VERSION} AS base_image
COPY . /app
ENTRYPOINT [ "php", "/app/bin/console", "messenger:consume", "async" ]
FROM alpine:3.22 AS build_stage
HEALTHCHECK --interval=3s --timeout=3s --retries=10 CMD return 0
COPY --from=base_image --chown=1000:1000 /app /app
RUN apk add --no-cache \
curl \
nginx \
php84 \
php84-ctype \
php84-curl \
php84-dom \
php84-fileinfo \
php84-fpm \
php84-gd \
php84-mbstring \
php84-mysqli \
php84-opcache \
php84-openssl \
php84-pdo_mysql \
php84-tokenizer \
supervisor
RUN ln -s /usr/bin/php84 /usr/bin/php
COPY docker/worker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# We start supervisord and supervisord starts
# respective service in the configuration file.
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

View File

@@ -0,0 +1,27 @@
[supervisord]
nodaemon=true
logfile=/dev/null
logfile_maxbytes=0
pidfile=/run/supervisord.pid
[program:torsearch-worker]
command=/app/bin/console messenger:consume download -vv --time-limit 3600
numprocs=1
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
autorestart=true
startretries=3
process_name=%(program_name)s_%(process_num)02d
[program:torsearch-scheduler]
command=/app/bin/console messenger:consume monitor -vv
numprocs=1
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
autorestart=true
startretries=3
process_name=%(program_name)s_%(process_num)02d