From db079087e8c740d89670b04a3270727b2248cb6e Mon Sep 17 00:00:00 2001 From: Chen Kai <281165273grape@gmail.com> Date: Sun, 25 Feb 2024 22:17:24 +0800 Subject: [PATCH] fix:fix script Signed-off-by: Chen Kai <281165273grape@gmail.com> --- docker/.env.default | 2 ++ docker/Dockerfile | 19 ++++++++++++++++++- docker/docker-compose.yml | 26 +++++++++++++++++++++++++- docker/start-hildr-node-java.sh | 2 +- 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/docker/.env.default b/docker/.env.default index a99a90fc..450265d0 100644 --- a/docker/.env.default +++ b/docker/.env.default @@ -62,3 +62,5 @@ L2_TEST_RPC_URL=https://opt-mainnet.g.alchemy.com/v2/ # ------------------------------ Do not modify ------------------------------ COMPOSE_PROJECT_NAME=$NETWORK COMPOSE_PROFILES=hildr-node,metrics,${EXECUTION_CLIENT} + +LOG_LEVEL=DEBUG \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index 75f13221..5c21b275 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -10,13 +10,30 @@ RUN tar -zxvf /tmp/jdk.tar.gz --directory $JAVA_HOME --strip-components 1 ENV PATH=$JAVA_HOME/bin:$PATH RUN java -version RUN native-image --version +ENV MUSL_PKG=https://more.musl.cc/10/x86_64-linux-musl/x86_64-linux-musl-native.tgz \ +TOOLCHAIN_DIR=/usr/musl +RUN wget -c $MUSL_PKG -O /tmp/musl.tgz +RUN mkdir -p $TOOLCHAIN_DIR +RUN tar -zxvf /tmp/musl.tgz --directory $TOOLCHAIN_DIR --strip-components 1 +ENV CC=$TOOLCHAIN_DIR/bin/gcc +ENV ZLIB_PKG=https://zlib.net/current/zlib.tar.gz \ +ZLIB_DIR=/usr/zlib +RUN wget -c $ZLIB_PKG -O /tmp/zlib.tgz +RUN mkdir -p $ZLIB_DIR +RUN tar -zxvf /tmp/zlib.tgz --directory $ZLIB_DIR --strip-components 1 +WORKDIR $ZLIB_DIR +RUN ./configure --prefix=$TOOLCHAIN_DIR --static +RUN make +RUN make install +ENV PATH=$TOOLCHAIN_DIR/bin:$PATH +RUN x86_64-linux-musl-gcc --version WORKDIR /root/hildr COPY . . #RUN ./gradlew -Pagent run --args="--network optimism-goerli --jwt-secret bf549f5188556ce0951048ef467ec93067bc4ea21acebe46ef675cd4e8e015ff --l1-rpc-url https://eth-goerli.g.alchemy.com/v2/4fUcO9-bSvCtGYwwibuWbz7ktjWwuoN3 --l2-rpc-url http://192.168.3.230:8545 --l2-engine-url http://192.168.3.230:8551 --rpc-port 9545 --sync-mode full" #RUN ./gradlew metadataCopy --task run --dir src/main/resources/META-INF/native-image #RUN ./gradlew buildJarForDocker #RUN ./gradlew :hildr-node:clean :hildr-node:nativeCompile -Pmusl -RUN ./gradlew :hildr-node:clean :hildr-node:buildBinary +RUN ./gradlew :hildr-node:clean :hildr-node:buildBinaryStatic #RUN cd /root/hildr/hildr-node/build/docker && \ #native-image -jar hildr-node.jar --no-fallback --enable-http --enable-https --enable-preview --add-modules jdk.incubator.concurrent -H:EnableURLProtocols=http,https --initialize-at-build-time=org.slf4j.LoggerFactory,ch.qos.logback.core.CoreConstants,ch.qos.logback.core.util.Loader,ch.qos.logback.core.util.StatusPrinter,ch.qos.logback.core.status.InfoStatus,ch.qos.logback.classic.Logger,ch.qos.logback.core.rolling.helper.FileNamePattern,ch.qos.logback.classic.Level,ch.qos.logback.core.status.StatusBase,io.opentelemetry.api.trace.ArrayBasedTraceStateBuilder,io.opentelemetry.context.LazyStorage,ch.qos.logback.core.util.FileSize,ch.qos.logback.core.rolling.helper.RollingCalendar,io.opentelemetry.api.internal.ImmutableSpanContext,io.opentelemetry.api.internal.OtelEncodingUtils,ch.qos.logback.classic.PatternLayout,io.opentelemetry.context.ThreadLocalContextStorage,io.opentelemetry.api.trace.PropagatedSpan,io.opentelemetry.context.ContextStorageWrappers,ch.qos.logback.core.rolling.helper.Compressor$1,io.opentelemetry.api.trace.ImmutableTraceFlags,ch.qos.logback.core.rolling.helper.RollingCalendar$1,ch.qos.logback.classic.model.ConfigurationModel,ch.qos.logback.core.model.processor.DefaultProcessor$1,ch.qos.logback.core.model.processor.ImplicitModelHandler$1,ch.qos.logback.core.subst.Token,ch.qos.logback.core.pattern.parser.Parser,ch.qos.logback.core.subst.Parser$1,ch.qos.logback.core.util.Duration,ch.qos.logback.core.model.processor.ChainedModelFilter$1,ch.qos.logback.classic.model.processor.ConfigurationModelHandler,ch.qos.logback.classic.model.processor.LogbackClassicDefaultNestedComponentRules,ch.qos.logback.core.subst.NodeToStringTransformer$1,ch.qos.logback.core.pattern.parser.TokenStream$1,ch.qos.logback.core.subst.Tokenizer$1 --initialize-at-run-time=io.netty.channel.AbstractChannel,io.netty.channel.socket.nio.SelectorProviderUtil,io.netty.util.concurrent.DefaultPromise,io.netty,org.slf4j.MDC,org.github.gestalt.config hildr-node diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 8bd92c9c..08a28096 100755 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -9,7 +9,7 @@ x-logging: &logging services: hildr-node: - image: ghcr.io/optimism-java/hildr:latest +# image: ghcr.io/optimism-java/hildr:latest container_name: hildr-node build: dockerfile: ./docker/jvm.dock @@ -32,6 +32,30 @@ services: - ${OP_ROLLUP_JSON_FILEPATH:-.}:/rollup.json <<: *logging + hildr-node-native: + # image: ghcr.io/optimism-java/hildr:latest + container_name: hildr-node + build: + dockerfile: ./docker/Dockerfile + context: ../ + profiles: + - hildr-node-native + restart: unless-stopped + stop_grace_period: 3m + entrypoint: /scripts/start-hildr-node.sh + depends_on: + - op-geth + env_file: + - .env + ports: + - 9200:9200 + - "${RPC_PORT}:${RPC_PORT}" + volumes: + - ./:/scripts + - data:/data + - ${OP_ROLLUP_JSON_FILEPATH:-.}:/rollup.json + <<: *logging + op-geth: image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:v1.101304.2 container_name: op-geth diff --git a/docker/start-hildr-node-java.sh b/docker/start-hildr-node-java.sh index 746d960f..bd2c5636 100755 --- a/docker/start-hildr-node-java.sh +++ b/docker/start-hildr-node-java.sh @@ -12,7 +12,7 @@ then fi fi -if [ $LOG_LEVEL = "" ] +if [[ $LOG_LEVEL = "" ]] then LOG_LEVEL="INFO" fi