From 2fbfeb51b425c025badca85ddfecc4c5be343b8a Mon Sep 17 00:00:00 2001 From: Matt Rohrer Date: Mon, 12 May 2025 14:54:48 +0200 Subject: [PATCH 1/5] Use latest tailscale version https://tailscale.com/changelog#2025-04-17 --- bin/compile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/compile b/bin/compile index 2e98dcb..4bec9d1 100755 --- a/bin/compile +++ b/bin/compile @@ -22,7 +22,7 @@ CACHE_DIR=$2 ENV_DIR=$3 BUILDPACK_DIR="$(dirname "$(dirname "$0")")" -TAILSCALE_VERSION=1.74.0 +TAILSCALE_VERSION=1.82.5 TAILSCALE_BUILD_ARCH=amd64 TAILSCALE_SOURCE_URL="https://pkgs.tailscale.com/stable/tailscale_${TAILSCALE_VERSION}_${TAILSCALE_BUILD_ARCH}.tgz" TAILSCALE_INSTALL_DIR="$BUILD_DIR/vendor/tailscale" @@ -81,4 +81,4 @@ if [ -f "$BUILD_DIR/bin/rails" ]; then mv $BUILD_DIR/bin/rake $BUILD_DIR/bin/rake_original cp "$BUILDPACK_DIR/bin/rails/rake" $BUILD_DIR/bin/ chmod +x $BUILD_DIR/bin/rake -fi \ No newline at end of file +fi From 24023e8ac95c78c1ad43b0ccdf5e02b8ea84f317 Mon Sep 17 00:00:00 2001 From: Matt Rohrer Date: Thu, 15 May 2025 15:09:19 +0200 Subject: [PATCH 2/5] whitespace/style --- bin/heroku-tailscale-start.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/bin/heroku-tailscale-start.sh b/bin/heroku-tailscale-start.sh index ced4bfc..93aa0c9 100755 --- a/bin/heroku-tailscale-start.sh +++ b/bin/heroku-tailscale-start.sh @@ -8,20 +8,20 @@ if [ -z "$TAILSCALE_AUTH_KEY" ]; then fi wait_for_tailscale_running() { - timeout=5 # Timeout in seconds - interval=0.5 # Interval between checks - elapsed=0 - - while [ "$elapsed" -lt "$timeout" ]; do - state=$(tailscale status -json | jq -r .BackendState) - if [ "$state" = "Running" ]; then - return 0 - fi - sleep "$interval" - elapsed=$(echo "$elapsed + $interval" | bc) - done - - return 1 + timeout=5 # Timeout in seconds + interval=0.5 # Interval between checks + elapsed=0 + + while [ "$elapsed" -lt "$timeout" ]; do + state=$(tailscale status -json | jq -r .BackendState) + if [ "$state" = "Running" ]; then + return 0 + fi + sleep "$interval" + elapsed=$(echo "$elapsed + $interval" | bc) + done + + return 1 } if [ -z "$TAILSCALE_HOSTNAME" ]; then @@ -39,7 +39,7 @@ else TAILSCALE_HOSTNAME="$TAILSCALE_HOSTNAME" fi tailscaled -cleanup > /dev/null 2>&1 -(tailscaled -verbose ${TAILSCALED_VERBOSE:--1} --tun=userspace-networking --socks5-server=localhost:1055 > /dev/null 2>&1 &) +(tailscaled -verbose ${TAILSCALED_VERBOSE:--1} --tun=userspace-networking --socks5-server=localhost:1055 > /dev/null 2>&1 &) tailscale up \ --authkey="${TAILSCALE_AUTH_KEY}?preauthorized=true&ephemeral=true" \ --hostname="$TAILSCALE_HOSTNAME" \ From 53dcb5368d95e22ba034a9195c9cdb0751e5a11f Mon Sep 17 00:00:00 2001 From: Matt Rohrer Date: Fri, 16 May 2025 14:24:18 +0200 Subject: [PATCH 3/5] Use integer math for wait calculations The Heroku-24 stack does not include `bc` and bash cannot do non-integer math. Use `awk` to convert the timeout & interval to milliseconds so we can use build-in bash math operators. --- bin/heroku-tailscale-start.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/heroku-tailscale-start.sh b/bin/heroku-tailscale-start.sh index 93aa0c9..a1e878d 100755 --- a/bin/heroku-tailscale-start.sh +++ b/bin/heroku-tailscale-start.sh @@ -10,15 +10,20 @@ fi wait_for_tailscale_running() { timeout=5 # Timeout in seconds interval=0.5 # Interval between checks + + # convert to milliseconds so we can use integer math + timeout_ms=$(awk "BEGIN {print $timeout * 1000}") + interval_ms=$(awk "BEGIN {print $interval * 1000}") + elapsed=0 - while [ "$elapsed" -lt "$timeout" ]; do + while [ "$elapsed" -lt "$timeout_ms" ]; do state=$(tailscale status -json | jq -r .BackendState) if [ "$state" = "Running" ]; then return 0 fi sleep "$interval" - elapsed=$(echo "$elapsed + $interval" | bc) + elapsed=$((elapsed + interval_ms)) done return 1 From e67425060d4f04b196186039e811931cb74f215d Mon Sep 17 00:00:00 2001 From: Matt Rohrer Date: Fri, 16 May 2025 14:28:30 +0200 Subject: [PATCH 4/5] Add ability to set TAILSCALE_RUNNING_TIMEOUT --- bin/heroku-tailscale-start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/heroku-tailscale-start.sh b/bin/heroku-tailscale-start.sh index a1e878d..fb38f60 100755 --- a/bin/heroku-tailscale-start.sh +++ b/bin/heroku-tailscale-start.sh @@ -8,7 +8,7 @@ if [ -z "$TAILSCALE_AUTH_KEY" ]; then fi wait_for_tailscale_running() { - timeout=5 # Timeout in seconds + timeout=${TAILSCALE_RUNNING_TIMEOUT:-5} # Timeout in seconds interval=0.5 # Interval between checks # convert to milliseconds so we can use integer math From bec36b6500d41f6b995087de8b9df87a1d3a2c4f Mon Sep 17 00:00:00 2001 From: CoderMiguel <52347827+CoderMiguel@users.noreply.github.com> Date: Fri, 8 Aug 2025 16:08:59 -0400 Subject: [PATCH 5/5] refactor to tailscale up command --- bin/heroku-tailscale-start.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bin/heroku-tailscale-start.sh b/bin/heroku-tailscale-start.sh index fb38f60..0adc7b3 100755 --- a/bin/heroku-tailscale-start.sh +++ b/bin/heroku-tailscale-start.sh @@ -46,12 +46,10 @@ fi tailscaled -cleanup > /dev/null 2>&1 (tailscaled -verbose ${TAILSCALED_VERBOSE:--1} --tun=userspace-networking --socks5-server=localhost:1055 > /dev/null 2>&1 &) tailscale up \ - --authkey="${TAILSCALE_AUTH_KEY}?preauthorized=true&ephemeral=true" \ + --authkey="${TAILSCALE_AUTH_KEY}" \ --hostname="$TAILSCALE_HOSTNAME" \ --advertise-tags=${TAILSCALE_ADVERTISE_TAGS:-} \ - --accept-routes \ - --timeout=15s \ - ${TAILSCALE_ADDITIONAL_ARGS:---timeout=15s} + ${TAILSCALE_ADDITIONAL_ARGS:---accept-routes --timeout=15s} export ALL_PROXY=socks5://localhost:1055/