# Deploy Templates

Starter files for HOW TO guides.

Most files here support the two deployment guides. They're tailored to a
**static Docusaurus site** (Node build → `nginx:alpine`), but double as a
generic reference — each file notes where to adapt for a non-static app.

## Companion scripts

| File | Purpose |
|------|---------|
| `tmux-starter.sh` | Installs TPM if missing, backs up `~/.tmux.conf`, and writes the tmux starter config from the tmux intro guide |

## Shared — the image build (both approaches)

| File | Goes where | Purpose |
|------|-----------|---------|
| `Dockerfile` | Your repo root | Multi-stage: Node build → `nginx:alpine` serve (~20-30 MB image) |
| `nginx.conf` | Your repo root | Serves the static site, clean URLs + 404 fallback |
| `.dockerignore` (`dockerignore.txt`) | Your repo root, as `.dockerignore` | Keeps `node_modules`/`build` out of the build context |

## Approach 1 — Uncloud (recommended)

Guide: **Deploy a Container to a Server with Uncloud**. Push → build → push to
the machine via Unregistry → `uc deploy` with built-in Caddy HTTPS.

| File | Goes where | Purpose |
|------|-----------|---------|
| `uncloud-compose.yaml` | Your repo root, as `compose.yaml` | Uncloud service: `build`, `image`, and `x-ports` public HTTPS host |
| `uncloud-deploy.yml` | Your repo, as `.github/workflows/deploy.yml` | Build → Unregistry push → `uc deploy --recreate` on push to `main` |

Replace `<app-name>`, `<app-host>`, `<server-ip>`; set `UC_VERSION` to your
daemon version. Secret needed: `DROPLET_SSH_KEY` (dedicated CI SSH deploy key).

## Approach 2 — DigitalOcean registry + SSH (alternative)

Guide: **Publish a Docker Image to a Private DO Registry and Auto-Deploy**.
Build → push to a private DO registry → SSH-pull on the droplet.

| File | Goes where | Purpose |
|------|-----------|---------|
| `deploy.yml` | Your repo, as `.github/workflows/deploy.yml` | Build → push to DO registry → SSH-deploy on push to `main` |
| `docker-compose.yml` | **The droplet**, at `/opt/app/docker-compose.yml` | Defines the running service (host-port mapped) |

Replace `<registry-name>` and `<app-name>`. Ports are pre-set to `80:80`
(Docusaurus is served by nginx on port 80).

> Only use **one** `deploy.yml` — pick the workflow for the approach you're
> following. `uncloud-deploy.yml` and `deploy.yml` both land at the same path.

## Test the image locally before wiring up CI

```bash
docker build -t docusaurus-test .
docker run --rm -p 8080:80 docusaurus-test
# visit http://localhost:8080
```
