Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add better support for localflare in container #12

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.github
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ RUN apt-get update -y && \
RUN mkdir -p /app/conf/coston /app/conf/C /app/logs /app/db

COPY --from=build /app/avalanchego/build /app/build
COPY --from=build /app/avalanchego/staking /app/staking
COPY entrypoint.sh /app/entrypoint.sh

EXPOSE ${STAKING_PORT}
Expand Down
13 changes: 7 additions & 6 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ then
fi
fi

# Check if we can connect to the bootstrap endpoint (whitelisting)
BOOTSTRAP_STATUS=$(curl -m 10 -s -w %{http_code} -X POST --data '{ "jsonrpc":"2.0", "id":1, "method":"info.getNodeIP" }' -H 'content-type:application/json;' "$AUTOCONFIGURE_BOOTSTRAP_ENDPOINT" -o /dev/null)
if [ "$BOOTSTRAP_STATUS" != "200" ]; then
echo "Could not connect to bootstrap endpoint. Is your IP whitelisted?"
exit 1
fi

if [ "$AUTOCONFIGURE_BOOTSTRAP" = "1" ];
then
# Check if we can connect to the bootstrap endpoint (whitelisting)
BOOTSTRAP_STATUS=$(curl -m 10 -s -w %{http_code} -X POST --data '{ "jsonrpc":"2.0", "id":1, "method":"info.getNodeIP" }' -H 'content-type:application/json;' "$AUTOCONFIGURE_BOOTSTRAP_ENDPOINT" -o /dev/null)
if [ "$BOOTSTRAP_STATUS" != "200" ]; then
echo "Could not connect to bootstrap endpoint. Is your IP whitelisted?"
exit 1
fi

echo "Autoconfiguring bootstrap IPs and IDs"

BOOTSTRAP_IPS=$(curl -m 10 -sX POST --data '{ "jsonrpc":"2.0", "id":1, "method":"info.getNodeIP" }' -H 'content-type:application/json;' "$AUTOCONFIGURE_BOOTSTRAP_ENDPOINT" | jq -r ".result.ip")
Expand Down