A container registry that uses the AT Protocol for manifest storage and S3 for blob storage. atcr.io
docker container atproto go
81
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix cloud-init sync and dns check

+15 -11
+3 -4
deploy/upcloud/configs/cloudinit.sh.tmpl
··· 5 5 echo "=== {{.DisplayName}} Setup: {{.BinaryName}} ===" 6 6 echo "Started at $(date -u)" 7 7 8 - # Wait for DNS resolution 9 - echo "Waiting for DNS..." 8 + # Wait for network/DNS 10 9 for i in $(seq 1 30); do 11 - if host go.dev >/dev/null 2>&1; then 12 - echo "DNS ready after ${i}s" 10 + if getent hosts go.dev >/dev/null 2>&1; then 11 + echo "Network ready after ${i}s" 13 12 break 14 13 fi 15 14 sleep 1
+12 -7
deploy/upcloud/provision.go
··· 4 4 "bufio" 5 5 "context" 6 6 "crypto/sha256" 7 + "encoding/base64" 7 8 "fmt" 8 9 "os" 9 10 "strings" ··· 891 892 if remoteScript == "__MISSING__" { 892 893 fmt.Printf(" cloud-init: not found on %s (server may need initial setup)\n", name) 893 894 } else { 894 - localHash := fmt.Sprintf("%x", sha256.Sum256([]byte(localScript))) 895 + localHash := fmt.Sprintf("%x", sha256.Sum256([]byte(strings.TrimSpace(localScript)))) 895 896 remoteHash := fmt.Sprintf("%x", sha256.Sum256([]byte(remoteScript))) 896 897 if localHash == remoteHash { 897 898 fmt.Printf(" cloud-init: up to date\n") ··· 913 914 return nil 914 915 } 915 916 917 + // Write the reference file first so next provision can detect real diffs, 918 + // regardless of whether the script execution succeeds or fails. 919 + if err := writeRemoteCloudInit(ip, localScript); err != nil { 920 + fmt.Printf(" WARNING: could not update remote cloud-init reference: %v\n", err) 921 + } 922 + 916 923 fmt.Printf(" Running cloud-init on %s (%s)... (this may take several minutes)\n", name, ip) 917 924 output, err := runSSH(ip, localScript, true) 918 925 if err != nil { ··· 922 929 } 923 930 924 931 fmt.Printf(" %s: cloud-init complete\n", name) 925 - 926 - // Write the script to the remote path so next provision can detect real diffs 927 - if err := writeRemoteCloudInit(ip, localScript); err != nil { 928 - fmt.Printf(" WARNING: could not update remote cloud-init reference: %v\n", err) 929 - } 930 932 return nil 931 933 } 932 934 933 935 // writeRemoteCloudInit writes the local cloud-init script to the remote server 934 936 // so that subsequent provision runs can accurately detect real changes. 937 + // Uses base64 encoding to avoid heredoc nesting issues (the cloud-init script 938 + // itself contains heredocs like CFGEOF and SVCEOF). 935 939 func writeRemoteCloudInit(ip, script string) error { 936 - cmd := fmt.Sprintf("cat > %s << 'CLOUDINITEOF'\n%sCLOUDINITEOF", cloudInitPath, script) 940 + encoded := base64.StdEncoding.EncodeToString([]byte(script)) 941 + cmd := fmt.Sprintf("mkdir -p $(dirname %s) && echo '%s' | base64 -d > %s", cloudInitPath, encoded, cloudInitPath) 937 942 _, err := runSSH(ip, cmd, false) 938 943 return err 939 944 }