Add pre-built image installer and release tarball system

New install method: curl one-liner downloads a lightweight release
tarball (~9 MB) and runs the config wizard. No git clone needed,
no TypeScript compilation — pulls pre-built images from Gitea registry.

- docker-compose.prod.yml: production compose without build blocks or
  source code volume mounts; IMAGE_TAG defaults to latest
- scripts/install.sh: curl-friendly installer (downloads tarball,
  extracts, runs config.sh)
- scripts/build-release.sh: creates release tarball from dev repo
  with only runtime files (configs, scripts, docs, empty data dirs)
- config.sh: release-mode detection (VERSION file + no .git dir),
  auto-sets IMAGE_TAG=latest and NODE_ENV=production
- upgrade.sh: release-mode upgrade path (downloads new tarball from
  Gitea Releases API instead of git pull, always uses registry mode)
- upgrade-check.sh: release-mode version check via Gitea API
- .gitignore: exclude releases/ and api/dist/
- Docs: updated getting-started with pre-built install instructions

Bunker Admin
This commit is contained in:
2026-03-22 20:34:49 -06:00
parent f550423c3f
commit 8e6f0996de
10 changed files with 1996 additions and 32 deletions

View File

@@ -19,7 +19,19 @@ This guide walks you through installing Changemaker Lite, running your first dep
- At least 2 GB RAM and 10 GB disk space
- A domain name (optional, but recommended for production)
## Quick Start
## Quick Install (Pre-built Images)
The fastest way to deploy — no source code, no compilation:
```bash
curl -fsSL https://gitea.bnkops.com/admin/changemaker.lite/raw/branch/v2/scripts/install.sh | bash
```
This downloads a lightweight release package (~2 MB), runs the configuration wizard, and pulls pre-built Docker images. First startup takes ~2 minutes. See [Installation](installation.md#pre-built-image-installation) for details.
## Quick Start (From Source)
For development or customization, clone the full repository:
```bash
git clone https://gitea.bnkops.com/admin/changemaker.lite

View File

@@ -49,6 +49,54 @@ Open **http://localhost:3000** and sign in with the admin credentials you config
---
## Pre-built Image Installation
For production deployments, you can skip cloning the source repository entirely. Pre-built Docker images are pulled from the Gitea container registry.
### One-Line Install
```bash
curl -fsSL https://gitea.bnkops.com/admin/changemaker.lite/raw/branch/v2/scripts/install.sh | bash
```
This script:
1. Checks prerequisites (Docker, Docker Compose, OpenSSL)
2. Downloads the latest release package from Gitea
3. Extracts to `~/changemaker.lite/`
4. Launches the configuration wizard (`config.sh`)
After the wizard completes, start everything with `docker compose up -d`.
### Manual Download
If you prefer not to pipe to bash:
```bash
# Download latest release
curl -LO https://gitea.bnkops.com/admin/changemaker.lite/releases/latest/download/changemaker-lite-latest.tar.gz
tar xzf changemaker-lite-latest.tar.gz
cd changemaker-lite
bash config.sh
docker compose up -d
```
### What's Different from Source Install
| | Source Install | Pre-built Install |
|---|---|---|
| **Download size** | ~200 MB (full repo) | ~2 MB (config + scripts) |
| **First startup** | 10+ min (TypeScript compile + Docker build) | ~2 min (image pull only) |
| **Requires** | Git, full repo | Docker only |
| **Upgrades** | `git pull` + rebuild | Download new release tarball |
| **Development** | Edit source, hot-reload | Not for development |
!!! tip "When to use which"
Use **pre-built install** for production deployments and quick evaluation.
Use **source install** when you want to modify the platform code or contribute to development.
---
## Configuration Wizard (`config.sh`)
The wizard performs **14 steps** to produce a fully configured `.env` file and prepare the system for startup. Each step is interactive with sensible defaults.
@@ -101,7 +149,7 @@ Auto-generates **21 unique secrets** — no placeholder passwords remain after t
| Category | Count | Secrets |
|----------|-------|---------|
| JWT & Encryption | 3 | `JWT_ACCESS_SECRET`, `JWT_REFRESH_SECRET`, `ENCRYPTION_KEY` (64-char hex) |
| JWT & Encryption | 4 | `JWT_ACCESS_SECRET`, `JWT_REFRESH_SECRET`, `JWT_INVITE_SECRET` (each 64-char hex), `ENCRYPTION_KEY` (64-char hex, must differ from JWT secrets) |
| Database | 2 | `V2_POSTGRES_PASSWORD`, `REDIS_PASSWORD` (24-char alphanumeric) |
| Listmonk | 3 | `LISTMONK_DB_PASSWORD`, `LISTMONK_WEB_ADMIN_PASSWORD`, `LISTMONK_API_TOKEN` |
| NocoDB | 1 | `NC_ADMIN_PASSWORD` |
@@ -227,7 +275,8 @@ V2_POSTGRES_PASSWORD=$(openssl rand -base64 48 | tr -dc 'a-zA-Z0-9' | head -c 24
REDIS_PASSWORD=$(openssl rand -base64 48 | tr -dc 'a-zA-Z0-9' | head -c 24)
JWT_ACCESS_SECRET=$(openssl rand -hex 32)
JWT_REFRESH_SECRET=$(openssl rand -hex 32)
ENCRYPTION_KEY=$(openssl rand -hex 32)
JWT_INVITE_SECRET=$(openssl rand -hex 32)
ENCRYPTION_KEY=$(openssl rand -hex 32) # must differ from all JWT secrets
```
Set your admin credentials (password must meet the 12+ char complexity requirement):

View File

@@ -71,6 +71,7 @@ The system fetches from the git remote and shows:
3. Optionally configure:
- **Skip backup** — skip the database backup phase (not recommended)
- **Pull images** — also update third-party Docker images (PostgreSQL, Redis, etc.)
- **Use registry images** — pull pre-built images from Gitea instead of compiling from source (faster — requires `scripts/build-and-push.sh` to have been run first)
- **Dry run** — preview what would happen without making changes
4. Monitor the 6-phase progress indicator
@@ -87,7 +88,7 @@ Both the GUI and CLI methods execute the same 6-phase process:
| **1** | 5% | Pre-flight Checks | Verifies Docker, git, disk space (2 GB minimum), remote reachability, and clean working directory |
| **2** | 15% | Backup | Runs `scripts/backup.sh` (pg_dump + archive), backs up user-modifiable content, saves pre-upgrade commit hash |
| **3** | 30% | Code Update | Saves user paths, stashes local changes, `git pull`, pops stash with auto-conflict resolution, detects new `.env` variables |
| **4** | 50% | Container Rebuild | Rebuilds `api`, `admin`, `media-api`; conditionally rebuilds `nginx` and `code-server` if their configs changed; optionally pulls third-party images |
| **4** | 50% | Container Rebuild | Rebuilds `api`, `admin`, `media-api` from source (default) **or** pulls pre-built images from the Gitea registry (`--use-registry`); conditionally rebuilds `nginx` and `code-server` if their configs changed; optionally pulls third-party images |
| **5** | 70% | Service Restart | Stops app containers, force-recreates LSIO containers, verifies Gancio config, starts infrastructure, waits for PostgreSQL, starts API (runs migrations), starts everything else, restarts Newt tunnel and monitoring if they were running |
| **6** | 90% | Verification | Health checks for API, Admin, Media API, Gancio, MkDocs; detects containers in restart loops |
@@ -126,6 +127,7 @@ Run the upgrade script directly:
|------|-------------|
| `--skip-backup` | Skip the backup phase (requires `--force`) |
| `--pull-services` | Also pull new third-party Docker images |
| `--use-registry` | Pull pre-built images from Gitea instead of compiling from source |
| `--dry-run` | Show what would happen without executing |
| `--force` | Continue past non-critical warnings |
| `--branch BRANCH` | Git branch to pull (default: current branch) |
@@ -144,12 +146,52 @@ Run the upgrade script directly:
# Full upgrade including third-party image updates
./scripts/upgrade.sh --pull-services
# Upgrade using pre-built images from Gitea registry (faster, no TypeScript compile)
./scripts/upgrade.sh --use-registry --force --skip-backup
# Rollback to the last pre-upgrade state
./scripts/upgrade.sh --rollback
```
---
## Registry Mode (Fast Upgrades)
By default, the upgrade script compiles TypeScript from source (`npm run build`) and rebuilds Docker images on the deployment server. **Registry mode** skips this by pulling pre-built production images from the Gitea container registry — faster and requires no build tooling on the server.
### How It Works
1. Run `scripts/build-and-push.sh` on a machine with Docker (usually your dev machine) to build and push production images tagged with the current commit SHA
2. During the next upgrade, pass `--use-registry` (CLI) or enable the checkbox (GUI)
3. The upgrade script pulls `gitea.bnkops.com/admin/changemaker-{service}:{sha}` instead of rebuilding from source
4. If a registry image is unavailable (e.g., the SHA wasn't pushed), it automatically falls back to a source build
### Building and Pushing Images
```bash
# Build and push all core services (api, admin, media-api, nginx)
./scripts/build-and-push.sh
# Skip code-server (9 GB — push only when Dockerfile changes)
./scripts/build-and-push.sh --services api,admin,media-api,nginx
# Build only, no push (verify locally first)
./scripts/build-and-push.sh --no-push
# Also mirror third-party images (postgres, redis, etc.) to Gitea
./scripts/mirror-images.sh
```
!!! note "Registry prerequisites"
- Run `docker login gitea.bnkops.com` once per machine before pushing
- Set `GITEA_REGISTRY_USER` and `GITEA_REGISTRY_PASS` in `.env` for the admin GUI's Registry status endpoint
- gitea.bnkops.com must be reachable without proxies that limit upload size (Cloudflare free plan blocks blobs >100 MB)
!!! info "Release installs upgrade automatically via registry"
If you installed from a release tarball (not git clone), the upgrade script automatically uses registry mode. It downloads the latest release package from Gitea instead of running `git pull`. No additional configuration needed.
---
## Rollback
### Automatic Rollback