Skip to content

Commit

Permalink
optional race binary (#2356)
Browse files Browse the repository at this point in the history
  • Loading branch information
mechanical-turk authored Feb 13, 2025
1 parent c645577 commit 38445fd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
7 changes: 7 additions & 0 deletions core/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ RUN go build \
-ldflags="-X github.com/towns-protocol/towns/core/river_node/version.version=$VER_VERSION -X github.com/towns-protocol/towns/core/river_node/version.branch=$VER_BRANCH -X github.com/towns-protocol/towns/core/river_node/version.commit=$VER_COMMIT" \
./river_node

RUN go build \
-trimpath \
-o /bin/river_node \
-race \
-ldflags="-X github.com/towns-protocol/towns/core/river_node/version.version=$VER_VERSION -X github.com/towns-protocol/towns/core/river_node/version.branch=$VER_BRANCH -X github.com/towns-protocol/towns/core/river_node/version.commit=$VER_COMMIT" \
./river_node_race

# Final stage
FROM alpine:latest
LABEL org.opencontainers.image.title="River Node" \
Expand Down
20 changes: 11 additions & 9 deletions core/docker/run.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
#!/bin/bash
set -euo pipefail

if [ -z "$RUN_MODE" ]; then
echo "RUN_MODE is not set. Defaulting to full node"
RUN_MODE="full"
RUN_MODE="${RUN_MODE:-full}"
RACE="${RACE:-false}"

RIVER_NODE_BINARY="/usr/bin/river_node"
cd /riveruser/river_node

if [ "$RACE" == "true" ]; then
RIVER_NODE_BINARY="/usr/bin/river_node_race"
fi

if [ "$RUN_MODE" == "full" ]; then
echo "Running full node"
cd /riveruser/river_node
exec /usr/bin/river_node run
exec $RIVER_NODE_BINARY run
elif [ "$RUN_MODE" == "archive" ]; then
echo "Running archive node"
cd /riveruser/river_node
exec /usr/bin/river_node archive
exec $RIVER_NODE_BINARY archive
elif [ "$RUN_MODE" == "notifications" ]; then
echo "Running notification service"
cd /riveruser/river_node
exec /usr/bin/river_node notifications
exec $RIVER_NODE_BINARY notifications
else
echo "Unknown RUN_MODE: $RUN_MODE"
exit 1
Expand Down

0 comments on commit 38445fd

Please sign in to comment.