feat: allows configuring the worker service and processes via command options and env vars
This commit is contained in:
@@ -1,14 +1,19 @@
|
|||||||
# torsearch-app is built from this base
|
# torsearch-app is built from this base
|
||||||
export APP_FRANKENPHP_TAG=php8.4
|
export APP_FRANKENPHP_TAG=php8.4
|
||||||
|
|
||||||
docker buildx build --platform=linux/amd64 -f docker/Dockerfile.base.app -t code.caldwell.digital/home/torsearch-base:${APP_FRANKENPHP_TAG} -t code.caldwell.digital/home/torsearch-base:latest --build-arg "FRANKENPHP_TAG=${APP_FRANKENPHP_TAG}" .
|
docker buildx build --platform=linux/amd64,linux/arm64 -f docker/Dockerfile.base.app -t code.caldwell.digital/home/torsearch-base:${APP_FRANKENPHP_TAG} -t code.caldwell.digital/home/torsearch-base:latest --build-arg "FRANKENPHP_TAG=${APP_FRANKENPHP_TAG}" .
|
||||||
docker push code.caldwell.digital/home/torsearch-base:${APP_FRANKENPHP_TAG}
|
docker push code.caldwell.digital/home/torsearch-base:${APP_FRANKENPHP_TAG}
|
||||||
docker push code.caldwell.digital/home/torsearch-base:latest
|
docker push code.caldwell.digital/home/torsearch-base:latest
|
||||||
|
|
||||||
# torsearch-worker & torsearch-scheduler are built from this base
|
# torsearch-worker & torsearch-scheduler are built from this base
|
||||||
export WORKER_FRANKENPHP_TAG=php8.4-alpine
|
export WORKER_FRANKENPHP_TAG=php8.4-alpine
|
||||||
|
|
||||||
docker buildx build --platform=linux/amd64 -f docker/Dockerfile.base.worker -t code.caldwell.digital/home/torsearch-base-worker:${WORKER_FRANKENPHP_TAG} -t code.caldwell.digital/home/torsearch-base-worker:latest --build-arg "FRANKENPHP_TAG=${WORKER_FRANKENPHP_TAG}" .
|
docker buildx build --platform=linux/amd64,linux/arm64 -f docker/Dockerfile.base.worker -t code.caldwell.digital/home/torsearch-base-worker:${WORKER_FRANKENPHP_TAG} -t code.caldwell.digital/home/torsearch-base-worker:latest --build-arg "FRANKENPHP_TAG=${WORKER_FRANKENPHP_TAG}" .
|
||||||
docker push code.caldwell.digital/home/torsearch-base-worker:${WORKER_FRANKENPHP_TAG}
|
docker push code.caldwell.digital/home/torsearch-base-worker:${WORKER_FRANKENPHP_TAG}
|
||||||
docker push code.caldwell.digital/home/torsearch-base-worker:latest
|
docker push code.caldwell.digital/home/torsearch-base-worker:latest
|
||||||
|
|
||||||
|
# torsearch-worker-supervisord
|
||||||
|
export ALPINE_VERSION=3.22
|
||||||
|
|
||||||
|
docker buildx build --platform=linux/amd64,linux/arm64 -f docker/Dockerfile.base.worker -t code.caldwell.digital/home/torsearch-base-worker-supervisord:latest --build-arg "ALPINE_VERSION=${ALPINE_VERSION}" .
|
||||||
|
docker push code.caldwell.digital/home/torsearch-base-worker-supervisord:latest
|
||||||
|
|||||||
@@ -1,19 +1,29 @@
|
|||||||
ARG FRANKENPHP_TAG
|
#####
|
||||||
|
# This version of Torsearch runs the scheduler, downloader, and worker
|
||||||
|
# in a single 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 ALPINE_VERSION="3.22"
|
||||||
|
FROM alpine:${ALPINE_VERSION} AS build_stage
|
||||||
|
|
||||||
FROM dunglas/frankenphp:${FRANKENPHP_TAG}
|
RUN apk add --no-cache \
|
||||||
|
curl \
|
||||||
|
php84 \
|
||||||
|
php84-curl \
|
||||||
|
php84-fileinfo \
|
||||||
|
php84-gd \
|
||||||
|
php84-mbstring \
|
||||||
|
php84-mysqli \
|
||||||
|
php84-opcache \
|
||||||
|
php84-openssl \
|
||||||
|
php84-pdo_mysql \
|
||||||
|
supervisor
|
||||||
|
|
||||||
ENV SERVER_NAME=":80"
|
RUN ln -s /usr/bin/php84 /usr/bin/php
|
||||||
ENV CADDY_GLOBAL_OPTIONS="auto_https off"
|
|
||||||
ENV APP_RUNTIME="Runtime\\FrankenPhpSymfony\\Runtime"
|
|
||||||
|
|
||||||
ARG APP_VERSION="0.dev"
|
RUN mkdir -p /etc/supervisor/conf.d
|
||||||
ENV APP_VERSION="${APP_VERSION}"
|
|
||||||
|
|
||||||
RUN install-php-extensions \
|
# We start supervisord and supervisord starts
|
||||||
pdo_mysql \
|
# respective service in the configuration file.
|
||||||
gd \
|
ENTRYPOINT ["/app/bin/console", "init:worker"]
|
||||||
intl \
|
|
||||||
zip \
|
|
||||||
opcache
|
|
||||||
|
|
||||||
RUN apk add --no-cache wget
|
|
||||||
|
|||||||
@@ -9,33 +9,18 @@ ARG APP_VERSION="latest"
|
|||||||
FROM code.caldwell.digital/home/torsearch-app:${APP_VERSION} AS base_image
|
FROM code.caldwell.digital/home/torsearch-app:${APP_VERSION} AS base_image
|
||||||
|
|
||||||
|
|
||||||
FROM alpine:3.22 AS build_stage
|
FROM code.caldwell.digital/home/torsearch-base-worker-supervisord:latest
|
||||||
|
|
||||||
COPY --from=base_image --chown=1000:1000 /app /app
|
ENV APP_VERSION=${APP_VERSION}
|
||||||
|
|
||||||
RUN apk add --no-cache \
|
COPY --from=base_image --chown=1000:1000 /app /app
|
||||||
curl \
|
COPY docker/ /app/docker
|
||||||
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
|
|
||||||
COPY docker/ app/docker
|
|
||||||
|
|
||||||
# We start supervisord and supervisord starts
|
# We start supervisord and supervisord starts
|
||||||
# respective service in the configuration file.
|
# respective service in the configuration file.
|
||||||
ENTRYPOINT ["/app/bin/console", "init:worker"]
|
ENTRYPOINT ["/app/bin/console", "init:worker"]
|
||||||
|
|
||||||
|
# Message transports can be enabled by passing them as command options.
|
||||||
|
# Inlcluding a number with the option will start that amount of processes
|
||||||
|
# for the transport. Not supplying a number will default to 1.
|
||||||
|
# --download --monitor OR --download 2 --monitor
|
||||||
|
|||||||
@@ -3,36 +3,3 @@ nodaemon=true
|
|||||||
logfile=/dev/null
|
logfile=/dev/null
|
||||||
logfile_maxbytes=0
|
logfile_maxbytes=0
|
||||||
pidfile=/run/supervisord.pid
|
pidfile=/run/supervisord.pid
|
||||||
|
|
||||||
[program:torsearch-worker]
|
|
||||||
command=/app/bin/console messenger:consume async -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-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 scheduler_monitor monitor -vv --time-limit 21600
|
|
||||||
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
|
|
||||||
|
|||||||
Reference in New Issue
Block a user