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

feat: Dockerfile add entrypoint #106

Merged
merged 1 commit into from
Jan 31, 2024
Merged
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
79 changes: 55 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,61 @@ Follow the [spec](https://github.com/ethereum-optimism/optimism/blob/develop/spe
## System requirements
To run a `hildr-node` and `op-geth` node, at least 4C8G and 100GB of disk is required, as well as the installation of Java version 21 and Go version 1.20.8, must lower then v1.21.

## Running `hildr-node`

First, use Docker start a `op-geth` container in hildr project root directory:

```shell
cd ./docker && docker compose -f docker/docker-compose.yml up op-geth
```

### Use shell
Then, once op-geth has been started, start up the `hildr-node` in `hildr` project root directory:
```shell
./gradlew :hildr-node:build -x test \
&& nohup java --enable-preview \
-cp hildr-node/build/libs/hildr-node-{version}.jar io.optimism.Hildr \
--network optimism-sepolia \
--jwt-secret $JWT_SECRET
--l1-rpc-url $L1_RPC_URL
--l1-ws-rpc-url $L1_WS_RPC_URL
--l2-rpc-url $L2_RPC_URL \
--l2-engine-url $L2_AUTH_RPC_URL \
--rpc-port $HILDR_RPC_PORT \ # Choose any available port.
--log-level $LOG_LEVEL \ # can be either: "DEBUG","TRACE","INFO","WARN","ERROR"
--sync-mode full >l2-hildr-node.log 2>&1 &
```

### Use docker

Running a native hildr container on optimism-sepolia network:
```shell
docker run -it ghcr.io/optimism-java/hildr:latest-native \
--network optimism-sepolia \
--jwt-secret $JWT_SECRET \
--l1-rpc-url $L1_RPC_URL \
--l1-ws-rpc-url $L1_WS_RPC_URL \
--l2-rpc-url $L2_RPC_URL \
--l2-engine-url $L2_AUTH_RPC_URL \
--rpc-port $HILDR_RPC_PORT \
--log-level $LOG_LEVEL \ # can be either: "DEBUG","TRACE","INFO","WARN","ERROR"
--sync-mode full
```

Running a java hildr container on optimism-sepolia network:
```shell
docker run -it ghcr.io/optimism-java/hildr:latest \
--network optimism-sepolia \
--jwt-secret $JWT_SECRET \
--l1-rpc-url $L1_RPC_URL \
--l1-ws-rpc-url $L1_WS_RPC_URL \
--l2-rpc-url $L2_RPC_URL \
--l2-engine-url $L2_AUTH_RPC_URL \
--rpc-port $HILDR_RPC_PORT \
--log-level $LOG_LEVEL \ # can be either: "DEBUG","TRACE","INFO","WARN","ERROR"
--sync-mode full
```

## Installing Hildr Node

### Building `hildr-node` from source
Expand Down Expand Up @@ -82,30 +137,6 @@ EXECUTION_CLIENT_WS_PORT=5546

```

### Running `hildr-node`

First, use Docker start a `op-geth` container in hildr project root directory:

```shell
cd ./docker && docker compose -f docker/docker-compose.yml up op-geth
```

Then, once op-geth has been started, start up the `hildr-node` in `hildr` project root directory:
```shell
./gradlew :hildr-node:build -x test \
&& export $(grep -v '^#' .env|xargs) \
&& nohup java --enable-preview \
-cp hildr-node/build/libs/hildr-node-0.2.0.jar io.optimism.Hildr \
--network optimism-sepolia \
--jwt-secret $JWT_SECRET
--l1-rpc-url $L1_RPC_URL
--l1-ws-rpc-url $L1_WS_RPC_URL
--l2-rpc-url http://127.0.0.1:5545 \
--l2-engine-url http://127.0.0.1:5551 \
--rpc-port 11545 \ # Choose any available port.
--sync-mode full >l2-hildr-node.log 2>&1 &
```

### Running devnet

You also can run a hildr-node on [devnet](./docs/devnet.md)
Expand Down
1 change: 1 addition & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ COPY --from=builder /root/hildr/hildr-node/build/binary/hildr* .
#COPY --from=builder /root/hildr/hildr-node/build/native/nativeCompile/hildr* .

RUN chmod 0755 hildr-node && export PATH=/usr/local/bin:$PATH
ENTRYPOINT ["hildr-node"]



Expand Down
2 changes: 2 additions & 0 deletions docker/jvm.dock
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ COPY --from=builder /root/hildr/hildr-node/build/docker/hildr-node.jar .
COPY --from=builder /root/hildr/docker/start-hildr-node-java.sh .
ENV HILDR_JAR /usr/local/bin/hildr-node.jar
ENV HILDR_MAIN_CLASS io.optimism.Hildr

ENTRYPOINT ["java", "--enable-preview", "-cp" , "/usr/local/bin/hildr-node.jar", "io.optimism.Hildr"]
19 changes: 13 additions & 6 deletions docker/start-hildr-node-java.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ then
fi
fi

if [ $LOG_LEVEL = "" ]
then
LOG_LEVEL="INFO"
fi

if [ $SYNC_MODE = "full" ]
then
exec java --enable-preview \
Expand All @@ -20,11 +25,12 @@ then
--jwt-secret $JWT_SECRET \
--l1-rpc-url $L1_RPC_URL \
--l1-ws-rpc-url $L1_WS_RPC_URL \
--l2-rpc-url http://${EXECUTION_CLIENT}:8545 \
--l2-engine-url http://${EXECUTION_CLIENT}:8551 \
--l2-rpc-url http://${EXECUTION_CLIENT}:${EXECUTION_CLIENT_RPC_PORT} \
--l2-engine-url http://${EXECUTION_CLIENT}:${EXECUTION_CLIENT_AUTH_RPC_PORT} \
--rpc-port $RPC_PORT \
$DEVNET \
--sync-mode $SYNC_MODE
--sync-mode $SYNC_MODE \
--log-level $LOG_LEVEL
elif [ $SYNC_MODE = "checkpoint"]
then
exec java --enable-preview \
Expand All @@ -33,13 +39,14 @@ then
--jwt-secret $JWT_SECRET \
--l1-rpc-url $L1_RPC_URL \
--l1-ws-rpc-url $L1_WS_RPC_URL \
--l2-rpc-url http://${EXECUTION_CLIENT}:8545 \
--l2-engine-url http://${EXECUTION_CLIENT}:8551 \
--l2-rpc-url http://${EXECUTION_CLIENT}:${EXECUTION_CLIENT_RPC_PORT} \
--l2-engine-url http://${EXECUTION_CLIENT}:${EXECUTION_CLIENT_AUTH_RPC_PORT} \
--rpc-port $RPC_PORT \
$DEVNET \
--sync-mode $SYNC_MODE \
--checkpoint-sync-url $CHECKPOINT_SYNC_URL \
--checkpoint-hash $CHECKPOINT_HASH
--checkpoint-hash $CHECKPOINT_HASH \
--log-level $LOG_LEVEL
else
echo "Sync mode not recognized. Available options are full and checkpoint"
fi
Loading