replace dockerized to docker-bundle
This commit is contained in:
@@ -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
|
||||
```
|
||||
@@ -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.
|
||||
@@ -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@<VPS_PUBLIC_IPV4>:/opt/nyone/dockerized/
|
||||
rsync -av --exclude '.env' --exclude 'runtime' docker-bundle/ root@<VPS_PUBLIC_IPV4>:/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/<channel-slug>/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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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.}"
|
||||
@@ -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."
|
||||
Reference in New Issue
Block a user