fix: validate detected release tag in install script version detection

When the GitHub request fails (unreachable network, rate limiting — common
on Proxmox homelab VMs with broken IPv6/DNS), curl -f fails but -w still
prints the attempted URL, so detect_version() returned
"https://github.com/dokploy/dokploy/releases/latest" instead of a tag.
The resulting invalid image (dokploy/dokploy:https://...) meant the dokploy
service was never created, traefik.yml was never written, and the bind
mount created it as a directory.

Accept only values that look like a release tag (v0.x.y), falling back to
"latest" otherwise, and add --connect-timeout 10 so blackholed networks
fail over in seconds instead of hanging the install.

Verified on debian:13 containers: normal network detects v0.29.10, the
DOKPLOY_VERSION override is intact, and connection-refused or blackholed
github.com now falls back to "latest" within 10s.

Fixes #126

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Mauricio Siu
2026-07-07 09:12:28 -06:00
parent 4bca945f3c
commit 093c1aa3d4

View File

@@ -19,10 +19,19 @@ detect_version() {
echo "Detecting latest stable version from GitHub..." >&2
# Try to get latest release from GitHub by following redirects
version=$(curl -fsSL -o /dev/null -w '%{url_effective}\n' \
version=$(curl -fsSL --connect-timeout 10 -o /dev/null -w '%{url_effective}\n' \
https://github.com/dokploy/dokploy/releases/latest 2>/dev/null | \
sed 's#.*/tag/##')
# When the request fails (unreachable network, rate limit), curl still
# prints the attempted URL, which would produce an invalid image tag
# like dokploy/dokploy:https://... Accept only values that look like a
# release tag (e.g. v0.29.10).
case "$version" in
v[0-9]*) ;;
*) version="" ;;
esac
# Fallback to latest tag if detection fails
if [ -z "$version" ]; then
echo "Warning: Could not detect latest version from GitHub, using fallback version latest" >&2