From cb62a0bae6f21ec8e06b948c5e8ebc324ca7957f Mon Sep 17 00:00:00 2001 From: Meghdad Date: Tue, 19 May 2026 20:25:15 +0330 Subject: [PATCH] replace dockerized to docker-bundle --- {dockerized => docker-bundle}/.dockerignore | 0 {dockerized => docker-bundle}/.env.example | 0 {dockerized => docker-bundle}/.gitignore | 0 {dockerized => docker-bundle}/README.md | 16 ++++---- {dockerized => docker-bundle}/SKILL.md | 18 ++++----- .../UBUNTU_VPS_NYONE_APP_DEPLOYMENT.md | 36 +++++++++--------- .../docker-compose.yml | 0 .../docker/app/Dockerfile | 0 .../docker/app/apache/nyone.conf.template | 0 .../docker/app/entrypoint.sh | 2 +- .../docker/app/php/production.ini | 0 .../docker/mediamtx/Dockerfile | 0 .../docker/mediamtx/entrypoint.sh | 2 +- .../docker/mediamtx/mediamtx.yml.template | 0 .../scripts/backup.sh | 38 +++++++++---------- .../scripts/deploy.sh | 0 16 files changed, 56 insertions(+), 56 deletions(-) rename {dockerized => docker-bundle}/.dockerignore (100%) rename {dockerized => docker-bundle}/.env.example (100%) rename {dockerized => docker-bundle}/.gitignore (100%) rename {dockerized => docker-bundle}/README.md (93%) rename {dockerized => docker-bundle}/SKILL.md (84%) rename {dockerized => docker-bundle}/UBUNTU_VPS_NYONE_APP_DEPLOYMENT.md (90%) rename {dockerized => docker-bundle}/docker-compose.yml (100%) rename {dockerized => docker-bundle}/docker/app/Dockerfile (100%) rename {dockerized => docker-bundle}/docker/app/apache/nyone.conf.template (100%) rename {dockerized => docker-bundle}/docker/app/entrypoint.sh (97%) rename {dockerized => docker-bundle}/docker/app/php/production.ini (100%) rename {dockerized => docker-bundle}/docker/mediamtx/Dockerfile (100%) rename {dockerized => docker-bundle}/docker/mediamtx/entrypoint.sh (88%) rename {dockerized => docker-bundle}/docker/mediamtx/mediamtx.yml.template (100%) rename {dockerized => docker-bundle}/scripts/backup.sh (91%) rename {dockerized => docker-bundle}/scripts/deploy.sh (100%) diff --git a/dockerized/.dockerignore b/docker-bundle/.dockerignore similarity index 100% rename from dockerized/.dockerignore rename to docker-bundle/.dockerignore diff --git a/dockerized/.env.example b/docker-bundle/.env.example similarity index 100% rename from dockerized/.env.example rename to docker-bundle/.env.example diff --git a/dockerized/.gitignore b/docker-bundle/.gitignore similarity index 100% rename from dockerized/.gitignore rename to docker-bundle/.gitignore diff --git a/dockerized/README.md b/docker-bundle/README.md similarity index 93% rename from dockerized/README.md rename to docker-bundle/README.md index 741a9d6..ec2047e 100644 --- a/dockerized/README.md +++ b/docker-bundle/README.md @@ -1,6 +1,6 @@ -# Nyone Dockerized Deployment +# Nyone Docker Bundle Deployment -This folder is a self-contained deployment bundle. A server only needs the `dockerized/` directory; the application repository is cloned later into `runtime/source` by `scripts/deploy.sh`. +This folder is a self-contained deployment bundle. A server only needs the `docker-bundle/` directory; the application repository is cloned later into `runtime/source` by `scripts/deploy.sh`. ## What It Runs @@ -38,7 +38,7 @@ If a host-level reverse proxy already uses port `80`, set `APP_HTTP_PORT` to ano ## First Deployment ```bash -cd dockerized +cd docker-bundle cp .env.example .env nano .env chmod +x scripts/deploy.sh @@ -71,7 +71,7 @@ The deploy script will: ## Runtime Configuration -This bundle does not use the cloned repository's `.env` file for production settings. Docker Compose passes configuration from `dockerized/.env` into the containers. +This bundle does not use the cloned repository's `.env` file for production settings. Docker Compose passes configuration from `docker-bundle/.env` into the containers. Important values: @@ -87,7 +87,7 @@ The MediaMTX config is Docker-owned at `docker/mediamtx/mediamtx.yml.template`; ## Operations -Run commands from the `dockerized/` directory. +Run commands from the `docker-bundle/` directory. ```bash docker compose --env-file .env -f docker-compose.yml ps @@ -123,7 +123,7 @@ Restore on a fresh server after installing Docker and Compose: unzip nyone-backup-YYYYMMDD-HHMMSS.zip cd nyone-backup-YYYYMMDD-HHMMSS chmod +x restore.sh -./restore.sh /opt/nyone/dockerized +./restore.sh /opt/nyone/docker-bundle ``` Stop the stack: @@ -155,7 +155,7 @@ RTMP_PUBLIC_PORT=1935 Run `./scripts/deploy.sh` after changing `.env`, then point Nginx at `http://127.0.0.1:8080`. Replace the example domains and certificate paths before enabling the config. ```nginx -# /etc/nginx/sites-available/nyone-dockerized.conf +# /etc/nginx/sites-available/nyone-docker-bundle.conf server { listen 80; @@ -223,7 +223,7 @@ server { Enable and validate on the server: ```bash -sudo ln -s /etc/nginx/sites-available/nyone-dockerized.conf /etc/nginx/sites-enabled/nyone-dockerized.conf +sudo ln -s /etc/nginx/sites-available/nyone-docker-bundle.conf /etc/nginx/sites-enabled/nyone-docker-bundle.conf sudo nginx -t sudo systemctl reload nginx ``` diff --git a/dockerized/SKILL.md b/docker-bundle/SKILL.md similarity index 84% rename from dockerized/SKILL.md rename to docker-bundle/SKILL.md index c25bdca..712337a 100644 --- a/dockerized/SKILL.md +++ b/docker-bundle/SKILL.md @@ -1,14 +1,14 @@ --- -name: dockerized-deployment -description: Work on the Nyone Dockerized deployment bundle under dockerized/. Use when modifying Docker Compose, Apache, MediaMTX, PostgreSQL, Redis, Laravel queue/scheduler/viewer-sync services, deploy.sh, deployment README files, or runtime environment defaults for this self-contained Docker deployment. +name: docker-bundle-deployment +description: Work on the Nyone docker-bundle deployment bundle under docker-bundle/. Use when modifying Docker Compose, Apache, MediaMTX, PostgreSQL, Redis, Laravel queue/scheduler/viewer-sync services, deploy.sh, deployment README files, or runtime environment defaults for this self-contained Docker deployment. --- -# Nyone Dockerized Deployment +# Nyone docker-bundle Deployment ## Core Rules -- Keep deployment changes inside `dockerized/` unless the user explicitly requests application code changes. -- Treat `dockerized/.env` and `dockerized/runtime/` as server-local generated state; do not commit or depend on them. +- Keep deployment changes inside `docker-bundle/` unless the user explicitly requests application code changes. +- Treat `docker-bundle/.env` and `docker-bundle/runtime/` as server-local generated state; do not commit or depend on them. - Do not make this bundle depend on the cloned app repository's `.env` or `deploy/mediamtx.yml`. - Keep MediaMTX config Docker-owned at `docker/mediamtx/mediamtx.yml.template`. - Keep `APP_DOMAIN` and `HLS_DOMAIN` separate because Apache uses separate virtual hosts. @@ -17,7 +17,7 @@ description: Work on the Nyone Dockerized deployment bundle under dockerized/. U ## Architecture - `scripts/deploy.sh` is the entrypoint for server deployment. -- `scripts/backup.sh` creates restore-ready zip backups for the Dockerized deployment. +- `scripts/backup.sh` creates restore-ready zip backups for the docker-bundle deployment. - `docker-compose.yml` defines `app`, `db`, `redis`, `mediamtx`, `queue`, `scheduler`, `viewer-sync`, and one-shot `migrate`. - `docker/app/Dockerfile` builds the Laravel Apache image from `runtime/source`. - `docker/app/entrypoint.sh` selects behavior by `CONTAINER_ROLE`. @@ -63,14 +63,14 @@ Use static checks when not on a deployment server: ```bash git diff --check -rg "1993[5]|1998[8]|80[8]0|25[2]5|nyone[.]net|nyone-hls[.]net|change-this-secre[t]" dockerized -n -bash -n dockerized/scripts/backup.sh +rg "1993[5]|1998[8]|80[8]0|25[2]5|nyone[.]net|nyone-hls[.]net|change-this-secre[t]" docker-bundle -n +bash -n docker-bundle/scripts/backup.sh ``` If Docker is available and the user allows non-deploy validation, validate only the Compose config: ```bash -docker compose --env-file dockerized/.env.example -f dockerized/docker-compose.yml config +docker compose --env-file docker-bundle/.env.example -f docker-bundle/docker-compose.yml config ``` Do not start containers during local verification unless the user explicitly asks for runtime testing. diff --git a/dockerized/UBUNTU_VPS_NYONE_APP_DEPLOYMENT.md b/docker-bundle/UBUNTU_VPS_NYONE_APP_DEPLOYMENT.md similarity index 90% rename from dockerized/UBUNTU_VPS_NYONE_APP_DEPLOYMENT.md rename to docker-bundle/UBUNTU_VPS_NYONE_APP_DEPLOYMENT.md index 4197a82..bb9e222 100644 --- a/dockerized/UBUNTU_VPS_NYONE_APP_DEPLOYMENT.md +++ b/docker-bundle/UBUNTU_VPS_NYONE_APP_DEPLOYMENT.md @@ -1,6 +1,6 @@ # Fresh Ubuntu VPS Deployment for nyone.app -This guide explains how to deploy Nyone from only the `dockerized/` folder on a fresh Ubuntu VPS. +This guide explains how to deploy Nyone from only the `docker-bundle/` folder on a fresh Ubuntu VPS. It assumes: @@ -10,7 +10,7 @@ It assumes: - Docker Apache is private on `127.0.0.1:8080` - Host Nginx handles public HTTP, HTTPS, and SSL certificates -The application repository itself does not need to exist on the server before deployment. The deploy script clones it into `dockerized/runtime/source`. +The application repository itself does not need to exist on the server before deployment. The deploy script clones it into `docker-bundle/runtime/source`. ## 1. Point DNS to the VPS @@ -92,7 +92,7 @@ systemctl enable --now docker docker run hello-world ``` -## 5. Copy only the dockerized folder to the server +## 5. Copy only the docker-bundle folder to the server Create the deployment directory on the VPS: @@ -103,24 +103,24 @@ mkdir -p /opt/nyone From your local machine, copy the folder: ```bash -rsync -av --exclude '.env' --exclude 'runtime' dockerized/ root@:/opt/nyone/dockerized/ +rsync -av --exclude '.env' --exclude 'runtime' docker-bundle/ root@:/opt/nyone/docker-bundle/ ``` Back on the VPS: ```bash -cd /opt/nyone/dockerized +cd /opt/nyone/docker-bundle cp .env.example .env chmod +x scripts/deploy.sh chmod +x scripts/backup.sh ``` -## 6. Configure dockerized/.env +## 6. Configure docker-bundle/.env Edit the Docker deployment environment: ```bash -nano /opt/nyone/dockerized/.env +nano /opt/nyone/docker-bundle/.env ``` Use these values for `nyone.app`: @@ -193,7 +193,7 @@ ssh -T git@github.com ## 7. Run the Docker deployment ```bash -cd /opt/nyone/dockerized +cd /opt/nyone/docker-bundle ./scripts/deploy.sh ``` @@ -369,7 +369,7 @@ curl -I https://nyone.app/up Check container status: ```bash -cd /opt/nyone/dockerized +cd /opt/nyone/docker-bundle docker compose --env-file .env -f docker-compose.yml ps ``` @@ -413,7 +413,7 @@ https://hls.nyone.app//index.m3u8 When the Git branch changes: ```bash -cd /opt/nyone/dockerized +cd /opt/nyone/docker-bundle ./scripts/deploy.sh ``` @@ -429,10 +429,10 @@ docker compose --env-file .env -f docker-compose.yml logs -f mediamtx ## 15. Create a restore-ready backup -Run backups from the Dockerized deployment directory: +Run backups from the docker-bundle deployment directory: ```bash -cd /opt/nyone/dockerized +cd /opt/nyone/docker-bundle ./scripts/backup.sh ``` @@ -445,10 +445,10 @@ For the safest storage and recording snapshot, use a maintenance window and stop The final archive is written to: ```text -/opt/nyone/dockerized/backups/nyone-backup-YYYYMMDD-HHMMSS.zip +/opt/nyone/docker-bundle/backups/nyone-backup-YYYYMMDD-HHMMSS.zip ``` -Copy that one zip file off the VPS. It contains the Dockerized deployment files, `.env`, source checkout, PostgreSQL dump, app storage, Redis data, checksums, restore notes, and a restore helper. +Copy that one zip file off the VPS. It contains the docker-bundle deployment files, `.env`, source checkout, PostgreSQL dump, app storage, Redis data, checksums, restore notes, and a restore helper. Restore on a fresh Ubuntu VPS after installing Docker and copying the zip: @@ -456,16 +456,16 @@ Restore on a fresh Ubuntu VPS after installing Docker and copying the zip: unzip nyone-backup-YYYYMMDD-HHMMSS.zip cd nyone-backup-YYYYMMDD-HHMMSS chmod +x restore.sh -./restore.sh /opt/nyone/dockerized +./restore.sh /opt/nyone/docker-bundle ``` -If `/opt/nyone/dockerized` already exists and you intentionally want to replace it: +If `/opt/nyone/docker-bundle` already exists and you intentionally want to replace it: ```bash -./restore.sh --replace /opt/nyone/dockerized +./restore.sh --replace /opt/nyone/docker-bundle ``` -Host-level Nginx files and Let's Encrypt certificates live outside `dockerized/`, so recreate or back them up separately. +Host-level Nginx files and Let's Encrypt certificates live outside `docker-bundle/`, so recreate or back them up separately. ## References diff --git a/dockerized/docker-compose.yml b/docker-bundle/docker-compose.yml similarity index 100% rename from dockerized/docker-compose.yml rename to docker-bundle/docker-compose.yml diff --git a/dockerized/docker/app/Dockerfile b/docker-bundle/docker/app/Dockerfile similarity index 100% rename from dockerized/docker/app/Dockerfile rename to docker-bundle/docker/app/Dockerfile diff --git a/dockerized/docker/app/apache/nyone.conf.template b/docker-bundle/docker/app/apache/nyone.conf.template similarity index 100% rename from dockerized/docker/app/apache/nyone.conf.template rename to docker-bundle/docker/app/apache/nyone.conf.template diff --git a/dockerized/docker/app/entrypoint.sh b/docker-bundle/docker/app/entrypoint.sh similarity index 97% rename from dockerized/docker/app/entrypoint.sh rename to docker-bundle/docker/app/entrypoint.sh index 0d9a480..e63f255 100644 --- a/dockerized/docker/app/entrypoint.sh +++ b/docker-bundle/docker/app/entrypoint.sh @@ -15,7 +15,7 @@ require_env() { local value="${!key:-}" if [[ -z "$value" || "$value" == "change-me"* || "$value" == "base64:change-me"* ]]; then - fail "$key is required. Run dockerized/scripts/deploy.sh or set it in dockerized/.env." + fail "$key is required. Run docker-bundle/scripts/deploy.sh or set it in docker-bundle/.env." fi } diff --git a/dockerized/docker/app/php/production.ini b/docker-bundle/docker/app/php/production.ini similarity index 100% rename from dockerized/docker/app/php/production.ini rename to docker-bundle/docker/app/php/production.ini diff --git a/dockerized/docker/mediamtx/Dockerfile b/docker-bundle/docker/mediamtx/Dockerfile similarity index 100% rename from dockerized/docker/mediamtx/Dockerfile rename to docker-bundle/docker/mediamtx/Dockerfile diff --git a/dockerized/docker/mediamtx/entrypoint.sh b/docker-bundle/docker/mediamtx/entrypoint.sh similarity index 88% rename from dockerized/docker/mediamtx/entrypoint.sh rename to docker-bundle/docker/mediamtx/entrypoint.sh index 44a086e..24fe033 100644 --- a/dockerized/docker/mediamtx/entrypoint.sh +++ b/docker-bundle/docker/mediamtx/entrypoint.sh @@ -7,7 +7,7 @@ fail() { } if [ -z "${MEDIAMTX_SHARED_SECRET:-}" ] || [ "${MEDIAMTX_SHARED_SECRET#change-me}" != "$MEDIAMTX_SHARED_SECRET" ]; then - fail "MEDIAMTX_SHARED_SECRET is required. Run dockerized/scripts/deploy.sh or set it in dockerized/.env." + fail "MEDIAMTX_SHARED_SECRET is required. Run docker-bundle/scripts/deploy.sh or set it in docker-bundle/.env." fi : "${APP_URL:?APP_URL is required.}" diff --git a/dockerized/docker/mediamtx/mediamtx.yml.template b/docker-bundle/docker/mediamtx/mediamtx.yml.template similarity index 100% rename from dockerized/docker/mediamtx/mediamtx.yml.template rename to docker-bundle/docker/mediamtx/mediamtx.yml.template diff --git a/dockerized/scripts/backup.sh b/docker-bundle/scripts/backup.sh similarity index 91% rename from dockerized/scripts/backup.sh rename to docker-bundle/scripts/backup.sh index ca078dc..f296f4c 100644 --- a/dockerized/scripts/backup.sh +++ b/docker-bundle/scripts/backup.sh @@ -31,14 +31,14 @@ Usage: scripts/backup.sh [options] Options: - --output-dir PATH Directory for the final zip file. Default: dockerized/backups + --output-dir PATH Directory for the final zip file. Default: docker-bundle/backups --name NAME Backup folder/zip base name. Default: nyone-backup-UTC_TIMESTAMP --stop-writers Stop app, MediaMTX, queue, scheduler, and viewer-sync while files are archived --force Replace an existing zip with the same name -h, --help Show this help The script creates one restore-ready zip containing: - - dockerized deployment files and .env + - docker-bundle deployment files and .env - runtime/source checkout when present, excluding dependencies and Laravel runtime cache/log files - PostgreSQL SQL dump - app storage volume archive @@ -174,11 +174,11 @@ run_compose run --rm --no-deps -T --user root --entrypoint tar \ -v "$ARCHIVE_DIR/volumes:/backup" \ redis -czf /backup/redis-data.tar.gz -C /data . -info "Archiving dockerized deployment files." -tar -czf "$ARCHIVE_DIR/deployment/dockerized-files.tar.gz" \ +info "Archiving docker-bundle deployment files." +tar -czf "$ARCHIVE_DIR/deployment/docker-bundle-files.tar.gz" \ -C "$(dirname "$ROOT_DIR")" \ - --exclude='dockerized/backups' \ - --exclude='dockerized/runtime' \ + --exclude='docker-bundle/backups' \ + --exclude='docker-bundle/runtime' \ "$(basename "$ROOT_DIR")" if [ -d "$SOURCE_DIR" ]; then @@ -225,9 +225,9 @@ if [ -d "$SOURCE_DIR/.git" ]; then fi cat > "$ARCHIVE_DIR/README_RESTORE.md" <<'RESTORE_README' -# Nyone Dockerized Backup Restore +# Nyone docker-bundle Backup Restore -This archive contains everything managed by the `dockerized/` deployment bundle: +This archive contains everything managed by the `docker-bundle/` deployment bundle: - deployment files and `.env` - `runtime/source` checkout when it existed at backup time @@ -235,7 +235,7 @@ This archive contains everything managed by the `dockerized/` deployment bundle: - Laravel app storage volume - Redis data volume -Host-level files outside `dockerized/`, such as Nginx site files and Let's Encrypt certificates, are not included. +Host-level files outside `docker-bundle/`, such as Nginx site files and Let's Encrypt certificates, are not included. ## Restore on a fresh server @@ -243,13 +243,13 @@ Install Docker and the Compose plugin first. Then extract this zip and run: ```bash chmod +x restore.sh -./restore.sh /opt/nyone/dockerized +./restore.sh /opt/nyone/docker-bundle ``` If the target already exists and you intentionally want to replace it: ```bash -./restore.sh --replace /opt/nyone/dockerized +./restore.sh --replace /opt/nyone/docker-bundle ``` The restore helper copies the deployment bundle, restores `runtime/source` when present, clones it from `.env` when missing, rebuilds the images, restores PostgreSQL, restores the app storage and Redis volumes, and starts the app services. @@ -262,7 +262,7 @@ cat > "$ARCHIVE_DIR/restore.sh" <<'RESTORE_SCRIPT' set -euo pipefail BACKUP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -TARGET_DIR="/opt/nyone/dockerized" +TARGET_DIR="/opt/nyone/docker-bundle" REPLACE=false TMP_DIR="" @@ -281,8 +281,8 @@ Usage: ./restore.sh [--replace] [target-dir] Example: - ./restore.sh /opt/nyone/dockerized - ./restore.sh --replace /opt/nyone/dockerized + ./restore.sh /opt/nyone/docker-bundle + ./restore.sh --replace /opt/nyone/docker-bundle USAGE } @@ -356,7 +356,7 @@ while [ "$#" -gt 0 ]; do done [ "$TARGET_DIR" != "/" ] || fail "Refusing to restore into /." -[ -f "$BACKUP_DIR/deployment/dockerized-files.tar.gz" ] || fail "deployment/dockerized-files.tar.gz is missing." +[ -f "$BACKUP_DIR/deployment/docker-bundle-files.tar.gz" ] || fail "deployment/docker-bundle-files.tar.gz is missing." [ -f "$BACKUP_DIR/database/postgres.sql.gz" ] || fail "database/postgres.sql.gz is missing." [ -f "$BACKUP_DIR/volumes/app-storage.tar.gz" ] || fail "volumes/app-storage.tar.gz is missing." @@ -381,10 +381,10 @@ if [ -e "$TARGET_DIR" ]; then fi TMP_DIR="$(mktemp -d)" -info "Restoring dockerized files." -tar -xzf "$BACKUP_DIR/deployment/dockerized-files.tar.gz" -C "$TMP_DIR" -[ -d "$TMP_DIR/dockerized" ] || fail "Backup did not contain a dockerized directory." -mv "$TMP_DIR/dockerized" "$TARGET_DIR" +info "Restoring docker-bundle files." +tar -xzf "$BACKUP_DIR/deployment/docker-bundle-files.tar.gz" -C "$TMP_DIR" +[ -d "$TMP_DIR/docker-bundle" ] || fail "Backup did not contain a docker-bundle directory." +mv "$TMP_DIR/docker-bundle" "$TARGET_DIR" if [ -f "$BACKUP_DIR/deployment/runtime-source.tar.gz" ]; then info "Restoring runtime/source." diff --git a/dockerized/scripts/deploy.sh b/docker-bundle/scripts/deploy.sh similarity index 100% rename from dockerized/scripts/deploy.sh rename to docker-bundle/scripts/deploy.sh