diff --git a/README.md b/README.md index 407af9e..27d5ac2 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ cd /root/periscope ./scripts/update-periscope.sh ``` -The script cds via `dirname "$0"/..` (no `find`). It refuses to run if the resolved root is not `/root/periscope`. Compose project name is `periscope`. It pulls the current branch, writes `NEXT_PUBLIC_API_URL` / `CORS_ORIGINS` for `https://periscope.michelebigi.it`, rebuilds both Docker images, and leaves `data/` alone. First run: put `DEEPSEEK_API_KEY` in `.env` at the repo root (compose reads that file). `--no-pull` skips git. `SITE=https://other.host ./scripts/update-periscope.sh` overrides the public URL. +The script cds via `dirname "$0"/..` (no `find`). It refuses to run if the resolved root is not `/root/periscope`. Compose project name is `periscope`; the Docker network stays **`pinscope_periscope`** (legacy name) with aliases `pinscope` / `periscope-frontend` so host Caddy/nginx that joined that network keep resolving. It pulls the current branch, writes `NEXT_PUBLIC_API_URL` / `CORS_ORIGINS` for `https://periscope.michelebigi.it`, rebuilds both Docker images, and leaves `data/` alone. First run: put `DEEPSEEK_API_KEY` in `.env` at the repo root (compose reads that file). `--no-pull` skips git. `SITE=https://other.host ./scripts/update-periscope.sh` overrides the public URL. Do not set `ENVIRONMENT=production` unless Clerk auth is configured — that flag refuses to boot with auth disabled. diff --git a/docker-compose.yml b/docker-compose.yml index 4aa406b..19db408 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,7 @@ # Canonical compose project on the VPS is "periscope" (not the GitHub # clone folder name "pinscope"). Bind mounts stay relative to the checkout. +# Keep the Docker network name pinscope_periscope so host Caddy/nginx that +# joined the pre-rename network can still reach these containers by DNS. name: periscope services: @@ -28,7 +30,10 @@ services: - "8080:8080" networks: - - periscope + periscope: + aliases: + - periscope-backend + - pinscope-backend frontend: build: @@ -48,9 +53,13 @@ services: - "3000:3000" networks: - - periscope - + periscope: + aliases: + - periscope-frontend + - pinscope + - pinscope-frontend networks: periscope: + name: pinscope_periscope driver: bridge diff --git a/scripts/update-periscope.sh b/scripts/update-periscope.sh index 52da74a..f76721d 100755 --- a/scripts/update-periscope.sh +++ b/scripts/update-periscope.sh @@ -184,5 +184,21 @@ if [[ "$ok" -ne 1 ]]; then exit 1 fi +log "Waiting for frontend :3000" +ok=0 +for _ in $(seq 1 30); do + if curl -fsS -o /dev/null "http://127.0.0.1:3000/" ; then + ok=1 + break + fi + sleep 1 +done +if [[ "$ok" -ne 1 ]]; then + echo "Frontend did not become ready on :3000. Last logs:" >&2 + compose logs --tail 80 frontend >&2 || true + exit 1 +fi + log "Done. Site should be $SITE (nginx/Caddy still fronts :3000 / :8080)." +log "App containers are on Docker network pinscope_periscope (aliases: pinscope, periscope-frontend)." compose ps