From 19364ad5c286ae5e16067196408f99c9596ad3eb Mon Sep 17 00:00:00 2001 From: rameen Date: Mon, 31 Aug 2026 10:04:30 +0330 Subject: [PATCH] resolve failed handshake connection with https://wixur.ir:3000 --- infrastructure/DEPLOY.md | 13 ++++++++++ infrastructure/scripts/prod-remote-deploy.sh | 27 +++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/infrastructure/DEPLOY.md b/infrastructure/DEPLOY.md index cef2225..40978f7 100644 --- a/infrastructure/DEPLOY.md +++ b/infrastructure/DEPLOY.md @@ -439,6 +439,19 @@ docker volume rm dyolink_postgres_data_prod Add `"insecure-registries": ["wixur.ir:3000"]` to `/etc/docker/daemon.json` and restart Docker. +### `connection reset by peer` while pulling `:v*` from Gitea + +`docker login` succeeded, then `compose pull` failed on a frontend/backend manifest or layer from `wixur.ir:3000`. Auth is fine — the Windows Gitea registry dropped the TCP connection (common right after a large push, or when both images pull in parallel). + +Images are already in the registry. Re-run only the **deploy** job, or on the VPS: + +```bash +cd /opt/dyolink/infrastructure +./scripts/prod-remote-deploy.sh v1.0.2 +``` + +`prod-remote-deploy.sh` pulls backend then frontend with retries. If every attempt RSTs, check Gitea is up and `insecure-registries` includes `wixur.ir:3000`. + ### View logs ```bash diff --git a/infrastructure/scripts/prod-remote-deploy.sh b/infrastructure/scripts/prod-remote-deploy.sh index 9700cdb..6a07948 100755 --- a/infrastructure/scripts/prod-remote-deploy.sh +++ b/infrastructure/scripts/prod-remote-deploy.sh @@ -18,8 +18,33 @@ if ! grep -q '^REGISTRY_PREFIX=.\+' .env; then fi export TAG + +# Windows Gitea often RSTs concurrent or long pulls (connection reset by peer). +# Pull one image at a time with backoff so a flake does not fail the whole tag. +pull_one() { + local service="$1" + local attempt=1 + local max=5 + local delay=8 + while [ "$attempt" -le "$max" ]; do + echo "Pulling $service :$TAG (attempt $attempt/$max)" + if docker compose -f docker-compose.prod.yml --env-file .env pull "$service"; then + return 0 + fi + if [ "$attempt" -eq "$max" ]; then + echo "Failed to pull $service after $max attempts" + return 1 + fi + echo "Pull of $service failed; retrying in ${delay}s..." + sleep "$delay" + delay=$((delay * 2)) + attempt=$((attempt + 1)) + done +} + echo "Pulling backend/frontend :$TAG from Gitea (REGISTRY_PREFIX in .env)" -docker compose -f docker-compose.prod.yml --env-file .env pull backend frontend +pull_one backend +pull_one frontend docker compose -f docker-compose.prod.yml --env-file .env up -d echo "=== Status ===" docker compose -f docker-compose.prod.yml --env-file .env ps