Skip to content

Commit

Permalink
Workaround: Overmind installing wrong binaries for aarch64-linux (#457)
Browse files Browse the repository at this point in the history
  • Loading branch information
htruong authored Jul 13, 2024
1 parent 324fd4e commit df7218d
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion bin/dev
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,32 @@ if ! gem list overmind -i --silent; then
gem install overmind
fi

# Check and fixup for overmind bug on aarch64-linux
# Remove once #185 is fixed for overmind
# https://github.com/DarthSim/overmind/issues/185
RUBY_PLATFORM=$(ruby -e "puts Gem::Platform.local")
if [[ $RUBY_PLATFORM == aarch64-linux* ]]; then

OVERMIND_DIR=$(ruby -e 'puts Gem::Specification.find_by_name("overmind").gem_dir')
OVERMIND_BIN=$(ruby -e 'puts Gem::bin_path("overmind", "overmind")')

# Probe the binary to see if it fails to execute
if ! "$OVERMIND_BIN" -v >/dev/null 2>&1 || ! "$OVERMIND_DIR/libexec/prebuilt-tmux/bin/tmux" -V >/dev/null 2>&1 ; then
echo "Overmind or tmux failed to excute correctly, perhaps wrong arch."
echo "WORKAROUND: Forcefully overwriting wrong overmind binaries for arm64 linux..."
wget -qO- https://github.com/DarthSim/overmind/releases/download/v2.5.1/overmind-v2.5.1-linux-arm64.gz | zcat > "$OVERMIND_DIR/libexec/overmind"
wget -qO- https://github.com/DarthSim/overmind/releases/download/v2.4.0/tmux-v3.4-linux-arm64.tar.gz | tar xvz -C "$OVERMIND_DIR/libexec/prebuilt-tmux"

# Confirm that our workaround works
if ! "$OVERMIND_BIN" -v >/dev/null 2>&1 || ! "$OVERMIND_DIR/libexec/prebuilt-tmux/bin/tmux" -V >/dev/null 2>&1; then
echo "Somehow the workaround for Overmind didn't work, either. Unable to proceed."
echo "Please visit https://github.com/AllYourBot/hostedgpt/discussions/406 to see if there is anything you can do."
exit 1
fi
fi
fi


bundle install
bin/rails db:prepare

Expand All @@ -16,4 +42,4 @@ exec overmind start -f Procfile.dev "$@" &
PID=$!
wait $PID
trap - TERM INT
wait $PID
wait $PID

0 comments on commit df7218d

Please sign in to comment.