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

[TEMP for Cec.] Deactivate rbuilder #6

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ RUN cargo build --profile $BUILD_PROFILE --features "$FEATURES" --locked --bin r
# ADD https://worldtimeapi.org/api/ip /tmp/bustcache

# Clone and build rbuilder (gwyneth branch)
RUN git clone -b gwyneth https://github.com/taikoxyz/rbuilder.git /app/rbuilder
WORKDIR /app/rbuilder
RUN cargo build --release
# RUN git clone -b gwyneth https://github.com/taikoxyz/rbuilder.git /app/rbuilder
# WORKDIR /app/rbuilder
# RUN cargo build --release

# Copy binaries to a temporary location
RUN cp /app/target/$BUILD_PROFILE/reth /app/reth
RUN cp /app/rbuilder/target/release/rbuilder /app/rbuilder
# RUN cp /app/rbuilder/target/release/rbuilder /app/rbuilder

# Use Ubuntu as the release image
FROM ubuntu:22.04 AS runtime
Expand All @@ -63,17 +63,17 @@ ENV PATH="/root/.cargo/bin:${PATH}"

# Copy reth and rbuilder binaries over from the build stage
COPY --from=builder /app/reth /usr/local/bin
COPY --from=builder /app/rbuilder /usr/local/bin
# COPY --from=builder /app/rbuilder /usr/local/bin

# Copy the entire rbuilder repository
COPY --from=builder /app/rbuilder /app/rbuilder
# COPY --from=builder /app/rbuilder /app/rbuilder

# Copy licenses
COPY LICENSE-* ./

# Create start script
RUN echo '#!/bin/bash\nrbuilder run /app/rbuilder/config-gwyneth-reth.toml' > /app/start_rbuilder.sh && \
chmod +x /app/start_rbuilder.sh
# RUN echo '#!/bin/bash\nrbuilder run /app/rbuilder/config-gwyneth-reth.toml' > /app/start_rbuilder.sh && \
# chmod +x /app/start_rbuilder.sh

EXPOSE 30303 30303/udp 9001 8545 8546
ENTRYPOINT ["/usr/local/bin/reth"]
104 changes: 52 additions & 52 deletions packages/protocol/scripts/setup_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,22 +139,22 @@ else
echo "Found container ID: $CONTAINER_ID"
fi

# Check if the file exists in the container
FILE_PATH="/app/rbuilder/config-gwyneth-reth.toml"
if ! docker exec "$CONTAINER_ID" test -f "$FILE_PATH"; then
echo "File $FILE_PATH does not exist in the container."
exit 1
fi
# # Check if the file exists in the container
# FILE_PATH="/app/rbuilder/config-gwyneth-reth.toml"
# if ! docker exec "$CONTAINER_ID" test -f "$FILE_PATH"; then
# echo "File $FILE_PATH does not exist in the container."
# exit 1
# fi

# Update the cl_node_url in the file, regardless of its current content
ESCAPED_URL=$(echo "$BEACON_HTTP_URL" | sed 's/[\/&]/\\&/g')
UPDATE_COMMAND="sed -i '/^cl_node_url[[:space:]]*=/c\cl_node_url = [\"$ESCAPED_URL\"]' $FILE_PATH"
if docker exec "$CONTAINER_ID" sh -c "$UPDATE_COMMAND"; then
echo "Successfully updated $FILE_PATH in the container."
else
echo "Failed to update $FILE_PATH in the container."
exit 1
fi
# # Update the cl_node_url in the file, regardless of its current content
# ESCAPED_URL=$(echo "$BEACON_HTTP_URL" | sed 's/[\/&]/\\&/g')
# UPDATE_COMMAND="sed -i '/^cl_node_url[[:space:]]*=/c\cl_node_url = [\"$ESCAPED_URL\"]' $FILE_PATH"
# if docker exec "$CONTAINER_ID" sh -c "$UPDATE_COMMAND"; then
# echo "Successfully updated $FILE_PATH in the container."
# else
# echo "Failed to update $FILE_PATH in the container."
# exit 1
# fi

# Verify the change
VERIFY_COMMAND="grep 'cl_node_url' $FILE_PATH"
Expand All @@ -180,43 +180,43 @@ echo "Script execution completed."


# Ensure the log file exists in the current working directory
touch ./rbuilder.log

echo "Starting rbuilder and streaming logs to ./rbuilder.log..."
docker exec -d "$CONTAINER_ID" /bin/bash -c "
/app/start_rbuilder.sh > /tmp/rbuilder.log 2>&1 &
RBUILDER_PID=\$!
tail -f /tmp/rbuilder.log &
TAIL_PID=\$!
wait \$RBUILDER_PID
"

# Start a background process to stream logs from the container to the host file
docker exec "$CONTAINER_ID" tail -f /tmp/rbuilder.log >> ./rbuilder.log &
FILE_LOG_PID=$!

# Start another process to stream logs to the terminal
docker exec "$CONTAINER_ID" tail -f /tmp/rbuilder.log &
TERMINAL_LOG_PID=$!

# Set up a trap to handle Ctrl+C (SIGINT)
trap 'echo "Interrupt received. Stopping terminal log streaming, but file logging continues."; kill $TERMINAL_LOG_PID; exit' INT TERM

echo "rbuilder is running in the container."
echo "Logs are being streamed to ./rbuilder.log and to this terminal."
echo "Press Ctrl+C to stop watching logs in the terminal. rbuilder and file logging will continue."

# Wait for the terminal log streaming to be manually interrupted
wait $TERMINAL_LOG_PID

# Check if rbuilder is still running
if docker exec "$CONTAINER_ID" pgrep -f "/app/start_rbuilder.sh" > /dev/null; then
echo "rbuilder is still running in the container. Logs continue to be written to ./rbuilder.log"
else
echo "rbuilder has stopped unexpectedly."
kill $FILE_LOG_PID
exit 1
fi
# touch ./rbuilder.log

# echo "Starting rbuilder and streaming logs to ./rbuilder.log..."
# docker exec -d "$CONTAINER_ID" /bin/bash -c "
# /app/start_rbuilder.sh > /tmp/rbuilder.log 2>&1 &
# RBUILDER_PID=\$!
# tail -f /tmp/rbuilder.log &
# TAIL_PID=\$!
# wait \$RBUILDER_PID
# "

# # Start a background process to stream logs from the container to the host file
# docker exec "$CONTAINER_ID" tail -f /tmp/rbuilder.log >> ./rbuilder.log &
# FILE_LOG_PID=$!

# # Start another process to stream logs to the terminal
# docker exec "$CONTAINER_ID" tail -f /tmp/rbuilder.log &
# TERMINAL_LOG_PID=$!

# # Set up a trap to handle Ctrl+C (SIGINT)
# trap 'echo "Interrupt received. Stopping terminal log streaming, but file logging continues."; kill $TERMINAL_LOG_PID; exit' INT TERM

# echo "rbuilder is running in the container."
# echo "Logs are being streamed to ./rbuilder.log and to this terminal."
# echo "Press Ctrl+C to stop watching logs in the terminal. rbuilder and file logging will continue."

# # Wait for the terminal log streaming to be manually interrupted
# wait $TERMINAL_LOG_PID

# # Check if rbuilder is still running
# if docker exec "$CONTAINER_ID" pgrep -f "/app/start_rbuilder.sh" > /dev/null; then
# echo "rbuilder is still running in the container. Logs continue to be written to ./rbuilder.log"
# else
# echo "rbuilder has stopped unexpectedly."
# kill $FILE_LOG_PID
# exit 1
# fi

# Extract the path to run-latest.json
RUN_LATEST_PATH=$(echo "$FORGE_OUTPUT" | grep "Transactions saved to:" | sed 's/Transactions saved to: //')
Expand Down
Loading