From e9e16c7aafdaa624b97060662437e461e5884465 Mon Sep 17 00:00:00 2001 From: Doxa Maps Date: Tue, 29 Sep 2026 02:30:16 +0000 Subject: [PATCH] Cloud container: PULL_INTERVAL=0 never pulls, so a mounted checkout is never reset The pull loop follows BRANCH with `git reset --hard FETCH_HEAD` whenever the branch moves. In the cloud that is the point. On a checkout mounted from someone's machine it would wipe their commits and uncommitted work. PULL_INTERVAL=0 now skips the loop entirely: no fetch, no reset, one line in /tmp/pull.log saying so. Every other value behaves as before. Checked both ways on a throwaway repo whose remote had moved on and whose working copy held an uncommitted edit: with 0 the commit and the edit stay; with 1 (the control) the loop resets both, as it always has. --- deployment/cloud/README.md | 2 +- deployment/cloud/entry.sh | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/deployment/cloud/README.md b/deployment/cloud/README.md index c77756d3b..0000e9307 100644 --- a/deployment/cloud/README.md +++ b/deployment/cloud/README.md @@ -22,7 +22,7 @@ and the hot-reload websocket. Only people in the allowed groups get in. |---|---|---| | `REPO_URL` | yes | the dx-maps git URL to clone | | `BRANCH` | no (`main`) | the branch to follow | -| `PULL_INTERVAL` | no (`15`) | seconds between pulls | +| `PULL_INTERVAL` | no (`15`) | seconds between pulls; `0` never pulls (for a checkout mounted from your machine: a pull resets it hard) | | `GIT_TOKEN` | private repos | a read token for the clone and pulls | | `PORT` | no (`5173`) | the port the container serves on | | `HMR_CLIENT_PORT`, `HMR_PROTOCOL` | behind HTTPS | `443` and `wss`, so browsers reach the hot-reload websocket | diff --git a/deployment/cloud/entry.sh b/deployment/cloud/entry.sh index 2415a7600..6b04d65ff 100755 --- a/deployment/cloud/entry.sh +++ b/deployment/cloud/entry.sh @@ -1,6 +1,6 @@ #!/bin/bash # dx-maps cloud dev server, run by the image's /boot.sh from the cloned repo (see Dockerfile). -# 1. install, 2. pull BRANCH every PULL_INTERVAL s (Vite hot-reloads what changed), +# 1. install, 2. pull BRANCH every PULL_INTERVAL s (Vite hot-reloads what changed; 0 = never pull), # 3. serve: Vite alone, or behind an OIDC sign-in when OIDC_ISSUER is set. set -u cd /app/repo @@ -8,6 +8,11 @@ BRANCH="${BRANCH:-main}"; PORT="${PORT:-5173}" echo "$(date -u +%FT%TZ) START at $(git rev-parse --short HEAD)" | tee -a /tmp/pull.log bun install --frozen-lockfile || bun install +# PULL_INTERVAL=0: never pull, never reset. For a checkout mounted from someone's machine, where the +# loop's `git reset --hard` would wipe their work. +if [ "${PULL_INTERVAL:-15}" = 0 ]; then + echo "$(date -u +%FT%TZ) PULL_INTERVAL=0: not following $BRANCH; the checkout is left as it is" | tee -a /tmp/pull.log +else ( while true; do sleep "${PULL_INTERVAL:-15}" @@ -38,6 +43,7 @@ bun install --frozen-lockfile || bun install fi done ) & +fi CONFIG=/app/repo/deployment/cloud/vite.cloud.config.mjs