Compare commits
1 Commits
v0.15.13
...
dev-stream
| Author | SHA1 | Date | |
|---|---|---|---|
| db19d28ae0 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,5 +1,4 @@
|
|||||||
.idea
|
.idea
|
||||||
bolt.db
|
|
||||||
###> symfony/framework-bundle ###
|
###> symfony/framework-bundle ###
|
||||||
/.env.local
|
/.env.local
|
||||||
/.env.local.php
|
/.env.local.php
|
||||||
|
|||||||
27
Dockerfile
27
Dockerfile
@@ -1,16 +1,19 @@
|
|||||||
FROM dunglas/frankenphp
|
FROM php:8.4-fpm-alpine3.21
|
||||||
|
|
||||||
ENV SERVER_NAME=":80"
|
RUN docker-php-ext-install pdo_mysql
|
||||||
ENV CADDY_GLOBAL_OPTIONS="auto_https off"
|
|
||||||
ENV APP_RUNTIME="Runtime\\FrankenPhpSymfony\\Runtime"
|
|
||||||
|
|
||||||
RUN install-php-extensions \
|
# SETUP PHP-FPM CONFIG SETTINGS (max_children / max_requests)
|
||||||
pdo_mysql \
|
RUN echo 'pm = dynamic' >> /usr/local/etc/php-fpm.d/zz-docker.conf && \
|
||||||
gd \
|
echo 'pm.max_children = 75' >> /usr/local/etc/php-fpm.d/zz-docker.conf && \
|
||||||
intl \
|
echo 'pm.start_servers = 30' >> /usr/local/etc/php-fpm.d/zz-docker.conf && \
|
||||||
zip \
|
echo 'pm.min_spare_servers = 5' >> /usr/local/etc/php-fpm.d/zz-docker.conf && \
|
||||||
opcache
|
echo 'pm.max_spare_servers = 30' >> /usr/local/etc/php-fpm.d/zz-docker.conf && \
|
||||||
|
echo 'pm.process_idle_timeout = 10s' >> /usr/local/etc/php-fpm.d/zz-docker.conf
|
||||||
|
|
||||||
HEALTHCHECK --interval=3s --timeout=3s --retries=10 CMD [ "php", "/app/bin/console", "startup:status" ]
|
COPY --chmod=0775 ./bash/entrypoint.sh /usr/local/bin/
|
||||||
|
|
||||||
COPY docker/app/Caddyfile /etc/frankenphp/Caddyfile
|
HEALTHCHECK --interval=5s --timeout=5s --retries=5 CMD [ "php", "/var/www/bin/console", "startup:status" ]
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
|
||||||
|
|
||||||
|
WORKDIR /var/www
|
||||||
|
|||||||
11
Dockerfile.prod
Normal file
11
Dockerfile.prod
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
FROM registry.caldwell.digital/library/php:8.4-apache
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install libldap2-dev -y && \
|
||||||
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
|
docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ && \
|
||||||
|
docker-php-ext-install ldap
|
||||||
|
|
||||||
|
COPY --chown=www-data:www-data . /var/www
|
||||||
|
COPY bash/nginx.conf /etc/apache2/sites-enabled/vhost.conf
|
||||||
|
RUN rm /etc/apache2/sites-enabled/000-default.conf
|
||||||
2
bash/app/wget_download.sh
Executable file
2
bash/app/wget_download.sh
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
# $1 = movies/tvshows/etc, $2 = title of media, $3 = URL of download
|
||||||
|
cd /var/download/${1} && if [ ! -d "${2}" ]; then mkdir "${2}"; fi && cd "${2}" && wget "${3}"
|
||||||
13
bash/entrypoint.sh
Normal file
13
bash/entrypoint.sh
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Sleep for a second to ensure DB is awake and ready
|
||||||
|
SLEEP_TIME=$(shuf -i 2-5 -n 1)
|
||||||
|
echo "> Sleeping for ${SLEEP_TIME} seconds to wait for the database"
|
||||||
|
echo "> If there are errors after the migration runs, it's possible another container (scheduler, worker, etc.) already ran the migrations"
|
||||||
|
sleep $SLEEP_TIME
|
||||||
|
|
||||||
|
# Provision database
|
||||||
|
php /var/www/bin/console doctrine:migrations:migrate --no-interaction
|
||||||
|
php /var/www/bin/console db:seed
|
||||||
|
|
||||||
|
/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
|
||||||
32
bash/nginx.conf
Executable file
32
bash/nginx.conf
Executable file
@@ -0,0 +1,32 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
root /var/www/public;
|
||||||
|
|
||||||
|
location /hub/ {
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_pass http://mercure/;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
location / {
|
||||||
|
# try to serve file directly, fallback to index.php
|
||||||
|
try_files $uri /index.php$is_args$args;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
fastcgi_pass unix:/run/php-fpm.sock;
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
||||||
|
fastcgi_buffers 16 16k;
|
||||||
|
fastcgi_buffer_size 32k;
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||||
|
fastcgi_param DOCUMENT_ROOT $realpath_root;
|
||||||
|
internal;
|
||||||
|
}
|
||||||
|
}
|
||||||
96
compose.yml
96
compose.yml
@@ -12,41 +12,6 @@ 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
|
|
||||||
volumes:
|
|
||||||
- $PWD:/app
|
|
||||||
- mercure_data:/data
|
|
||||||
- mercure_config:/config
|
|
||||||
tty: true
|
|
||||||
environment:
|
|
||||||
MERCURE_PUBLISHER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
|
|
||||||
MERCURE_SUBSCRIBER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
|
|
||||||
depends_on:
|
|
||||||
database:
|
|
||||||
condition: service_healthy
|
|
||||||
|
|
||||||
|
|
||||||
worker:
|
|
||||||
build: .
|
|
||||||
restart: unless-stopped
|
|
||||||
volumes:
|
|
||||||
- $PWD:/app
|
|
||||||
tty: true
|
|
||||||
command: php /app/bin/console messenger:consume async -vv --time-limit=3600 limit=10
|
|
||||||
|
|
||||||
|
|
||||||
scheduler:
|
|
||||||
build: .
|
|
||||||
restart: unless-stopped
|
|
||||||
volumes:
|
|
||||||
- $PWD:/app
|
|
||||||
command: php /app/bin/console messenger:consume scheduler_monitor -vv
|
|
||||||
tty: true
|
|
||||||
|
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:latest
|
image: redis:latest
|
||||||
volumes:
|
volumes:
|
||||||
@@ -54,6 +19,62 @@ services:
|
|||||||
command: redis-server --maxmemory 512MB
|
command: redis-server --maxmemory 512MB
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
|
app:
|
||||||
|
build:
|
||||||
|
dockerfile: docker/Dockerfile.app
|
||||||
|
context: .
|
||||||
|
ports:
|
||||||
|
- "8001:80"
|
||||||
|
volumes:
|
||||||
|
- ./:/var/www
|
||||||
|
depends_on:
|
||||||
|
database:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
worker:
|
||||||
|
build:
|
||||||
|
dockerfile: docker/Dockerfile.worker
|
||||||
|
context: .
|
||||||
|
volumes:
|
||||||
|
- ./:/app
|
||||||
|
- ./var/downloads/movies:/var/download/movies
|
||||||
|
- ./var/downloads/tvshows:/var/download/tvshows
|
||||||
|
command: -vvv --time-limit=3600
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
depends_on:
|
||||||
|
app:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
scheduler:
|
||||||
|
build:
|
||||||
|
dockerfile: docker/Dockerfile.scheduler
|
||||||
|
context: .
|
||||||
|
volumes:
|
||||||
|
- ./:/var/www
|
||||||
|
- ./var/download:/var/download
|
||||||
|
command: -vv --time-limit=3600
|
||||||
|
depends_on:
|
||||||
|
app:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
mercure:
|
||||||
|
image: dunglas/mercure
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "3000:80"
|
||||||
|
environment:
|
||||||
|
SERVER_NAME: ':80'
|
||||||
|
MERCURE_PUBLISHER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
|
||||||
|
MERCURE_SUBSCRIBER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
|
||||||
|
MERCURE_EXTRA_DIRECTIVES: |
|
||||||
|
cors_origins *
|
||||||
|
anonymous
|
||||||
|
command: /usr/bin/caddy run --config /etc/caddy/dev.Caddyfile
|
||||||
|
volumes:
|
||||||
|
- mercure_data:/data
|
||||||
|
- mercure_config:/config
|
||||||
|
|
||||||
|
|
||||||
database:
|
database:
|
||||||
image: mariadb:10.11.2
|
image: mariadb:10.11.2
|
||||||
@@ -68,17 +89,14 @@ services:
|
|||||||
MYSQL_ROOT_PASSWORD: password
|
MYSQL_ROOT_PASSWORD: password
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
|
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
|
||||||
interval: 5s
|
timeout: 10s
|
||||||
timeout: 5s
|
|
||||||
retries: 10
|
retries: 10
|
||||||
|
|
||||||
|
|
||||||
adminer:
|
adminer:
|
||||||
image: adminer
|
image: adminer
|
||||||
ports:
|
ports:
|
||||||
- "8081:8080"
|
- "8081:8080"
|
||||||
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
mysql:
|
mysql:
|
||||||
mercure_data:
|
mercure_data:
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
"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": "c4ad1f54b8dd44fb55097f631c945460",
|
"content-hash": "33f1579a34e7ada02bb4738a9b39f493",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "1tomany/rich-bundle",
|
"name": "1tomany/rich-bundle",
|
||||||
@@ -3300,58 +3300,6 @@
|
|||||||
},
|
},
|
||||||
"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",
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ parameters:
|
|||||||
media.tvshows_path: '/var/download/%env(default:media.default_tvshows_dir:TVSHOWS_PATH)%'
|
media.tvshows_path: '/var/download/%env(default:media.default_tvshows_dir:TVSHOWS_PATH)%'
|
||||||
|
|
||||||
# Mercure
|
# Mercure
|
||||||
app.mercure.url: 'http://app/.well-known/mercure'
|
app.mercure.url: 'http://mercure/.well-known/mercure'
|
||||||
app.mercure.public_url: '%env(APP_URL)%/.well-known/mercure'
|
app.mercure.public_url: '%env(APP_URL)%/hub/.well-known/mercure'
|
||||||
|
|
||||||
# Cache
|
# Cache
|
||||||
app.cache.adapter: '%env(default:app.cache.adapter.default:CACHE_ADAPTER)%'
|
app.cache.adapter: '%env(default:app.cache.adapter.default:CACHE_ADAPTER)%'
|
||||||
|
|||||||
@@ -1,57 +1,50 @@
|
|||||||
services:
|
services:
|
||||||
app:
|
web:
|
||||||
image: registry.caldwell.digital/home/torsearch-app:${TAG}
|
image: code.caldwell.digital/home/torsearch/web:latest
|
||||||
ports:
|
ports:
|
||||||
- '8001:80'
|
- '8001:80'
|
||||||
environment:
|
volumes:
|
||||||
MERCURE_PUBLISHER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
|
- $PWD/bash/nginx.conf:/etc/nginx/conf.d/default.conf
|
||||||
MERCURE_SUBSCRIBER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
|
depends_on:
|
||||||
|
app:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
app:
|
||||||
|
image: code.caldwell.digital/home/torsearch/app:${TAG}
|
||||||
deploy:
|
deploy:
|
||||||
replicas: 2
|
replicas: 2
|
||||||
volumes:
|
|
||||||
- /mnt/media/downloads/movies:/var/download/movies
|
|
||||||
- /mnt/media/downloads/tvshows:/var/download/tvshows
|
|
||||||
- mercure_data:/data
|
|
||||||
- mercure_config:/config
|
|
||||||
depends_on:
|
|
||||||
- database
|
|
||||||
|
|
||||||
|
|
||||||
worker:
|
worker:
|
||||||
image: registry.caldwell.digital/home/torsearch-worker:${TAG}
|
image: code.caldwell.digital/home/torsearch/app:${TAG}
|
||||||
volumes:
|
volumes:
|
||||||
- /mnt/media/downloads/movies:/var/download/movies
|
- /mnt/media/downloads:/var/download
|
||||||
- /mnt/media/downloads/tvshows:/var/download/tvshows
|
command: php ./bin/console messenger:consume async -v --time-limit=3600 --limit=10
|
||||||
restart: always
|
|
||||||
command: -vv --time-limit=3600 --limit=10
|
|
||||||
deploy:
|
deploy:
|
||||||
replicas: 2
|
replicas: 2
|
||||||
depends_on:
|
|
||||||
- app
|
|
||||||
|
|
||||||
|
|
||||||
scheduler:
|
scheduler:
|
||||||
image: registry.caldwell.digital/home/torsearch-scheduler:${TAG}
|
image: code.caldwell.digital/home/torsearch/app:${TAG}
|
||||||
volumes:
|
volumes:
|
||||||
- /mnt/media/downloads/movies:/var/download/movies
|
- /mnt/media/downloads:/var/download
|
||||||
- /mnt/media/downloads/tvshows:/var/download/tvshows
|
command: php ./bin/console messenger:consume scheduler_monitor -vv --time-limit=3600
|
||||||
restart: always
|
|
||||||
command: -vv
|
|
||||||
depends_on:
|
|
||||||
- app
|
|
||||||
|
|
||||||
|
mercure:
|
||||||
redis:
|
image: dunglas/mercure
|
||||||
image: redis:latest
|
|
||||||
volumes:
|
|
||||||
- redis_data:/data
|
|
||||||
command: redis-server --maxmemory 512MB
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "3000:80"
|
||||||
|
environment:
|
||||||
|
SERVER_NAME: ':80'
|
||||||
|
MERCURE_PUBLISHER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
|
||||||
|
MERCURE_SUBSCRIBER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
|
||||||
|
MERCURE_EXTRA_DIRECTIVES: |
|
||||||
|
cors_origins *
|
||||||
|
anonymous
|
||||||
|
command: /usr/bin/caddy run --config /etc/caddy/dev.Caddyfile
|
||||||
|
volumes:
|
||||||
|
- mercure_data:/data
|
||||||
|
- mercure_config:/config
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
mysql:
|
|
||||||
mercure_config:
|
mercure_config:
|
||||||
mercure_data:
|
mercure_data:
|
||||||
redis_data:
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,19 @@
|
|||||||
FROM dunglas/frankenphp
|
FROM trafex/php-nginx:3.9.0
|
||||||
|
|
||||||
ENV SERVER_NAME=":80"
|
USER root
|
||||||
ENV CADDY_GLOBAL_OPTIONS="auto_https off"
|
|
||||||
ENV APP_RUNTIME="Runtime\\FrankenPhpSymfony\\Runtime"
|
|
||||||
|
|
||||||
RUN install-php-extensions \
|
RUN apk add --no-cache \
|
||||||
pdo_mysql \
|
php84-pdo_mysql \
|
||||||
gd \
|
php84-simplexml
|
||||||
intl \
|
|
||||||
zip \
|
|
||||||
opcache
|
|
||||||
|
|
||||||
COPY . /app
|
USER nobody
|
||||||
COPY --chmod=775 docker/app/entrypoint.sh /usr/local/bin/docker-entrypoint
|
|
||||||
COPY docker/app/Caddyfile /etc/frankenphp/Caddyfile
|
|
||||||
|
|
||||||
ENTRYPOINT [ "/usr/local/bin/docker-entrypoint" ]
|
COPY --chown=nobody:nobody . /var/www
|
||||||
|
COPY --chmod=0775 ./bash/entrypoint.sh /usr/local/bin/
|
||||||
|
COPY --chmod=0755 ./bash/nginx.conf /etc/nginx/conf.d/site.conf
|
||||||
|
|
||||||
CMD [ "frankenphp", "run", "--config", "/etc/frankenphp/Caddyfile" ]
|
HEALTHCHECK --interval=5s --timeout=5s --retries=5 CMD [ "php", "/var/www/bin/console", "startup:status" ]
|
||||||
|
|
||||||
HEALTHCHECK --interval=3s --timeout=3s --retries=10 CMD [ "php", "/app/bin/console", "startup:status" ]
|
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
|
||||||
|
|
||||||
|
WORKDIR /var/www
|
||||||
|
|||||||
@@ -1,18 +1,7 @@
|
|||||||
FROM dunglas/frankenphp:php8.4-alpine
|
FROM php:8.4-cli-alpine3.21
|
||||||
|
|
||||||
ENV SERVER_NAME=":80"
|
RUN docker-php-ext-install pdo_mysql
|
||||||
ENV CADDY_GLOBAL_OPTIONS="auto_https off"
|
|
||||||
ENV APP_RUNTIME="Runtime\\FrankenPhpSymfony\\Runtime"
|
|
||||||
|
|
||||||
RUN install-php-extensions \
|
COPY --chown=www-data:www-data . /app
|
||||||
pdo_mysql \
|
|
||||||
gd \
|
|
||||||
intl \
|
|
||||||
zip \
|
|
||||||
opcache
|
|
||||||
|
|
||||||
COPY . /app
|
ENTRYPOINT [ "php", "/app/bin/console", "messenger:consume", "scheduler_monitor" ]
|
||||||
|
|
||||||
ENTRYPOINT [ "php", "/app/bin/console", "messenger:consume", "scheduler_monitor" ]
|
|
||||||
|
|
||||||
HEALTHCHECK --interval=3s --timeout=3s --retries=10 CMD return 0
|
|
||||||
|
|||||||
3
docker/Dockerfile.web
Normal file
3
docker/Dockerfile.web
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
FROM nginx:1.28-alpine
|
||||||
|
|
||||||
|
COPY bash/nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
@@ -1,18 +1,7 @@
|
|||||||
FROM dunglas/frankenphp:php8.4-alpine
|
FROM php:8.4-cli-alpine3.21
|
||||||
|
|
||||||
ENV SERVER_NAME=":80"
|
RUN docker-php-ext-install pdo_mysql
|
||||||
ENV CADDY_GLOBAL_OPTIONS="auto_https off"
|
|
||||||
ENV APP_RUNTIME="Runtime\\FrankenPhpSymfony\\Runtime"
|
|
||||||
|
|
||||||
RUN install-php-extensions \
|
COPY --chown=www-data:www-data . /app
|
||||||
pdo_mysql \
|
|
||||||
gd \
|
|
||||||
intl \
|
|
||||||
zip \
|
|
||||||
opcache
|
|
||||||
|
|
||||||
COPY . /app
|
ENTRYPOINT [ "php", "/app/bin/console", "messenger:consume", "async" ]
|
||||||
|
|
||||||
ENTRYPOINT [ "php", "/app/bin/console", "messenger:consume", "async" ]
|
|
||||||
|
|
||||||
HEALTHCHECK --interval=3s --timeout=3s --retries=10 CMD return 0
|
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
{
|
|
||||||
{$CADDY_GLOBAL_OPTIONS}
|
|
||||||
|
|
||||||
frankenphp {
|
|
||||||
{$FRANKENPHP_CONFIG}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{$CADDY_EXTRA_CONFIG}
|
|
||||||
|
|
||||||
{$SERVER_NAME:localhost} {
|
|
||||||
log {
|
|
||||||
{$CADDY_SERVER_LOG_OPTIONS}
|
|
||||||
# Redact the authorization query parameter that can be set by Mercure
|
|
||||||
format filter {
|
|
||||||
request>uri query {
|
|
||||||
replace authorization REDACTED
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
root /app/public
|
|
||||||
encode zstd br gzip
|
|
||||||
|
|
||||||
mercure {
|
|
||||||
# Publisher JWT key
|
|
||||||
publisher_jwt {env.MERCURE_PUBLISHER_JWT_KEY} {env.MERCURE_PUBLISHER_JWT_ALG}
|
|
||||||
# Subscriber JWT key
|
|
||||||
subscriber_jwt {env.MERCURE_SUBSCRIBER_JWT_KEY} {env.MERCURE_SUBSCRIBER_JWT_ALG}
|
|
||||||
# Allow anonymous subscribers (double-check that it's what you want)
|
|
||||||
anonymous
|
|
||||||
# Enable the subscription API (double-check that it's what you want)
|
|
||||||
subscriptions
|
|
||||||
# Custmo cors
|
|
||||||
cors_origins *
|
|
||||||
# Extra directives
|
|
||||||
{$MERCURE_EXTRA_DIRECTIVES}
|
|
||||||
}
|
|
||||||
|
|
||||||
vulcain
|
|
||||||
|
|
||||||
{$CADDY_SERVER_EXTRA_DIRECTIVES}
|
|
||||||
|
|
||||||
# Disable Topics tracking if not enabled explicitly: https://github.com/jkarlin/topics
|
|
||||||
header ?Permissions-Policy "browsing-topics=()"
|
|
||||||
|
|
||||||
@phpRoute {
|
|
||||||
not path /.well-known/mercure*
|
|
||||||
not file {path}
|
|
||||||
}
|
|
||||||
rewrite @phpRoute index.php
|
|
||||||
|
|
||||||
@frontController path index.php
|
|
||||||
php @frontController
|
|
||||||
|
|
||||||
file_server {
|
|
||||||
hide *.php
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Sleep for a second to ensure DB is awake and ready
|
|
||||||
SLEEP_TIME=$(shuf -i 2-4 -n 1)
|
|
||||||
echo "> Sleeping for ${SLEEP_TIME} seconds to wait for the database"
|
|
||||||
sleep $SLEEP_TIME
|
|
||||||
|
|
||||||
# Provision database
|
|
||||||
php /app/bin/console doctrine:migrations:migrate --no-interaction
|
|
||||||
php /app/bin/console db:seed
|
|
||||||
|
|
||||||
exec docker-php-entrypoint "$@"
|
|
||||||
@@ -19,17 +19,13 @@ DATABASE_URL="mysql://root:password@database:3306/app?serverVersion=10.6.19.2-Ma
|
|||||||
# This key is never saved anywhere
|
# This key is never saved anywhere
|
||||||
# else and is passed to Torrentio
|
# else and is passed to Torrentio
|
||||||
# to retrieve download options
|
# to retrieve download options
|
||||||
#REAL_DEBRID_KEY=""
|
REAL_DEBRID_KEY=""
|
||||||
|
|
||||||
# Enter you TMDB API key
|
# Enter you TMDB API key
|
||||||
# This is used to provide rich search results
|
# This is used to provide rich search results
|
||||||
# when searching for media and rendering the
|
# when searching for media and rendering the
|
||||||
# Popular Movies and TV Shows section.
|
# Popular Movies and TV Shows section.
|
||||||
#TMDB_API=
|
TMDB_API=
|
||||||
|
|
||||||
REAL_DEBRID_KEY="QYYBR7OSQ4VEFKWASDEZ2B4VO67KHUJY6IWOT7HHA7ATXO7QCYDQ"
|
|
||||||
TMDB_API=eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiI0ZTJjYjJhOGUzOGJhNjdiNjVhOGU1NGM0ZWI1MzhmOCIsIm5iZiI6MTczNzkyNjA0NC41NjQsInN1YiI6IjY3OTZhNTljYzdiMDFiNzJjNzIzZWM5YiIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.e8DbNe9qrSBC1y-ANRv-VWBAtls-ZS2r7aNCiI68mpw
|
|
||||||
|
|
||||||
|
|
||||||
MERCURE_JWT_SECRET="!ChangeThisMercureHubJWTSecretKey!"
|
MERCURE_JWT_SECRET="!ChangeThisMercureHubJWTSecretKey!"
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- /mnt/media/downloads/movies:/var/download/movies
|
- /mnt/media/downloads/movies:/var/download/movies
|
||||||
- /mnt/media/downloads/tvshows:/var/download/tvshows
|
- /mnt/media/downloads/tvshows:/var/download/tvshows
|
||||||
command: -vvv
|
command: -v --time-limit=3600 --limit=10
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
restart: always
|
restart: always
|
||||||
@@ -44,6 +44,7 @@ services:
|
|||||||
image: code.caldwell.digital/home/torsearch-scheduler:latest
|
image: code.caldwell.digital/home/torsearch-scheduler:latest
|
||||||
volumes:
|
volumes:
|
||||||
- ./downloads:/var/download
|
- ./downloads:/var/download
|
||||||
|
command: -vv --time-limit=3600
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
restart: always
|
restart: always
|
||||||
@@ -83,8 +84,7 @@ services:
|
|||||||
MYSQL_ROOT_PASSWORD: password
|
MYSQL_ROOT_PASSWORD: password
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
|
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
|
||||||
interval: 5s
|
timeout: 10s
|
||||||
timeout: 5s
|
|
||||||
retries: 10
|
retries: 10
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
|
|||||||
@@ -1,115 +0,0 @@
|
|||||||
services:
|
|
||||||
# The "entrypoint" into the application. This reverse proxy
|
|
||||||
# proxies traffic back to their respective services. If not
|
|
||||||
# running behind a reverse proxy inject your SSL certificates
|
|
||||||
# into this container.
|
|
||||||
# This container runs the actual web app in a php:8.4-fpm
|
|
||||||
# base container.
|
|
||||||
app:
|
|
||||||
image: code.caldwell.digital/home/torsearch-app:latest
|
|
||||||
ports:
|
|
||||||
- '8006:80'
|
|
||||||
configs:
|
|
||||||
- env_file
|
|
||||||
deploy:
|
|
||||||
replicas: 2
|
|
||||||
depends_on:
|
|
||||||
- database
|
|
||||||
|
|
||||||
# Downloads happen in this container. Replicate this
|
|
||||||
# container to run multiple downloads simultaneously.
|
|
||||||
# Map your "movies" folder to /var/download/movies
|
|
||||||
# Map your "TV shows" folder to /var/download/tvshows
|
|
||||||
# If your folders are on another machine, use an NFS volume.
|
|
||||||
# This container runs a Symfony worker process.
|
|
||||||
# See: https://symfony.com/doc/current/messenger.html
|
|
||||||
worker:
|
|
||||||
image: code.caldwell.digital/home/torsearch-worker:latest
|
|
||||||
configs:
|
|
||||||
- source: env_file
|
|
||||||
target: /app/bin/.env.local
|
|
||||||
volumes:
|
|
||||||
- /mnt/media/downloads/movies:/var/download/movies
|
|
||||||
- /mnt/media/downloads/tvshows:/var/download/tvshows
|
|
||||||
restart: always
|
|
||||||
command: -vv
|
|
||||||
deploy:
|
|
||||||
replicas: 4
|
|
||||||
depends_on:
|
|
||||||
- app
|
|
||||||
|
|
||||||
# This container handles the monitoring for new media. When new
|
|
||||||
# monitors are added, jobs are periodically dispatched to this
|
|
||||||
# container, and the desired media is searched for and downloaded.
|
|
||||||
# This container runs a Symfony worker process.
|
|
||||||
# See: https://symfony.com/doc/current/messenger.html
|
|
||||||
scheduler:
|
|
||||||
image: code.caldwell.digital/home/torsearch-scheduler:latest
|
|
||||||
configs:
|
|
||||||
- env_file
|
|
||||||
volumes:
|
|
||||||
- ./downloads:/var/download
|
|
||||||
restart: always
|
|
||||||
depends_on:
|
|
||||||
- app
|
|
||||||
|
|
||||||
# This container facilitates viewing the progress of downloads
|
|
||||||
# in realtime. It also handles sending alerts and notifications.
|
|
||||||
# The MERCURE_PUBLISHER_JWT key & MERCURE_SUBSCRIBER_JWT_KEY should
|
|
||||||
# match the MERCURE_JWT_SECRET environment variable.
|
|
||||||
mercure:
|
|
||||||
image: dunglas/mercure
|
|
||||||
restart: unless-stopped
|
|
||||||
ports:
|
|
||||||
- "3001:80"
|
|
||||||
environment:
|
|
||||||
SERVER_NAME: ':80'
|
|
||||||
MERCURE_PUBLISHER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
|
|
||||||
MERCURE_SUBSCRIBER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
|
|
||||||
MERCURE_EXTRA_DIRECTIVES: |
|
|
||||||
cors_origins *
|
|
||||||
anonymous
|
|
||||||
command: /usr/bin/caddy run --config /etc/caddy/dev.Caddyfile
|
|
||||||
volumes:
|
|
||||||
- mercure_data:/data
|
|
||||||
- mercure_config:/config
|
|
||||||
|
|
||||||
database:
|
|
||||||
image: mariadb:10.11.2
|
|
||||||
volumes:
|
|
||||||
- mysql:/var/lib/mysql
|
|
||||||
environment:
|
|
||||||
MYSQL_DATABASE: app
|
|
||||||
MYSQL_USERNAME: app
|
|
||||||
MYSQL_PASSWORD: password
|
|
||||||
MYSQL_ROOT_PASSWORD: password
|
|
||||||
healthcheck:
|
|
||||||
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
|
|
||||||
interval: 5s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 10
|
|
||||||
|
|
||||||
redis:
|
|
||||||
image: redis:latest
|
|
||||||
volumes:
|
|
||||||
- redis_data:/data
|
|
||||||
command: redis-server --maxmemory 512MB
|
|
||||||
restart: unless-stopped
|
|
||||||
|
|
||||||
# **Optional**
|
|
||||||
# Provides a simple method of viewing the database
|
|
||||||
adminer:
|
|
||||||
image: adminer
|
|
||||||
ports:
|
|
||||||
- "8081:8080"
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
mysql:
|
|
||||||
mercure_config:
|
|
||||||
mercure_data:
|
|
||||||
redis_data:
|
|
||||||
|
|
||||||
configs:
|
|
||||||
env_file:
|
|
||||||
file: $PWD/.env
|
|
||||||
|
|
||||||
@@ -4,6 +4,7 @@ namespace App\Download\Framework\Controller;
|
|||||||
|
|
||||||
use App\Download\Action\Input\DownloadMediaInput;
|
use App\Download\Action\Input\DownloadMediaInput;
|
||||||
use App\Download\Framework\Repository\DownloadRepository;
|
use App\Download\Framework\Repository\DownloadRepository;
|
||||||
|
use App\Download\Stream;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
@@ -56,4 +57,17 @@ class ApiController extends AbstractController
|
|||||||
|
|
||||||
return $this->json(['status' => 200, 'message' => 'Added to Queue']);
|
return $this->json(['status' => 200, 'message' => 'Added to Queue']);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
#[Route('/stream', 'app_stream', methods: ['GET'])]
|
||||||
|
public function streamVideo()
|
||||||
|
{
|
||||||
|
$stream = new Stream(
|
||||||
|
'https://torrentio.strem.fun/realdebrid/QYYBR7OSQ4VEFKWASDEZ2B4VO67KHUJY6IWOT7HHA7ATXO7QCYDQ/e8b22517328a9704bf8400b8b98cfc22836ad1e4/null/3/Ted.2012.UNRATED.1080p.BluRay.x265-RARBG.mp4',
|
||||||
|
[
|
||||||
|
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
return $stream->start();
|
||||||
|
}
|
||||||
|
}
|
||||||
137
src/Download/Stream.php
Normal file
137
src/Download/Stream.php
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Download;
|
||||||
|
|
||||||
|
class Stream
|
||||||
|
{
|
||||||
|
|
||||||
|
private $path = "";
|
||||||
|
private $stream = "";
|
||||||
|
private $buffer = 512;
|
||||||
|
private $start = -1;
|
||||||
|
private $end = -1;
|
||||||
|
private $size = null;
|
||||||
|
private $httpString = "";
|
||||||
|
private $contentType = "video/mp4";
|
||||||
|
private $cacheControl = "max-age=2592000, public";
|
||||||
|
private $expires = null;
|
||||||
|
private $lastModified = null;
|
||||||
|
|
||||||
|
function __construct($filePath, $options){
|
||||||
|
$this->path = $filePath;
|
||||||
|
$this->httpString = isset($options['is_https']) ? (($options['is_https'] == true) ? "HTTPS/1.1" : "HTTP/1.1") : "HTTP/1.1";
|
||||||
|
$this->size = isset($options['video_size']) ? $options['video_size'] : $this->size;
|
||||||
|
$this->buffer = isset($options['video_buffer']) ? $options['video_buffer'] : $this->buffer;
|
||||||
|
$this->contentType = isset($options['content_type']) ? $options['content_type'] : $this->contentType;
|
||||||
|
$this->cacheControl = isset($options['cache_control']) ? $options['cache_control'] : $this->cacheControl;
|
||||||
|
$this->expires = isset($options['expires']) ? $options['expires'] : gmdate('D, d M Y H:i:s', time()+2592000).' GMT';
|
||||||
|
$this->lastModified = isset($options['last_modified']) ? $options['last_modified'] : gmdate('D, d M Y H:i:s', @filemtime($this->path)).' GMT';
|
||||||
|
}
|
||||||
|
|
||||||
|
private function open(){
|
||||||
|
if (!($this->stream = fopen($this->path, 'rb'))) {
|
||||||
|
die('Could not open stream for reading');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setHeader(){
|
||||||
|
// if (isset($_SERVER['RANGE'])) {
|
||||||
|
// print_r($_SERVER);
|
||||||
|
// die();
|
||||||
|
// }
|
||||||
|
|
||||||
|
ob_get_clean();
|
||||||
|
header("Content-Type: ".$this->contentType);
|
||||||
|
header("Cache-Control: ".$this->cacheControl);
|
||||||
|
header("Expires: ".$this->expires);
|
||||||
|
header("Last-Modified: ".$this->lastModified);
|
||||||
|
$this->start = 0;
|
||||||
|
$this->size = ($this->size == null || $this->size <= 0) ? $this->getContentLengthFromURL($this->path) : $this->size;
|
||||||
|
$this->end = $this->size - 1;
|
||||||
|
|
||||||
|
header("Accept-Ranges: bytes");
|
||||||
|
|
||||||
|
|
||||||
|
if (isset($_SERVER['HTTP_RANGE'])) {
|
||||||
|
// header("Accept-Ranges: 0-".$this->end);
|
||||||
|
|
||||||
|
$c_start = $this->start;
|
||||||
|
$c_end = $this->end;
|
||||||
|
|
||||||
|
list(, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2);
|
||||||
|
if (strpos($range, ',') !== false) {
|
||||||
|
header($this->httpString.' 416 Requested Range Not Satisfiable');
|
||||||
|
header("Content-Range: bytes ".$this->start."-".$this->end."/".$this->size);
|
||||||
|
header("X-ERROR-ERROR: TRUE");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
if ($range == '-') {
|
||||||
|
$c_start = $this->size - substr($range, 1);
|
||||||
|
}else{
|
||||||
|
$range = explode('-', $range);
|
||||||
|
$c_start = $range[0];
|
||||||
|
|
||||||
|
$c_end = (isset($range[1]) && is_numeric($range[1])) ? $range[1] : $c_end;
|
||||||
|
}
|
||||||
|
$c_end = ($c_end > $this->end) ? $this->end : $c_end;
|
||||||
|
if ($c_start > $c_end || $c_start > $this->size - 1 || $c_end >= $this->size) {
|
||||||
|
header($this->httpString.' 416 Requested Range Not Satisfiable');
|
||||||
|
header("Content-Range: bytes ".$this->start."-".$this->end."/".$this->size);
|
||||||
|
header("X-ERROR-ERROR: TRUE");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$this->start = $c_start;
|
||||||
|
$this->end = $c_end;
|
||||||
|
$length = $this->end - $this->start + 1;
|
||||||
|
fseek($this->stream, $this->start, SEEK_CUR);
|
||||||
|
header($this->httpString.' 206 Partial Content', true, 206);
|
||||||
|
header("Content-Length: ".$length);
|
||||||
|
header("Content-Range: bytes ".$this->start."-".$this->end."/".$this->size);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
header("Accept-Ranges: bytes");
|
||||||
|
header("Content-Length: ".$this->size);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function end(){
|
||||||
|
fclose($this->stream);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function stream(){
|
||||||
|
$i = $this->start;
|
||||||
|
set_time_limit(0);
|
||||||
|
while(!feof($this->stream) && $i <= $this->end) {
|
||||||
|
$bytesToRead = $this->buffer;
|
||||||
|
if(($i+$bytesToRead) > $this->end) {
|
||||||
|
$bytesToRead = $this->end - $i + 1;
|
||||||
|
}
|
||||||
|
$data = fread($this->stream, $bytesToRead);
|
||||||
|
echo $data;
|
||||||
|
flush();
|
||||||
|
$i += $bytesToRead;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function start(){
|
||||||
|
$this->open();
|
||||||
|
$this->setHeader();
|
||||||
|
$this->stream();
|
||||||
|
$this->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getContentLengthFromURL($url){
|
||||||
|
$arrayHeaders = get_headers($url,true);
|
||||||
|
$arrayHeaders = array_change_key_case($arrayHeaders, CASE_LOWER);
|
||||||
|
if(isset($arrayHeaders['content-length'])){
|
||||||
|
if(is_numeric($arrayHeaders['content-length']) && $arrayHeaders['content-length'] > 0){
|
||||||
|
return $arrayHeaders['content-length'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
namespace App\User\Framework\Controller\Web;
|
namespace App\User\Framework\Controller\Web;
|
||||||
|
|
||||||
|
use App\User\Action\Handler\RegisterUserHandler;
|
||||||
use App\User\Framework\Repository\UserRepository;
|
use App\User\Framework\Repository\UserRepository;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Attribute\Route;
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
|||||||
Reference in New Issue
Block a user