From 46bbfd4367ce9b15719afc54b322762765631c5d Mon Sep 17 00:00:00 2001 From: PyRowMan Date: Tue, 17 Dec 2024 21:25:24 +0100 Subject: [PATCH 01/16] Add a "yes" option to skip confirmation prompts in install This commit introduces a `--yes` option to the `nntmux:install` command, allowing users to skip confirmation prompts for a streamlined installation process. It also improves messaging and error handling, particularly around locked installs, and removes unnecessary usage of `Str` helper methods. These changes enhance usability and code simplicity. --- app/Console/Commands/InstallNntmux.php | 93 +++++++++++++------------- 1 file changed, 46 insertions(+), 47 deletions(-) diff --git a/app/Console/Commands/InstallNntmux.php b/app/Console/Commands/InstallNntmux.php index e35abdfbc..dce760656 100644 --- a/app/Console/Commands/InstallNntmux.php +++ b/app/Console/Commands/InstallNntmux.php @@ -6,7 +6,6 @@ use App\Models\User; use Illuminate\Console\Command; use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\Process; -use Illuminate\Support\Str; class InstallNntmux extends Command { @@ -15,7 +14,7 @@ class InstallNntmux extends Command * * @var string */ - protected $signature = 'nntmux:install'; + protected $signature = 'nntmux:install {--y|yes : Skip confirmation prompts and proceed with installation}'; /** * The console command description. @@ -36,45 +35,53 @@ class InstallNntmux extends Command public function handle(): void { - $error = false; - - if ($this->confirm('Are you sure you want to install NNTmux? This will wipe your database!!')) { - if (File::exists(base_path().'/_install/install.lock')) { - if ($this->confirm('Do you want to remove install.lock file so you can continue with install?')) { - $this->info('Removing install.lock file so we can continue with install process'); + $yesMode = $this->option('yes'); + if (File::exists(base_path().'/_install/install.lock')) { + if ($yesMode) { + $this->info('Install is locked. The file "install.lock" is present. Use interactive mode to remove it.'); + exit; + } else { + if ($this->confirm('Install is locked. Do you want to remove the "install.lock" file to continue?')) { + $this->info('Removing install.lock file so we can continue with install process...'); $remove = Process::timeout(600)->run('rm _install/install.lock'); echo $remove->output(); echo $remove->errorOutput(); } else { - $this->info('Not removing install.lock, stopping install process'); + $this->info('Installation aborted. The file "install.lock" was not removed.'); exit; } } - $this->info('Migrating tables and seeding them with initial data'); - if (config('app.env') !== 'production') { - $this->call('migrate:fresh', ['--seed' => true]); - } else { - $this->call('migrate:fresh', ['--force' => true, '--seed' => true]); - } - - $paths = $this->updatePaths(); - if ($paths !== false) { - $this->info('Paths checked successfully'); - } - - if (! $error && $this->addAdminUser()) { - File::put(base_path().'/_install/install.lock', 'application install locked on '.now()); - $this->info('Generating application key'); - $this->call('key:generate', ['--force' => true]); - $this->info('NNTmux installation completed successfully'); - exit(); - } - - $this->error('NNTmux installation failed. Fix reported problems and try again'); - } else { - $this->info('Stopping install process'); - exit; } + + if (! $yesMode) { + if (! $this->confirm('Are you sure you want to install NNTmux? This will wipe your database!!')) { + $this->info('Installation aborted by user.'); + exit; + } + } + + $this->info('Migrating tables and seeding them with initial data'); + if (config('app.env') !== 'production') { + $this->call('migrate:fresh', ['--seed' => true]); + } else { + $this->call('migrate:fresh', ['--force' => true, '--seed' => true]); + } + + $paths = $this->updatePaths(); + if ($paths !== false) { + $this->info('Paths checked successfully'); + } + + if ($this->addAdminUser()) { + File::put(base_path().'/_install/install.lock', 'application install locked on '.now()); + $this->info('Generating application key'); + $this->call('key:generate', ['--force' => true]); + $this->info('NNTmux installation completed successfully'); + exit(); + } + + $this->error('NNTmux installation failed. Fix reported problems and try again'); + } /** @@ -90,8 +97,7 @@ class InstallNntmux extends Command $tmp_path = config('nntmux.tmp_path'); $unrar_path = config('nntmux_settings.unrar_path'); - $nzbPathCheck = File::isWritable($nzb_path); - if (! $nzbPathCheck) { + if (! File::isWritable($nzb_path)) { $this->warn($nzb_path.' is not writable. Please fix folder permissions'); return false; @@ -104,33 +110,26 @@ class InstallNntmux extends Command } $this->info('Folder '.$unrar_path.' successfully created'); } - $unrarPathCheck = is_writable($unrar_path); - if ($unrarPathCheck === false) { + + if (! is_writable($unrar_path)) { $this->warn($unrar_path.' is not writable. Please fix folder permissions'); return false; } - $coversPathCheck = File::isWritable($covers_path); - if (! $coversPathCheck) { + if (! File::isWritable($covers_path)) { $this->warn($covers_path.' is not writable. Please fix folder permissions'); return false; } - $tmpPathCheck = File::isWritable($tmp_path); - if (! $tmpPathCheck) { + if (! File::isWritable($tmp_path)) { $this->warn($tmp_path.' is not writable. Please fix folder permissions'); return false; } - return [ - 'nzb_path' => Str::finish($nzb_path, '/'), - 'covers_path' => Str::finish($covers_path, '/'), - 'unrar_path' => Str::finish($unrar_path, '/'), - 'tmp_path' => Str::finish($tmp_path, '/'), - ]; + return true; } private function addAdminUser(): bool From f01238fb5ab134449daba900d74136e8d850f0b3 Mon Sep 17 00:00:00 2001 From: PyRowMan Date: Tue, 17 Dec 2024 21:27:53 +0100 Subject: [PATCH 02/16] Fix artisna optimize by adding an application logo blade component Created a reusable Blade component for the application logo. This addition provides a consistent and maintainable way to display the logo in views. --- resources/views/components/application-logo.blade.php | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 resources/views/components/application-logo.blade.php diff --git a/resources/views/components/application-logo.blade.php b/resources/views/components/application-logo.blade.php new file mode 100644 index 000000000..33f8b9aac --- /dev/null +++ b/resources/views/components/application-logo.blade.php @@ -0,0 +1,4 @@ + + + + From 0cc01331f2663d9f37001add6fc3d3fbe2ced27e Mon Sep 17 00:00:00 2001 From: PyRowMan Date: Tue, 17 Dec 2024 21:29:10 +0100 Subject: [PATCH 03/16] Add Docker setup with Dockerfile, docker-compose, and entrypoint This commit introduces a Dockerized environment for the application, including a Dockerfile, docker-compose.yml, and a custom entrypoint script. The setup supports multiple services like MariaDB, Redis, and Elasticsearch, with health checks and environment configurations. It also automates dependency installation, environment setup, and Laravel-specific tasks like caching and installation processes. --- .dockerignore | 3 +- Dockerfile | 73 +++++++++++++++++ docker-compose.yml | 188 +++++++++++++++++++++++++++++++++++++++++++ docker-entrypoint.sh | 60 ++++++++++++++ 4 files changed, 322 insertions(+), 2 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 docker-entrypoint.sh diff --git a/.dockerignore b/.dockerignore index 3b429b802..d43e4e08b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,5 +2,4 @@ vendor/ docker/mariadb-data docker/redis-data docker/manticore-data -storage -resources +.env diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..2780b8cbc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,73 @@ + +FROM composer:latest AS composer-base +#FROM php:8.3-fpm AS php-base +FROM dunglas/frankenphp:1-php8.3 +LABEL maintainer="Fossil01" +ENV SERVER_NAME=:80 +ARG MYSQL_CLIENT="mariadb-client" +ARG SEVENZIP_VERSION=2407 + +WORKDIR /app + + +COPY --from=node:21 /usr/local/ /usr/local/ +COPY --from=composer-base --link /usr/bin/composer /usr/bin/composer + +RUN apt update \ + && apt install -y --no-install-recommends \ + unrar-free 7zip lame libcap2-bin python3 \ + curl zip unzip git nano bash-completion sudo wget tmux time fonts-powerline \ + gnupg sqlite3 libpng-dev dnsutils jq htop iputils-ping net-tools ffmpeg \ + jpegoptim webp optipng pngquant libavif-bin watch iproute2 nmon \ + libonig-dev libxml2-dev libicu-dev libjpeg-dev libfreetype6-dev libxslt-dev $MYSQL_CLIENT libcurl4-openssl-dev \ + && wget https://mediaarea.net/repo/deb/repo-mediaarea_1.0-24_all.deb \ + && dpkg -i repo-mediaarea_1.0-24_all.deb \ + && apt update \ + && apt install -y libmediainfo0v5 mediainfo libzen0v5 \ + && docker-php-ext-install \ + bcmath \ + exif \ + gd \ + intl \ + pdo_mysql \ + sockets \ + pcntl \ + && pecl install redis \ + && docker-php-ext-enable redis \ + && apt clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +# Determine ARCH and download and extract the appropriate version of 7-Zip +RUN ARCH="$(dpkg --print-architecture)" && \ + if [ "$ARCH" = "amd64" ]; then \ + SZIP_URL="https://www.7-zip.org/a/7z$SEVENZIP_VERSION-linux-x64.tar.xz"; \ + fi && \ + if [ "$ARCH" = "arm64" ]; then \ + SZIP_URL="https://www.7-zip.org/a/7z$SEVENZIP_VERSION-linux-arm64.tar.xz"; \ + fi && \ + wget "$SZIP_URL" -O /tmp/7z.tar.xz && \ + tar -xf /tmp/7z.tar.xz -C /tmp/ && \ + mv /tmp/7zz /usr/bin/7zz && \ + rm -f /tmp/7z.tar.xz && rm -f /tmp/7zzs + +RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" + +RUN npm install -g bun pnpm + +COPY --chmod=755 ./docker-entrypoint.sh /usr/local/bin/docker-entrypoint +RUN chmod +x /usr/local/bin/docker-entrypoint + +COPY . /app + +RUN composer install + +RUN chmod -R 755 /app/vendor/ +RUN chmod -R 777 /app/storage/ +RUN chmod -R 777 /app/resources/ +RUN chmod -R 777 /app/public/ + +EXPOSE 80 + +CMD ["--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"] +ENTRYPOINT ["docker-entrypoint"] + + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..d1a065b28 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,188 @@ +services: + webapp: + build: + context: . + dockerfile: Dockerfile + image: sail-8.3/app + extra_hosts: + - 'host.docker.internal:host-gateway' + ports: + - '${APP_PORT:-80}:80' + environment: + TZ: ${APP_TIMEZONE} + COMPOSER_AUTH: ${COMPOSER_AUTH} + XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' + XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' + IGNITION_LOCAL_SITES_PATH: '${PWD}' + healthcheck: + test: [ "CMD", "curl", "-f", "http://localhost:80" ] + interval: 10s + timeout: 5s + retries: 5 + env_file: + - .env + volumes: + - 'install:/app/_install' + - 'storage:/app/storage' +# - 'resources:/var/www/html/resources' + networks: + - sail + depends_on: + - mariadb + - redis + - mailpit + - elasticsearch + worker: + command: > + sh -c "php artisan tmux-ui:start & php artisan horizon" + image: sail-8.3/app + extra_hosts: + - 'host.docker.internal:host-gateway' + tty: true + environment: + TZ: ${APP_TIMEZONE} + COMPOSER_AUTH: ${COMPOSER_AUTH} + XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' + XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' + IGNITION_LOCAL_SITES_PATH: '${PWD}' + env_file: + - .env + volumes: + - 'install:/app/_install' + - 'storage:/app/storage' + networks: + - sail + depends_on: + webapp: + condition: service_healthy + scheduler: + image: sail-8.3/app + extra_hosts: + - 'host.docker.internal:host-gateway' + tty: true + env_file: + - .env + environment: + TZ: ${APP_TIMEZONE} + COMPOSER_AUTH: ${COMPOSER_AUTH} + XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' + XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' + IGNITION_LOCAL_SITES_PATH: '${PWD}' + volumes: + - 'install:/app/_install' + - 'storage:/app/storage' + networks: + - sail + depends_on: + webapp: + condition: service_healthy + command: > + sh -c "while [ true ]; do php artisan schedule:run; sleep 60; done" + mariadb: + image: 'mariadb:11' + ports: + - '${FORWARD_DB_PORT:-3306}:3306' + environment: + TZ: ${APP_TIMEZONE} + MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' + MYSQL_ROOT_HOST: '%' + MYSQL_DATABASE: '${DB_DATABASE}' + MYSQL_USER: '${DB_USERNAME}' + MYSQL_PASSWORD: '${DB_PASSWORD}' + MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' + command: + --max_allowed_packet=128M + --group_concat_max_len=16384 + --max_connections=200 + volumes: + - 'sail-mariadb:/var/lib/mysql' + - './vendor/laravel/sail/database/mariadb/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh' + networks: + - sail + healthcheck: + test: + - CMD + - mysqladmin + - ping + - '-p${DB_PASSWORD}' + retries: 3 + timeout: 5s + redis: + image: 'redis:alpine' + ports: + - '${FORWARD_REDIS_PORT:-6379}:6379' + environment: + TZ: ${APP_TIMEZONE} + volumes: + - 'sail-redis:/data' + networks: + - sail + healthcheck: + test: + - CMD + - redis-cli + - ping + retries: 3 + timeout: 5s + mailpit: + image: 'axllent/mailpit:latest' + ports: + - '${FORWARD_MAILPIT_PORT:-1025}:1025' + - '${FORWARD_MAILPIT_DASHBOARD_PORT:-8025}:8025' + networks: + - sail +# manticore: +# image: manticoresearch/manticore +# environment: +# TZ: ${APP_TIMEZONE} +# EXTRA: 1 # Activates extra features +# restart: always +# ports: +# - 9306:9306 +# - 9308:9308 +# ulimits: +# nproc: 65535 +# nofile: +# soft: 65535 +# hard: 65535 +# memlock: +# soft: -1 +# hard: -1 +# volumes: +# - 'sail-manticore:/var/lib/manticore' +# - ./misc/manticoresearch/manticore.conf:/etc/manticoresearch/manticore.conf # uncomment if you use a custom config +# networks: +# - sail + elasticsearch: + image: docker.elastic.co/elasticsearch/elasticsearch:8.17.0 + environment: + - TZ=${APP_TIMEZONE} + - discovery.type=single-node + - xpack.security.enabled=false + - "ES_JAVA_OPTS=-Xms512m -Xmx512m" + ports: + - 9200:9200 + - 9300:9300 + volumes: + - sail-elasticsearch:/usr/share/elasticsearch/data + networks: + - sail + deploy: + resources: + limits: + memory: 1g +networks: + sail: + driver: bridge +volumes: + sail-mariadb: + driver: local + sail-redis: + driver: local + sail-manticore: + driver: local + sail-elasticsearch: + driver: local + storage: + resources: + install: diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 000000000..545546c73 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,60 @@ +#!/bin/sh +set -e +if [ "$1" != 'php' ] && [ "$1" != 'sh' ]; then + # Install dependencies if not already installed + if [ ! -d 'vendor/' ]; then + echo "Installing dependencies via Composer..." + composer install --prefer-dist --no-progress --no-interaction + fi + + # Create .env file if it doesn't exist + if [ ! -f .env ]; then + echo "Creating .env file from environment variables..." + printenv >> .env + fi + + # Check and wait for the database to be ready + if grep -q ^DB_HOST= .env; then + echo "Waiting for the database to be ready..." + ATTEMPTS_LEFT_TO_REACH_DATABASE=60 + until [ $ATTEMPTS_LEFT_TO_REACH_DATABASE -eq 0 ] || DATABASE_ERROR=$(php artisan db:show 2>&1); do + if [ $? -ne 0 ]; then + # Stop attempting in case of an error + ATTEMPTS_LEFT_TO_REACH_DATABASE=$((ATTEMPTS_LEFT_TO_REACH_DATABASE - 1)) + echo "Database not ready yet. Attempts left: $ATTEMPTS_LEFT_TO_REACH_DATABASE." + sleep 1 + else + break + fi + done + + if [ $ATTEMPTS_LEFT_TO_REACH_DATABASE -eq 0 ]; then + echo "Failed to connect to the database:" + echo "$DATABASE_ERROR" + exit 1 + else + echo "Database is now ready." + fi + fi + + echo "Clearing application cache..." + php artisan cache:clear + php artisan config:clear + php artisan route:clear + php artisan view:clear + + echo "Caching configuration and routes..." + php artisan config:cache + php artisan route:cache + + # Run Laravel-specific post-installation commands + echo "NNTmux installation..." + php artisan nntmux:install --yes + # Set permissions for storage and bootstrap/cache directories + echo "Setting permissions on storage and bootstrap/cache directories..." + chmod -R 775 storage bootstrap/cache + chown -R www-data:www-data storage bootstrap/cache +fi + +# Run the PHP entry point with arguments +exec docker-php-entrypoint "$@" From 5a7ab285130491d96a27e1e972556ad58bb80846 Mon Sep 17 00:00:00 2001 From: PyRowMan <> Date: Wed, 18 Dec 2024 10:57:10 +0100 Subject: [PATCH 04/16] Refactor Docker setup to clean up dependencies and configs Removed unnecessary packages, environment variables, and Sail-specific configurations. Replaced "sail" with "nntmux" for images, networks, and volumes. Simplified the setup by removing unused tests and redundant configurations. --- Dockerfile | 7 ++-- docker-compose.yml | 85 +++++++++++++--------------------------------- 2 files changed, 26 insertions(+), 66 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2780b8cbc..68ddd5112 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ RUN apt update \ && apt install -y --no-install-recommends \ unrar-free 7zip lame libcap2-bin python3 \ curl zip unzip git nano bash-completion sudo wget tmux time fonts-powerline \ - gnupg sqlite3 libpng-dev dnsutils jq htop iputils-ping net-tools ffmpeg \ + gnupg libpng-dev dnsutils jq htop iputils-ping net-tools ffmpeg \ jpegoptim webp optipng pngquant libavif-bin watch iproute2 nmon \ libonig-dev libxml2-dev libicu-dev libjpeg-dev libfreetype6-dev libxslt-dev $MYSQL_CLIENT libcurl4-openssl-dev \ && wget https://mediaarea.net/repo/deb/repo-mediaarea_1.0-24_all.deb \ @@ -51,13 +51,12 @@ RUN ARCH="$(dpkg --print-architecture)" && \ RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" -RUN npm install -g bun pnpm - COPY --chmod=755 ./docker-entrypoint.sh /usr/local/bin/docker-entrypoint -RUN chmod +x /usr/local/bin/docker-entrypoint COPY . /app +RUN rm -Rf tests/ + RUN composer install RUN chmod -R 755 /app/vendor/ diff --git a/docker-compose.yml b/docker-compose.yml index d1a065b28..28d872d92 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,17 +3,13 @@ services: build: context: . dockerfile: Dockerfile - image: sail-8.3/app + image: nntmux extra_hosts: - 'host.docker.internal:host-gateway' ports: - '${APP_PORT:-80}:80' environment: TZ: ${APP_TIMEZONE} - COMPOSER_AUTH: ${COMPOSER_AUTH} - XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' - XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' - IGNITION_LOCAL_SITES_PATH: '${PWD}' healthcheck: test: [ "CMD", "curl", "-f", "http://localhost:80" ] interval: 10s @@ -26,7 +22,7 @@ services: - 'storage:/app/storage' # - 'resources:/var/www/html/resources' networks: - - sail + - nntmux depends_on: - mariadb - redis @@ -35,28 +31,24 @@ services: worker: command: > sh -c "php artisan tmux-ui:start & php artisan horizon" - image: sail-8.3/app + image: nntmux extra_hosts: - 'host.docker.internal:host-gateway' tty: true environment: TZ: ${APP_TIMEZONE} - COMPOSER_AUTH: ${COMPOSER_AUTH} - XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' - XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' - IGNITION_LOCAL_SITES_PATH: '${PWD}' env_file: - .env volumes: - 'install:/app/_install' - 'storage:/app/storage' networks: - - sail + - nntmux depends_on: webapp: condition: service_healthy scheduler: - image: sail-8.3/app + image: nntmux extra_hosts: - 'host.docker.internal:host-gateway' tty: true @@ -64,15 +56,11 @@ services: - .env environment: TZ: ${APP_TIMEZONE} - COMPOSER_AUTH: ${COMPOSER_AUTH} - XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' - XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' - IGNITION_LOCAL_SITES_PATH: '${PWD}' volumes: - 'install:/app/_install' - 'storage:/app/storage' networks: - - sail + - nntmux depends_on: webapp: condition: service_healthy @@ -95,10 +83,10 @@ services: --group_concat_max_len=16384 --max_connections=200 volumes: - - 'sail-mariadb:/var/lib/mysql' + - 'mariadb:/var/lib/mysql' - './vendor/laravel/sail/database/mariadb/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh' networks: - - sail + - nntmux healthcheck: test: - CMD @@ -114,14 +102,14 @@ services: environment: TZ: ${APP_TIMEZONE} volumes: - - 'sail-redis:/data' + - 'redis:/data' networks: - - sail + - nntmux healthcheck: test: - - CMD - - redis-cli - - ping + - CMD + - redis-cli + - ping retries: 3 timeout: 5s mailpit: @@ -130,29 +118,7 @@ services: - '${FORWARD_MAILPIT_PORT:-1025}:1025' - '${FORWARD_MAILPIT_DASHBOARD_PORT:-8025}:8025' networks: - - sail -# manticore: -# image: manticoresearch/manticore -# environment: -# TZ: ${APP_TIMEZONE} -# EXTRA: 1 # Activates extra features -# restart: always -# ports: -# - 9306:9306 -# - 9308:9308 -# ulimits: -# nproc: 65535 -# nofile: -# soft: 65535 -# hard: 65535 -# memlock: -# soft: -1 -# hard: -1 -# volumes: -# - 'sail-manticore:/var/lib/manticore' -# - ./misc/manticoresearch/manticore.conf:/etc/manticoresearch/manticore.conf # uncomment if you use a custom config -# networks: -# - sail + - nntmux elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:8.17.0 environment: @@ -164,25 +130,20 @@ services: - 9200:9200 - 9300:9300 volumes: - - sail-elasticsearch:/usr/share/elasticsearch/data + - elasticsearch networks: - - sail + - nntmux deploy: resources: limits: memory: 1g networks: - sail: + nntmux: driver: bridge volumes: - sail-mariadb: - driver: local - sail-redis: - driver: local - sail-manticore: - driver: local - sail-elasticsearch: - driver: local - storage: - resources: - install: + mariadb: + redis: + elasticsearch: + storage: + resources: + install: From 96b95dc6eea7501bff91e154883d892fedc5a7dc Mon Sep 17 00:00:00 2001 From: PyRowMan <> Date: Wed, 18 Dec 2024 12:01:54 +0100 Subject: [PATCH 05/16] Add `.env.dist`, Manticore service, and environment substitution Introduced a new `.env.dist` template to streamline environment variable management. Added Manticore service to the `docker-compose.yml` for enhanced database querying support. Updated `docker-entrypoint.sh` to use `envsubst` for environment substitution when generating `.env`. --- .env.dist | 208 +++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 5 +- docker-entrypoint.sh | 2 +- 3 files changed, 211 insertions(+), 4 deletions(-) create mode 100644 .env.dist diff --git a/.env.dist b/.env.dist new file mode 100644 index 000000000..1aca263d7 --- /dev/null +++ b/.env.dist @@ -0,0 +1,208 @@ +DB_CONNECTION=${DB_CONNECTION} +DB_HOST=${DB_HOST} +DB_PORT=${DB_PORT} +DB_ROOTPASSWORD=${DB_ROOTPASSWORD} +DB_SOCKET=${DB_SOCKET} +DB_USERNAME=${DB_USERNAME} +DB_PASSWORD=${DB_PASSWORD} +DB_DATABASE=${DB_DATABASE} + +COMPOSER_AUTH='${COMPOSER_AUTH}' + +MANTICORESEARCH_HOST=${MANTICORESEARCH_HOST} +MANTICORESEARCH_PORT=${MANTICORESEARCH_PORT} + +ELASTICSEARCH_HOST=${ELASTICSEARCH_HOST} +ELASTICSEARCH_PORT=${ELASTICSEARCH_PORT} +ELASTICSEARCH_SCHEME=${ELASTICSEARCH_SCHEME} +ELASTICSEARCH_USER=${ELASTICSEARCH_USER} +ELASTICSEARCH_PASS=${ELASTICSEARCH_PASS} +ELASTICSEARCH_LOGGING=${ELASTICSEARCH_LOGGING} +ELASTICSEARCH_ENABLED=${ELASTICSEARCH_ENABLED} + +NNTP_COMPRESSED_HEADERS=${NNTP_COMPRESSED_HEADERS} +USE_ALTERNATE_NNTP_SERVER=${USE_ALTERNATE_NNTP_SERVER} + +NNTP_USERNAME=${NNTP_USERNAME} +NNTP_PASSWORD=${NNTP_PASSWORD} +NNTP_SERVER=${NNTP_SERVER} +NNTP_PORT=${NNTP_PORT} +NNTP_CONNECTIONS=${NNTP_CONNECTIONS} +NNTP_SSLENABLED=${NNTP_SSLENABLED} +NNTP_SOCKET_TIMEOUT=${NNTP_SOCKET_TIMEOUT} + +NNTP_USERNAME_A=${NNTP_USERNAME_A} +NNTP_PASSWORD_A=${NNTP_PASSWORD_A} +NNTP_SERVER_A=${NNTP_SERVER_A} +NNTP_PORT_A=${NNTP_PORT_A} +NNTP_CONNECTIONS_A=${NNTP_CONNECTIONS_A} +NNTP_SSLENABLED_A=${NNTP_SSLENABLED_A} +NNTP_SOCKET_TIMEOUT_A=${NNTP_SOCKET_TIMEOUT_A} + +NN_MULTIPROCESSING_MAX_CHILD_TIME=${NN_MULTIPROCESSING_MAX_CHILD_TIME} + +ADMIN_USER=${ADMIN_USER} +ADMIN_PASS=${ADMIN_PASS} +ADMIN_EMAIL=${ADMIN_EMAIL} + +APP_NAME=${APP_NAME} +APP_ENV=${APP_ENV} +APP_DEBUG=${APP_DEBUG} +APP_TIMEZONE=${APP_TIMEZONE} +APP_URL=${APP_URL} + +APP_LOCALE=${APP_LOCALE} +APP_FALLBACK_LOCALE=${APP_FALLBACK_LOCALE} +APP_FAKER_LOCALE=${APP_FAKER_LOCALE} + +APP_MAINTENANCE_DRIVER=${APP_MAINTENANCE_DRIVER} +APP_MAINTENANCE_STORE=${APP_MAINTENANCE_STORE} + +BCRYPT_ROUNDS=${BCRYPT_ROUNDS} +APP_KEY=${APP_KEY} +LOG_CHANNEL=${LOG_CHANNEL} +LOG_STACK=${LOG_STACK} +PASSWORD_HASH=${PASSWORD_HASH} + +BROADCAST_CONNECTION=${BROADCAST_CONNECTION} +CACHE_STORE=${CACHE_STORE} +QUEUE_CONNECTION=${QUEUE_CONNECTION} + +REDIS_HOST=${REDIS_HOST} +REDIS_PASSWORD=${REDIS_PASSWORD} +REDIS_PORT=${REDIS_PORT} +REDIS_CLIENT=${REDIS_CLIENT} + +SESSION_DRIVER=${SESSION_DRIVER} +SESSION_DOMAIN=${SESSION_DOMAIN} +SESSION_SECURE_COOKIE=${SESSION_SECURE_COOKIE} +SESSION_ENCRYPT=${SESSION_ENCRYPT} +SESSION_COOKIE=${SESSION_COOKIE} +SESSION_PATH=${SESSION_PATH} + +MAIL_DRIVER=${MAIL_DRIVER} +MAIL_HOST=${MAIL_HOST} +MAIL_PORT=${MAIL_PORT} +MAIL_USERNAME=${MAIL_USERNAME} +MAIL_PASSWORD=${MAIL_PASSWORD} +MAIL_ENCRYPTION=${MAIL_ENCRYPTION} +MAIL_FROM_ADDRESS=${MAIL_FROM_ADDRESS} +MAIL_FROM_NAME=${MAIL_FROM_NAME} + +AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} +AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} +AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION} +AWS_BUCKET=${AWS_BUCKET} + +PUSHER_APP_ID=${PUSHER_APP_ID} +PUSHER_APP_KEY=${PUSHER_APP_KEY} +PUSHER_APP_SECRET=${PUSHER_APP_SECRET} +PUSHER_APP_CLUSTER=${PUSHER_APP_CLUSTER} + +MIX_PUSHER_APP_KEY=${PUSHER_APP_KEY} +MIX_PUSHER_APP_CLUSTER=${PUSHER_APP_CLUSTER} + +NOCAPTCHA_ENABLED=${NOCAPTCHA_ENABLED} +NOCAPTCHA_SITEKEY=${NOCAPTCHA_SITEKEY} +NOCAPTCHA_SECRET=${NOCAPTCHA_SECRET} + +SCOUT_DRIVER=${SCOUT_DRIVER} +SCOUT_QUEUE=${SCOUT_QUEUE} + +ITEMS_PER_PAGE=${ITEMS_PER_PAGE} +ITEMS_PER_COVER_PAGE=${ITEMS_PER_COVER_PAGE} +MAX_PAGER_RESULTS=${MAX_PAGER_RESULTS} +ECHOCLI=${ECHOCLI} +RENAME_PAR2=${RENAME_PAR2} +ADD_PAR2=${ADD_PAR2} +RENAME_MUSIC_MEDIAINFO=${RENAME_MUSIC_MEDIAINFO} +CACHE_EXPIRY_SHORT=${CACHE_EXPIRY_SHORT} +CACHE_EXPIRY_MEDIUM=${CACHE_EXPIRY_MEDIUM} +CACHE_EXPIRY_LONG=${CACHE_EXPIRY_LONG} + +SSL_CAFILE=${SSL_CAFILE} +SSL_CAPATH=${SSL_CAPATH} +SSL_VERIFY_PEER=${SSL_VERIFY_PEER} +SSL_VERIFY_HOST=${SSL_VERIFY_HOST} +SSL_ALLOW_SELF_SIGNED=${SSL_ALLOW_SELF_SIGNED} + +SCRAPE_IRC_USERNAME=${SCRAPE_IRC_USERNAME} +SCRAPE_IRC_SERVER=${SCRAPE_IRC_SERVER} +SCRAPE_IRC_PORT=${SCRAPE_IRC_PORT} +SCRAPE_IRC_TLS=${SCRAPE_IRC_TLS} +SCRAPE_IRC_PASSWORD=${SCRAPE_IRC_PASSWORD} + +SMARTY_DEBUG=${SMARTY_DEBUG} +SMARTY_CACHING=${SMARTY_CACHING} +SMARTY_CACHE_LIFE=${SMARTY_CACHE_LIFE} +SMARTY_COMPILE_CHECK=${SMARTY_COMPILE_CHECK} +SMARTY_FORCE_COMPILE=${SMARTY_FORCE_COMPILE} +SMARTY_CACHE_DRIVER=${SMARTY_CACHE_DRIVER} + +TWITCH_CLIENT_ID=${TWITCH_CLIENT_ID} +TWITCH_CLIENT_SECRET=${TWITCH_CLIENT_SECRET} +IGDB_CACHE_LIFETIME=${IGDB_CACHE_LIFETIME} +TMDB_APIKEY=${TMDB_APIKEY} +TMDB_CACHE=${TMDB_CACHE} +TMDB_LOG=${TMDB_LOG} +TVDB_APIKEY=${TVDB_APIKEY} +TVDB_PIN=${TVDB_PIN} +GIANTBOMB_APIKEY=${GIANTBOMB_APIKEY} +ANIDB_APIKEY=${ANIDB_APIKEY} +FANARTTV_APIKEY=${FANARTTV_APIKEY} +OMDB_APIKEY=${OMDB_APIKEY} +TRAKTTV_APIKEY=${TRAKTTV_APIKEY} + +TEMP_UNRAR_PATH=${TEMP_UNRAR_PATH} +TEMP_UNZIP_PATH=${TEMP_UNZIP_PATH} + +VIEW_COMPILED_PATH=${VIEW_COMPILED_PATH} +ASSET_URL=${ASSET_URL} + +TELESCOPE_DRIVER=${TELESCOPE_DRIVER} +TELESCOPE_ENABLED=${TELESCOPE_ENABLED} +TELESCOPE_FULL_IN_PRODUCTION=${TELESCOPE_FULL_IN_PRODUCTION} +TELESCOPE_CACHE_WATCHER=${TELESCOPE_CACHE_WATCHER} +TELESCOPE_COMMAND_WATCHER=${TELESCOPE_COMMAND_WATCHER} +TELESCOPE_DUMP_WATCHER=${TELESCOPE_DUMP_WATCHER} +TELESCOPE_EVENT_WATCHER=${TELESCOPE_EVENT_WATCHER} +TELESCOPE_EXCEPTION_WATCHER=${TELESCOPE_EXCEPTION_WATCHER} +TELESCOPE_JOB_WATCHER=${TELESCOPE_JOB_WATCHER} +TELESCOPE_LOG_WATCHER=${TELESCOPE_LOG_WATCHER} +TELESCOPE_MAIL_WATCHER=${TELESCOPE_MAIL_WATCHER} +TELESCOPE_MODEL_WATCHER=${TELESCOPE_MODEL_WATCHER} +TELESCOPE_NOTIFICATION_WATCHER=${TELESCOPE_NOTIFICATION_WATCHER} +TELESCOPE_QUERY_WATCHER=${TELESCOPE_QUERY_WATCHER} +TELESCOPE_REDIS_WATCHER=${TELESCOPE_REDIS_WATCHER} +TELESCOPE_REQUEST_WATCHER=${TELESCOPE_REQUEST_WATCHER} +TELESCOPE_RESPONSE_SIZE_LIMIT=${TELESCOPE_RESPONSE_SIZE_LIMIT} +TELESCOPE_GATE_WATCHER=${TELESCOPE_GATE_WATCHER} +TELESCOPE_SCHEDULE_WATCHER=${TELESCOPE_SCHEDULE_WATCHER} + +HORIZON_PREFIX=${HORIZON_PREFIX} + +POSTMARK_TOKEN=${POSTMARK_TOKEN} + +PURGE_INACTIVE_USERS=${PURGE_INACTIVE_USERS} + +OTP_ENABLED=${OTP_ENABLED} + +FLARE_KEY=${FLARE_KEY} + +UNRAR_PATH=${UNRAR_PATH} +UNZIP_PATH=${UNZIP_PATH} +CHECK_PASSWORDED_RARS=${CHECK_PASSWORDED_RARS} +DELETE_PASSWORDED_RELEASES=${DELETE_PASSWORDED_RELEASES} +DELETE_POSSIBLE_PASSWORDED_RELEASES=${DELETE_POSSIBLE_PASSWORDED_RELEASES} +EXTRACT_USING_RARINFO=${EXTRACT_USING_RARINFO} +PATH_TO_NZBS=${PATH_TO_NZBS} +PRIVATE_PROFILES=${PRIVATE_PROFILES} +STORE_USER_IP=${STORE_USER_IP} +FFMPEG_PATH=${FFMPEG_PATH} +LAME_PATH=${LAME_PATH} +MEDIAINFO_PATH=${MEDIAINFO_PATH} +TIIMEOUT_PATH=${TIIMEOUT_PATH} +MAGIC_FILE_PATH=${MAGIC_FILE_PATH} +COVERS_PATH=${COVERS_PATH} + +FORUM_FRONTEND_ENABLED=${FORUM_FRONTEND_ENABLED} diff --git a/Dockerfile b/Dockerfile index 68ddd5112..e085099df 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,7 @@ FROM composer:latest AS composer-base -#FROM php:8.3-fpm AS php-base FROM dunglas/frankenphp:1-php8.3 -LABEL maintainer="Fossil01" +LABEL maintainer="PyRowMan" ENV SERVER_NAME=:80 ARG MYSQL_CLIENT="mariadb-client" ARG SEVENZIP_VERSION=2407 @@ -15,7 +14,7 @@ COPY --from=composer-base --link /usr/bin/composer /usr/bin/composer RUN apt update \ && apt install -y --no-install-recommends \ - unrar-free 7zip lame libcap2-bin python3 \ + unrar-free 7zip lame libcap2-bin python3 gettext-base \ curl zip unzip git nano bash-completion sudo wget tmux time fonts-powerline \ gnupg libpng-dev dnsutils jq htop iputils-ping net-tools ffmpeg \ jpegoptim webp optipng pngquant libavif-bin watch iproute2 nmon \ diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 545546c73..d4c3fad89 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -10,7 +10,7 @@ if [ "$1" != 'php' ] && [ "$1" != 'sh' ]; then # Create .env file if it doesn't exist if [ ! -f .env ]; then echo "Creating .env file from environment variables..." - printenv >> .env + envsubst < .env.dist > .env fi # Check and wait for the database to be ready From 0142267f2704d2f9fe5d51f383b25b145d17f905 Mon Sep 17 00:00:00 2001 From: PyRowMan <> Date: Wed, 18 Dec 2024 12:02:02 +0100 Subject: [PATCH 06/16] Add Manticore service to docker-compose.yml Integrates Manticore search as a new service in the Docker Compose configuration. Configures ports, environment variables, resource limits, and volume mapping for Manticore. Ensures compatibility with the existing network and infrastructure. --- docker-compose.yml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 28d872d92..68a05cc74 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,6 +28,7 @@ services: - redis - mailpit - elasticsearch + - manticore worker: command: > sh -c "php artisan tmux-ui:start & php artisan horizon" @@ -112,6 +113,28 @@ services: - ping retries: 3 timeout: 5s + manticore: + image: manticoresearch/manticore + environment: + TZ: ${APP_TIMEZONE} + EXTRA: 1 # Activates extra features + restart: always + ports: + - 9306:9306 + - 9308:9308 + ulimits: + nproc: 65535 + nofile: + soft: 65535 + hard: 65535 + memlock: + soft: -1 + hard: -1 + volumes: + - 'manticore:/var/lib/manticore' +# - ./misc/manticoresearch/manticore.conf:/etc/manticoresearch/manticore.conf + networks: + - nntmux mailpit: image: 'axllent/mailpit:latest' ports: @@ -130,7 +153,7 @@ services: - 9200:9200 - 9300:9300 volumes: - - elasticsearch + - elasticsearch:/usr/share/elasticsearch/data networks: - nntmux deploy: @@ -144,6 +167,7 @@ volumes: mariadb: redis: elasticsearch: + manticore: storage: resources: install: From cbf63acc6bf991486072c9685534edbf6152f471 Mon Sep 17 00:00:00 2001 From: vcorre Date: Thu, 19 Dec 2024 12:36:59 +0100 Subject: [PATCH 07/16] Refactor .env file creation in docker entrypoint Moved .env file creation logic to execute earlier in the script for better clarity and structure. Ensures .env is generated before running subsequent commands, improving maintainability. --- docker-entrypoint.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index d4c3fad89..57dbb588a 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,5 +1,10 @@ #!/bin/sh set -e +# Create .env file if it doesn't exist +if [ ! -f .env ]; then + echo "Creating .env file from environment variables..." + envsubst < .env.dist > .env +fi if [ "$1" != 'php' ] && [ "$1" != 'sh' ]; then # Install dependencies if not already installed if [ ! -d 'vendor/' ]; then @@ -7,11 +12,6 @@ if [ "$1" != 'php' ] && [ "$1" != 'sh' ]; then composer install --prefer-dist --no-progress --no-interaction fi - # Create .env file if it doesn't exist - if [ ! -f .env ]; then - echo "Creating .env file from environment variables..." - envsubst < .env.dist > .env - fi # Check and wait for the database to be ready if grep -q ^DB_HOST= .env; then From 93d64efe19fb6155aa74aff588b8cea9254a3c14 Mon Sep 17 00:00:00 2001 From: vcorre Date: Thu, 19 Dec 2024 14:23:47 +0100 Subject: [PATCH 08/16] Fix spacing issue in `docker-compose.yml` command block Removed an unnecessary space in the schedule runner command. This change ensures consistency in formatting and avoids potential errors during script execution. No functional behavior is affected. --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 68a05cc74..3ea2490fc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -66,7 +66,7 @@ services: webapp: condition: service_healthy command: > - sh -c "while [ true ]; do php artisan schedule:run; sleep 60; done" + sh -c "while [ true ]; do php artisan schedule:run; sleep 60;done" mariadb: image: 'mariadb:11' ports: From 0037ab6e73fe97a971e24b65c2954c8103172d4a Mon Sep 17 00:00:00 2001 From: vcorre Date: Thu, 19 Dec 2024 15:27:49 +0100 Subject: [PATCH 09/16] Add Elasticsearch index creation and population to entrypoint This update ensures the Elasticsearch indexes are created and populated during container startup. It improves initial setup automation by running relevant Artisan commands to handle data indexing and predb population seamlessly. --- docker-entrypoint.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 57dbb588a..51c2fa2ce 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -54,6 +54,9 @@ if [ "$1" != 'php' ] && [ "$1" != 'sh' ]; then echo "Setting permissions on storage and bootstrap/cache directories..." chmod -R 775 storage bootstrap/cache chown -R www-data:www-data storage bootstrap/cache + php artisan nntmux:create-es-indexes + php artisan nntmux:populate --elastic --releases + php artisan nntmux:populate --elastic --predb fi # Run the PHP entry point with arguments From 4b48429799eee51e087f6a8f1b68937072e2bb64 Mon Sep 17 00:00:00 2001 From: PyRowMan <> Date: Fri, 20 Dec 2024 11:54:37 +0100 Subject: [PATCH 10/16] Add conditional cache logic, folder creation, and PHP extensions Introduced a conditional check in the entrypoint script to only clear caches if the install lock is missing and added logic to create necessary folder structures. Updated Laravel-specific post-installation steps to include extended permission settings. Enhanced the Dockerfile by including the Imagick PHP extension and updated `.dockerignore` to exclude additional storage directories. --- .dockerignore | 2 ++ Dockerfile | 5 ++-- docker-entrypoint.sh | 58 ++++++++++++++++++++++++++++++-------------- 3 files changed, 45 insertions(+), 20 deletions(-) diff --git a/.dockerignore b/.dockerignore index d43e4e08b..c67b45e78 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,3 +3,5 @@ docker/mariadb-data docker/redis-data docker/manticore-data .env +storage/nzb +storage/covers diff --git a/Dockerfile b/Dockerfile index e085099df..5efd37e88 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,8 +22,9 @@ RUN apt update \ && wget https://mediaarea.net/repo/deb/repo-mediaarea_1.0-24_all.deb \ && dpkg -i repo-mediaarea_1.0-24_all.deb \ && apt update \ - && apt install -y libmediainfo0v5 mediainfo libzen0v5 \ - && docker-php-ext-install \ + && apt install -y libmediainfo0v5 mediainfo libzen0v5 +RUN install-php-extensions imagick/imagick@master +RUN docker-php-ext-install \ bcmath \ exif \ gd \ diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 51c2fa2ce..8f8ce5801 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -37,26 +37,48 @@ if [ "$1" != 'php' ] && [ "$1" != 'sh' ]; then fi fi - echo "Clearing application cache..." - php artisan cache:clear - php artisan config:clear - php artisan route:clear - php artisan view:clear + if [ ! -f '_install/install.lock' ]; then + echo "Clearing application cache..." + php artisan cache:clear + php artisan config:clear + php artisan route:clear + php artisan view:clear - echo "Caching configuration and routes..." - php artisan config:cache - php artisan route:cache + echo "Caching configuration and routes..." + php artisan config:cache + php artisan route:cache - # Run Laravel-specific post-installation commands - echo "NNTmux installation..." - php artisan nntmux:install --yes - # Set permissions for storage and bootstrap/cache directories - echo "Setting permissions on storage and bootstrap/cache directories..." - chmod -R 775 storage bootstrap/cache - chown -R www-data:www-data storage bootstrap/cache - php artisan nntmux:create-es-indexes - php artisan nntmux:populate --elastic --releases - php artisan nntmux:populate --elastic --predb + echo "Creating folders structure" + + mkdir -p /app/storage/public + mkdir -p /app/storage/covers/anime + mkdir -p /app/storage/covers/audio + mkdir -p /app/storage/covers/audiosample + mkdir -p /app/storage/covers/book + mkdir -p /app/storage/covers/console + mkdir -p /app/storage/covers/games + mkdir -p /app/storage/covers/movies + mkdir -p /app/storage/covers/music + mkdir -p /app/storage/covers/preview + mkdir -p /app/storage/covers/sample + mkdir -p /app/storage/covers/tvrage + mkdir -p /app/storage/covers/tvshows + mkdir -p /app/storage/covers/video + mkdir -p /app/storage/covers/xxx + mkdir -p /app/storage/nzb + + # Run Laravel-specific post-installation commands + echo "NNTmux installation..." + php artisan nntmux:install --yes + # Set permissions for storage and bootstrap/cache directories + echo "Setting permissions on storage and bootstrap/cache directories..." + chmod -R 775 bootstrap/cache + chmod -R 777 storage resources + chown -R www-data:www-data storage bootstrap/cache resources + php artisan nntmux:create-es-indexes + php artisan nntmux:populate --elastic --releases + php artisan nntmux:populate --elastic --predb + fi fi # Run the PHP entry point with arguments From acb5b29885621072ede0ae74b8c6c152dfe7b49f Mon Sep 17 00:00:00 2001 From: PyRowMan <> Date: Fri, 20 Dec 2024 12:26:05 +0100 Subject: [PATCH 11/16] Update Docker image references and improve install script setup --- docker-compose.yml | 6 +++--- docker-entrypoint.sh | 34 ++++++++++++++++++---------------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 3ea2490fc..76b4ac1c9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ services: build: context: . dockerfile: Dockerfile - image: nntmux + image: pyrowman/nntmux extra_hosts: - 'host.docker.internal:host-gateway' ports: @@ -32,7 +32,7 @@ services: worker: command: > sh -c "php artisan tmux-ui:start & php artisan horizon" - image: nntmux + image: pyrowman/nntmux extra_hosts: - 'host.docker.internal:host-gateway' tty: true @@ -49,7 +49,7 @@ services: webapp: condition: service_healthy scheduler: - image: nntmux + image: pyrowman/nntmux extra_hosts: - 'host.docker.internal:host-gateway' tty: true diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 8f8ce5801..ca6d3423b 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -38,19 +38,8 @@ if [ "$1" != 'php' ] && [ "$1" != 'sh' ]; then fi if [ ! -f '_install/install.lock' ]; then - echo "Clearing application cache..." - php artisan cache:clear - php artisan config:clear - php artisan route:clear - php artisan view:clear - - echo "Caching configuration and routes..." - php artisan config:cache - php artisan route:cache - echo "Creating folders structure" - - mkdir -p /app/storage/public + mkdir -p /app/storage/app/public mkdir -p /app/storage/covers/anime mkdir -p /app/storage/covers/audio mkdir -p /app/storage/covers/audiosample @@ -66,15 +55,28 @@ if [ "$1" != 'php' ] && [ "$1" != 'sh' ]; then mkdir -p /app/storage/covers/video mkdir -p /app/storage/covers/xxx mkdir -p /app/storage/nzb - - # Run Laravel-specific post-installation commands - echo "NNTmux installation..." - php artisan nntmux:install --yes # Set permissions for storage and bootstrap/cache directories echo "Setting permissions on storage and bootstrap/cache directories..." chmod -R 775 bootstrap/cache chmod -R 777 storage resources chown -R www-data:www-data storage bootstrap/cache resources + + echo "Clearing application cache..." + php artisan cache:clear + php artisan config:clear + php artisan route:clear + php artisan view:clear + + echo "Caching configuration and routes..." + php artisan config:cache + php artisan route:cache + + # Run Laravel-specific post-installation commands + echo "NNTmux installation..." + php artisan nntmux:install --yes + + #TODO: check if we selected manticore or elasticsearch + echo "Elasticsearch initialisation" php artisan nntmux:create-es-indexes php artisan nntmux:populate --elastic --releases php artisan nntmux:populate --elastic --predb From 546027af7a5abfc6e96af1b1ded5273bd1d30ffc Mon Sep 17 00:00:00 2001 From: PyRowMan <> Date: Fri, 20 Dec 2024 12:27:56 +0100 Subject: [PATCH 12/16] Update .gitignore to include .php-cs-fixer.cache Added .php-cs-fixer.cache to ignore list for better tooling support. --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index fea29a6d6..2a93f3a32 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ failed-login.log php_errors.log php-errors.log test.php +.php-cs-fixer.cache # Editor temp files *# @@ -39,4 +40,4 @@ node_modules/ # Stores VSCode versions used for testing VSCode extensions .vscode-test -/.phpunit.cache \ No newline at end of file +/.phpunit.cache From b0c5634e10f0995ca1ac65a9ccc99957a2cb9e63 Mon Sep 17 00:00:00 2001 From: PyRowMan <> Date: Fri, 20 Dec 2024 15:32:17 +0100 Subject: [PATCH 13/16] Moving environment variables into .env.dist and .env.example --- .env.dist | 20 +++++++++++--------- .env.example | 19 ++++++++++--------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/.env.dist b/.env.dist index 1aca263d7..453cfe43b 100644 --- a/.env.dist +++ b/.env.dist @@ -157,6 +157,16 @@ TEMP_UNRAR_PATH=${TEMP_UNRAR_PATH} TEMP_UNZIP_PATH=${TEMP_UNZIP_PATH} VIEW_COMPILED_PATH=${VIEW_COMPILED_PATH} +UNRAR_PATH=${UNRAR_PATH} +UNZIP_PATH=${UNZIP_PATH} +FFMPEG_PATH=${FFMPEG_PATH} +LAME_PATH=${LAME_PATH} +MEDIAINFO_PATH=${MEDIAINFO_PATH} +TIIMEOUT_PATH=${TIIMEOUT_PATH} +MAGIC_FILE_PATH=${MAGIC_FILE_PATH} +COVERS_PATH=${COVERS_PATH} +PATH_TO_NZBS=${PATH_TO_NZBS} + ASSET_URL=${ASSET_URL} TELESCOPE_DRIVER=${TELESCOPE_DRIVER} @@ -189,20 +199,12 @@ OTP_ENABLED=${OTP_ENABLED} FLARE_KEY=${FLARE_KEY} -UNRAR_PATH=${UNRAR_PATH} -UNZIP_PATH=${UNZIP_PATH} + CHECK_PASSWORDED_RARS=${CHECK_PASSWORDED_RARS} DELETE_PASSWORDED_RELEASES=${DELETE_PASSWORDED_RELEASES} DELETE_POSSIBLE_PASSWORDED_RELEASES=${DELETE_POSSIBLE_PASSWORDED_RELEASES} EXTRACT_USING_RARINFO=${EXTRACT_USING_RARINFO} -PATH_TO_NZBS=${PATH_TO_NZBS} PRIVATE_PROFILES=${PRIVATE_PROFILES} STORE_USER_IP=${STORE_USER_IP} -FFMPEG_PATH=${FFMPEG_PATH} -LAME_PATH=${LAME_PATH} -MEDIAINFO_PATH=${MEDIAINFO_PATH} -TIIMEOUT_PATH=${TIIMEOUT_PATH} -MAGIC_FILE_PATH=${MAGIC_FILE_PATH} -COVERS_PATH=${COVERS_PATH} FORUM_FRONTEND_ENABLED=${FORUM_FRONTEND_ENABLED} diff --git a/.env.example b/.env.example index 6a75a3572..bbdf538e4 100644 --- a/.env.example +++ b/.env.example @@ -157,6 +157,16 @@ TEMP_UNRAR_PATH='/var/www/nntmux/resources/tmp/unrar/' TEMP_UNZIP_PATH='/var/www/nntmux/resources/tmp/unzip/' VIEW_COMPILED_PATH=/var/www/NNTmux/storage/framework/views +UNRAR_PATH= +UNZIP_PATH= +PATH_TO_NZBS= +FFMPEG_PATH= +LAME_PATH= +MEDIAINFO_PATH= +TIIMEOUT_PATH= +MAGIC_FILE_PATH= +COVERS_PATH= + ASSET_URL= TELESCOPE_DRIVER=database @@ -189,20 +199,11 @@ OTP_ENABLED=false FLARE_KEY= -UNRAR_PATH= -UNZIP_PATH= CHECK_PASSWORDED_RARS=false DELETE_PASSWORDED_RELEASES=false DELETE_POSSIBLE_PASSWORDED_RELEASES=false EXTRACT_USING_RARINFO=false -PATH_TO_NZBS= PRIVATE_PROFILES=true STORE_USER_IP=false -FFMPEG_PATH= -LAME_PATH= -MEDIAINFO_PATH= -TIIMEOUT_PATH= -MAGIC_FILE_PATH= -COVERS_PATH= FORUM_FRONTEND_ENABLED=false From b084d479e9041f0bc21761b3c074d77d6e7cd0eb Mon Sep 17 00:00:00 2001 From: PyRowMan <> Date: Fri, 20 Dec 2024 15:32:37 +0100 Subject: [PATCH 14/16] Moving environment variables into .env.dist and .env.example --- .env.dist | 1 - 1 file changed, 1 deletion(-) diff --git a/.env.dist b/.env.dist index 453cfe43b..1429c59d1 100644 --- a/.env.dist +++ b/.env.dist @@ -199,7 +199,6 @@ OTP_ENABLED=${OTP_ENABLED} FLARE_KEY=${FLARE_KEY} - CHECK_PASSWORDED_RARS=${CHECK_PASSWORDED_RARS} DELETE_PASSWORDED_RELEASES=${DELETE_PASSWORDED_RELEASES} DELETE_POSSIBLE_PASSWORDED_RELEASES=${DELETE_POSSIBLE_PASSWORDED_RELEASES} From 513a1ff281a2f6487dbc1d913a7f4a6f4ff8be46 Mon Sep 17 00:00:00 2001 From: PyRowMan <> Date: Fri, 20 Dec 2024 15:33:10 +0100 Subject: [PATCH 15/16] Add custom PHP configuration to Dockerfile --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 5efd37e88..b618848fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,6 +50,7 @@ RUN ARCH="$(dpkg --print-architecture)" && \ rm -f /tmp/7z.tar.xz && rm -f /tmp/7zzs RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" +COPY ./docker/8.3/php.ini "$PHP_INI_DIR/conf.d/custom-conf.ini" COPY --chmod=755 ./docker-entrypoint.sh /usr/local/bin/docker-entrypoint From fc060fd1dbff280da08fc366c02cf20b72feea87 Mon Sep 17 00:00:00 2001 From: PyRowMan <> Date: Fri, 20 Dec 2024 17:00:22 +0100 Subject: [PATCH 16/16] Refactor paths and add support for Manticore initialization --- docker-entrypoint.sh | 47 +++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index ca6d3423b..6e456e4d3 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -40,21 +40,23 @@ if [ "$1" != 'php' ] && [ "$1" != 'sh' ]; then if [ ! -f '_install/install.lock' ]; then echo "Creating folders structure" mkdir -p /app/storage/app/public - mkdir -p /app/storage/covers/anime - mkdir -p /app/storage/covers/audio - mkdir -p /app/storage/covers/audiosample - mkdir -p /app/storage/covers/book - mkdir -p /app/storage/covers/console - mkdir -p /app/storage/covers/games - mkdir -p /app/storage/covers/movies - mkdir -p /app/storage/covers/music - mkdir -p /app/storage/covers/preview - mkdir -p /app/storage/covers/sample - mkdir -p /app/storage/covers/tvrage - mkdir -p /app/storage/covers/tvshows - mkdir -p /app/storage/covers/video - mkdir -p /app/storage/covers/xxx - mkdir -p /app/storage/nzb + mkdir -p "$COVERS_PATH/anime" + mkdir -p "$COVERS_PATH/audio" + mkdir -p "$COVERS_PATH/audiosample" + mkdir -p "$COVERS_PATH/book" + mkdir -p "$COVERS_PATH/console" + mkdir -p "$COVERS_PATH/games" + mkdir -p "$COVERS_PATH/movies" + mkdir -p "$COVERS_PATH/music" + mkdir -p "$COVERS_PATH/preview" + mkdir -p "$COVERS_PATH/sample" + mkdir -p "$COVERS_PATH/tvrage" + mkdir -p "$COVERS_PATH/tvshows" + mkdir -p "$COVERS_PATH/video" + mkdir -p "$COVERS_PATH/xxx" + mkdir -p "$PATH_TO_NZBS" + mkdir -p "$TEMP_UNRAR_PATH" + mkdir -p "$TEMP_UNZIP_PATH" # Set permissions for storage and bootstrap/cache directories echo "Setting permissions on storage and bootstrap/cache directories..." chmod -R 775 bootstrap/cache @@ -75,11 +77,16 @@ if [ "$1" != 'php' ] && [ "$1" != 'sh' ]; then echo "NNTmux installation..." php artisan nntmux:install --yes - #TODO: check if we selected manticore or elasticsearch - echo "Elasticsearch initialisation" - php artisan nntmux:create-es-indexes - php artisan nntmux:populate --elastic --releases - php artisan nntmux:populate --elastic --predb + if [ "${ELASTICSEARCH_ENABLED}" == "true" ]; then + echo "Elasticsearch initialisation" + php artisan nntmux:create-es-indexes + php artisan nntmux:populate --elastic --releases + php artisan nntmux:populate --elastic --predb + else + echo "Manticore initialisation" + php artisan nntmux:populate --manticore --releases + php artisan nntmux:populate --manticore --predb + fi fi fi