NNTmux Docker Dev Environment
Author: Fossil01
Caution: This setup is intended solely for development use. For production deployments, it is recommended to construct your own Docker containers.
This development environment is composed of several key containers: App, MariaDB, Redis, Manticore, and Mailpit. The App container hosts nginx and PHP-FPM, and includes a bind mount that links to the root directory of this project. Supervisord is utilized to manage these services in the background.
For search capabilities, Manticore is the default setup, but you can easily switch to Elasticsearch by modifying the corresponding lines in the docker-compose.yml file. Note that Elasticsearch is configured with security features disabled by default.
This container also houses several tools to run the indexing backend: tmux, ffmpeg, mediainfo, unrar etc. It also has MariaDB & Postgres clients, NodeJS & Yarn.
nginx runs on port 80 and is mapped to port 80 on the host machine too. If you're already using port 80 then change the docker-compose.yml file accordingly.
Mailpit is used as a fake mailserver which catches all e-mails in one inbox. You can acess this via this link. Mailpit's SMTP server runs on port 1025.
This project currently uses PHP 8.4 and MariaDB 11.x
Prerequisites
- Docker & Docker Compose (Duh)
- Github (scopeless) Token
- Laravel Sail
Setup
- Edit your projects
.envfile and add aCOMPOSER_AUTHentry.- Get a Github token: https://github.com/settings/tokens/new?scopes=&description=NNTMux+Docker and set the expiration to No expiration
- Example:
COMPOSER_AUTH='{"github-oauth": {"github.com": "ghp_xxxxxxxx"}}'
sail build --no-cachesail up -d
You might have to edit your Laravel .env file:
DB_HOST=mariadb
MAIL_MAILER=smtp
MAIL_DRIVER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MANTICORESEARCH_HOST=manticore
ELASTICSEARCH_HOST=elasticsearch
Database
On first run MariaDB will create a user and password based on your projects .env file:
DB_USERNAME=
DB_PASSWORD=
You will need to manually import a SQL dump or run sail artisan nntmux:install if this is a new installation.
Networking
Sail will create a Docker network called sail with these ports mapped to your host:
- HTTP:
80 - Vite:
5173 - Manticore:
9306(SQL) &9308(HTTP) - Mailpit:
1025(SMTP) &8025(WebUI)
Backups
Optionally you can add this config to docker-compose.yml to have automated MariaDB backups. Just replace DATABASE_NAME with your own NNTmux database name.
backup:
image: fradelg/mysql-cron-backup
depends_on:
- mariadb
restart: always
volumes:
- ./docker/mariadb/backups:/backup
environment:
- MYSQL_USER=${DB_USERNAME}
- MYSQL_PASS=${DB_PASSWORD}
- MYSQL_DB=${DB_DATABASE}
- MYSQLDUMP_OPTS=--ignore-table=DATABASE_NAME.telescope_entries --ignore-table=DATABASE_NAME.telescope_entries_tags
- CRON_TIME=0 0 31 2 * # (To never run with cron use Feb 31st: 0 0 31 2 *)
- MYSQL_HOST=mariadb
- MYSQL_PORT=3306
- TIMEOUT=10s
- GZIP_LEVEL=9
- MAX_BACKUPS=5 # The number of backups to keep. When reaching the limit, the old backup will be discarded.
- INIT_BACKUP=0
- EXIT_BACKUP=1 # Make a backup whenever this container is gracefully stopped.
networks:
- sail