wip: franenphp in worker mode
This commit is contained in:
38
Dockerfile
38
Dockerfile
@@ -1,20 +1,26 @@
|
|||||||
FROM trafex/php-nginx:3.9.0
|
FROM dunglas/frankenphp
|
||||||
|
|
||||||
USER root
|
RUN install-php-extensions \
|
||||||
|
pdo_mysql \
|
||||||
|
gd \
|
||||||
|
intl \
|
||||||
|
zip \
|
||||||
|
opcache
|
||||||
|
|
||||||
RUN apk add --no-cache \
|
#RUN apk add --no-cache \
|
||||||
php84-opcache \
|
# php84-opcache \
|
||||||
php84-pdo_mysql \
|
# php84-pdo_mysql \
|
||||||
php84-simplexml
|
# php84-simplexml
|
||||||
|
#
|
||||||
|
#USER nobody
|
||||||
|
#
|
||||||
|
#COPY --chmod=0775 ./bash/entrypoint.sh /usr/local/bin/
|
||||||
|
#COPY --chmod=0755 ./bash/nginx.conf /etc/nginx/conf.d/site.conf
|
||||||
|
#COPY --chmod=0755 ./docker/app/supervisord.conf /etc/supervisor/conf.d/async-queue.conf
|
||||||
|
|
||||||
USER nobody
|
#HEALTHCHECK --interval=3s --timeout=3s --retries=10 CMD [ "php", "/var/www/bin/console", "startup:status" ]
|
||||||
|
#
|
||||||
COPY --chmod=0775 ./bash/entrypoint.sh /usr/local/bin/
|
#ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
|
||||||
COPY --chmod=0755 ./bash/nginx.conf /etc/nginx/conf.d/site.conf
|
#
|
||||||
|
#WORKDIR /var/www
|
||||||
HEALTHCHECK --interval=3s --timeout=3s --retries=10 CMD [ "php", "/var/www/bin/console", "startup:status" ]
|
|
||||||
|
|
||||||
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
|
|
||||||
|
|
||||||
WORKDIR /var/www
|
|
||||||
|
|
||||||
|
|||||||
76
compose.yml
76
compose.yml
@@ -12,6 +12,21 @@ services:
|
|||||||
- $PWD/bash/caddy:/etc/caddy
|
- $PWD/bash/caddy:/etc/caddy
|
||||||
- $PWD/bash/certs:/etc/ssl
|
- $PWD/bash/certs:/etc/ssl
|
||||||
|
|
||||||
|
app:
|
||||||
|
build: .
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
SERVER_NAME: ":80"
|
||||||
|
FRANKENPHP_CONFIG: "worker /app/public/index.php"
|
||||||
|
CADDY_GLOBAL_OPTIONS: "auto_https off"
|
||||||
|
APP_RUNTIME: "Runtime\\FrankenPhpSymfony\\Runtime"
|
||||||
|
volumes:
|
||||||
|
- $PWD:/app
|
||||||
|
tty: true
|
||||||
|
depends_on:
|
||||||
|
database:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:latest
|
image: redis:latest
|
||||||
volumes:
|
volumes:
|
||||||
@@ -19,44 +34,33 @@ services:
|
|||||||
command: redis-server --maxmemory 512MB
|
command: redis-server --maxmemory 512MB
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
app:
|
|
||||||
build:
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
context: .
|
|
||||||
ports:
|
|
||||||
- "8001:80"
|
|
||||||
volumes:
|
|
||||||
- ./:/var/www
|
|
||||||
depends_on:
|
|
||||||
database:
|
|
||||||
condition: service_healthy
|
|
||||||
|
|
||||||
worker:
|
# worker:
|
||||||
build:
|
# build:
|
||||||
dockerfile: docker/Dockerfile.worker
|
# dockerfile: docker/Dockerfile.worker
|
||||||
context: .
|
# context: .
|
||||||
volumes:
|
# volumes:
|
||||||
- ./:/app
|
# - ./:/app
|
||||||
- ./var/downloads/movies:/var/download/movies
|
# - ./var/downloads/movies:/var/download/movies
|
||||||
- ./var/downloads/tvshows:/var/download/tvshows
|
# - ./var/downloads/tvshows:/var/download/tvshows
|
||||||
command: -vvv --time-limit=3600
|
# command: -vvv --time-limit=3600
|
||||||
env_file:
|
# env_file:
|
||||||
- .env
|
# - .env
|
||||||
depends_on:
|
# depends_on:
|
||||||
app:
|
# app:
|
||||||
condition: service_healthy
|
# condition: service_healthy
|
||||||
|
|
||||||
scheduler:
|
# scheduler:
|
||||||
build:
|
# build:
|
||||||
dockerfile: docker/Dockerfile.scheduler
|
# dockerfile: docker/Dockerfile.scheduler
|
||||||
context: .
|
# context: .
|
||||||
volumes:
|
# volumes:
|
||||||
- ./:/var/www
|
# - ./:/var/www
|
||||||
- ./var/download:/var/download
|
# - ./var/download:/var/download
|
||||||
command: -vv --time-limit=3600
|
# command: -vv --time-limit=3600
|
||||||
depends_on:
|
# depends_on:
|
||||||
app:
|
# app:
|
||||||
condition: service_healthy
|
# condition: service_healthy
|
||||||
|
|
||||||
mercure:
|
mercure:
|
||||||
image: dunglas/mercure
|
image: dunglas/mercure
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
"p3k/emoji-detector": "^1.2",
|
"p3k/emoji-detector": "^1.2",
|
||||||
"php-tmdb/api": "^4.1",
|
"php-tmdb/api": "^4.1",
|
||||||
"predis/predis": "^2.4",
|
"predis/predis": "^2.4",
|
||||||
|
"runtime/frankenphp-symfony": "^0.2.0",
|
||||||
"symfony/asset": "7.2.*",
|
"symfony/asset": "7.2.*",
|
||||||
"symfony/console": "7.2.*",
|
"symfony/console": "7.2.*",
|
||||||
"symfony/doctrine-messenger": "7.2.*",
|
"symfony/doctrine-messenger": "7.2.*",
|
||||||
|
|||||||
54
composer.lock
generated
54
composer.lock
generated
@@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "33f1579a34e7ada02bb4738a9b39f493",
|
"content-hash": "c4ad1f54b8dd44fb55097f631c945460",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "1tomany/rich-bundle",
|
"name": "1tomany/rich-bundle",
|
||||||
@@ -3300,6 +3300,58 @@
|
|||||||
},
|
},
|
||||||
"time": "2021-10-29T13:26:27+00:00"
|
"time": "2021-10-29T13:26:27+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "runtime/frankenphp-symfony",
|
||||||
|
"version": "0.2.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/php-runtime/frankenphp-symfony.git",
|
||||||
|
"reference": "56822c3631d9522a3136a4c33082d006bdfe4bad"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/php-runtime/frankenphp-symfony/zipball/56822c3631d9522a3136a4c33082d006bdfe4bad",
|
||||||
|
"reference": "56822c3631d9522a3136a4c33082d006bdfe4bad",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.1",
|
||||||
|
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
|
||||||
|
"symfony/http-kernel": "^5.4 || ^6.0 || ^7.0",
|
||||||
|
"symfony/runtime": "^5.4 || ^6.0 || ^7.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^9.5"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Runtime\\FrankenPhpSymfony\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Kévin Dunglas",
|
||||||
|
"email": "kevin@dunglas.dev"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "FrankenPHP runtime for Symfony",
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/php-runtime/frankenphp-symfony/issues",
|
||||||
|
"source": "https://github.com/php-runtime/frankenphp-symfony/tree/0.2.0"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://github.com/nyholm",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2023-12-12T12:06:11+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/asset",
|
"name": "symfony/asset",
|
||||||
"version": "v7.2.0",
|
"version": "v7.2.0",
|
||||||
|
|||||||
@@ -5,6 +5,15 @@ framework:
|
|||||||
|
|
||||||
transports:
|
transports:
|
||||||
# https://symfony.com/doc/current/messenger.html#transport-configuration
|
# https://symfony.com/doc/current/messenger.html#transport-configuration
|
||||||
|
download:
|
||||||
|
dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
|
||||||
|
options:
|
||||||
|
use_notify: true
|
||||||
|
check_delayed_interval: 60000
|
||||||
|
retry_strategy:
|
||||||
|
max_retries: 1
|
||||||
|
multiplier: 1
|
||||||
|
|
||||||
async:
|
async:
|
||||||
dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
|
dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
|
||||||
options:
|
options:
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ RUN docker-php-ext-install pdo_mysql
|
|||||||
|
|
||||||
COPY --chown=www-data:www-data . /app
|
COPY --chown=www-data:www-data . /app
|
||||||
|
|
||||||
ENTRYPOINT [ "php", "/app/bin/console", "messenger:consume", "async" ]
|
ENTRYPOINT [ "php", "/app/bin/console", "messenger:consume", "download" ]
|
||||||
|
|||||||
9
docker/app/supervisord.conf
Normal file
9
docker/app/supervisord.conf
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
[program:messenger-consume]
|
||||||
|
command=php /var/www/bin/console messenger:consume async --time-limit=3600
|
||||||
|
user=nobody
|
||||||
|
numprocs=2
|
||||||
|
startsecs=0
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
startretries=10
|
||||||
|
process_name=%(program_name)s_%(process_num)02d
|
||||||
Reference in New Issue
Block a user