diff --git a/Justfile b/Justfile index 346dc84b..87cab5b7 100644 --- a/Justfile +++ b/Justfile @@ -59,10 +59,10 @@ run-indexer mock="": @echo "๐Ÿ” Running indexer" @if [ "{{mock}}" = "mock" ]; then \ echo "๐Ÿงช Using mock data"; \ - RUST_LOG=info cargo run --release --features mock-responses -p indexer_service configs/indexer_config.json; \ + RUST_LOG=info cargo run --release --features mock-responses -p indexer_service configs/debug/indexer_config.json; \ else \ echo "๐Ÿš€ Using real data"; \ - RUST_LOG=info cargo run --release -p indexer_service configs/indexer_config.json; \ + RUST_LOG=info cargo run --release -p indexer_service configs/debug/indexer_config.json; \ fi # Run Explorer. diff --git a/README.md b/README.md index e0de266f..401fff15 100644 --- a/README.md +++ b/README.md @@ -156,7 +156,7 @@ The sequencer and logos blockchain node can be run locally: - `docker compose up` 2. On another terminal go to the `logos-blockchain/logos-execution-zone` repo and run indexer service: - - `RUST_LOG=info cargo run -p indexer_service lez/indexer/service/configs/indexer_config.json` + - `RUST_LOG=info cargo run -p indexer_service lez/indexer/service/configs/debug/indexer_config.json` 3. On another terminal go to the `logos-blockchain/logos-execution-zone` repo and run the sequencer: - `RUST_LOG=info cargo run -p sequencer_service lez/sequencer/service/configs/debug/sequencer_config.json` diff --git a/lez/configs/docker-all-in-one/sequencer_config.json b/lez/configs/docker-all-in-one/sequencer_config.json index edb0132a..90b5d5f3 100644 --- a/lez/configs/docker-all-in-one/sequencer_config.json +++ b/lez/configs/docker-all-in-one/sequencer_config.json @@ -13,7 +13,6 @@ "channel_id": "0101010101010101010101010101010101010101010101010101010101010101", "node_url": "http://logos-blockchain-node-0:18080" }, - "indexer_rpc_url": "ws://indexer_service:8779", "genesis": [ { "supply_bridge_account": { diff --git a/lez/explorer_service/docker-compose.yml b/lez/explorer_service/docker-compose.yml index 7b699a39..46257549 100644 --- a/lez/explorer_service/docker-compose.yml +++ b/lez/explorer_service/docker-compose.yml @@ -2,10 +2,10 @@ services: explorer_service: image: lez/explorer_service build: - context: .. - dockerfile: explorer_service/Dockerfile + context: ../.. + dockerfile: lez/explorer_service/Dockerfile container_name: explorer_service environment: - INDEXER_RPC_URL: ${INDEXER_RPC_URL:-http://localhost:8779} + INDEXER_RPC_URL: ${INDEXER_RPC_URL:-http://host.docker.internal:8779} ports: - - "8080:8080" + - "8081:8080" diff --git a/lez/indexer/service/Dockerfile b/lez/indexer/service/Dockerfile index 3da1eb7f..520b498d 100644 --- a/lez/indexer/service/Dockerfile +++ b/lez/indexer/service/Dockerfile @@ -11,6 +11,7 @@ RUN apt-get update && apt-get install -y \ cmake \ ninja-build \ curl \ + unzip \ git \ && rm -rf /var/lib/apt/lists/* @@ -26,11 +27,11 @@ RUN ARCH=$(uname -m); \ else \ echo "Using manual build for $ARCH"; \ git clone --depth 1 --branch release-3.0 https://github.com/risc0/risc0.git; \ - git clone --depth 1 --branch r0.1.91.1 https://github.com/risc0/rust.git; \ + git clone --depth 1 --branch risc0-1.94.1 https://github.com/risc0/rust.git; \ cd /risc0; \ - cargo install --path rzup; \ + cargo install --locked --path rzup; \ rzup build --path /rust rust --verbose; \ - cargo install --path risc0/cargo-risczero; \ + cargo install --locked --path risc0/cargo-risczero; \ fi ENV PATH="/root/.cargo/bin:/root/.risc0/bin:${PATH}" RUN cp "$(which r0vm)" /usr/local/bin/r0vm @@ -69,6 +70,11 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry/index \ # Runtime stage - minimal image FROM debian:trixie-slim +# Install runtime dependencies +RUN apt-get update && apt-get install -y \ + curl \ + && rm -rf /var/lib/apt/lists/* + # Create non-root user for security RUN useradd -m -u 1000 -s /bin/bash indexer_service_user && \ mkdir -p /indexer_service /etc/indexer_service /var/lib/indexer_service && \ diff --git a/lez/indexer/service/configs/indexer_config.json b/lez/indexer/service/configs/debug/indexer_config.json similarity index 99% rename from lez/indexer/service/configs/indexer_config.json rename to lez/indexer/service/configs/debug/indexer_config.json index f6a0e07c..a3ad0b6a 100644 --- a/lez/indexer/service/configs/indexer_config.json +++ b/lez/indexer/service/configs/debug/indexer_config.json @@ -5,4 +5,4 @@ "addr": "http://localhost:8080" }, "channel_id": "0101010101010101010101010101010101010101010101010101010101010101" -} \ No newline at end of file +} diff --git a/lez/indexer/service/configs/docker/indexer_config.json b/lez/indexer/service/configs/docker/indexer_config.json new file mode 100644 index 00000000..218413d4 --- /dev/null +++ b/lez/indexer/service/configs/docker/indexer_config.json @@ -0,0 +1,8 @@ +{ + "home": ".", + "consensus_info_polling_interval": "1s", + "bedrock_config": { + "addr": "http://host.docker.internal:8080" + }, + "channel_id": "0101010101010101010101010101010101010101010101010101010101010101" +} diff --git a/lez/indexer/service/docker-compose.yml b/lez/indexer/service/docker-compose.yml index e9189cfc..d7ed8651 100644 --- a/lez/indexer/service/docker-compose.yml +++ b/lez/indexer/service/docker-compose.yml @@ -2,14 +2,14 @@ services: indexer_service: image: lez/indexer_service build: - context: ../.. + context: ../../.. dockerfile: lez/indexer/service/Dockerfile container_name: indexer_service ports: - "8779:8779" volumes: # Mount configuration - - ./configs/indexer_config.json:/etc/indexer_service/indexer_config.json + - ./configs/docker/indexer_config.json:/etc/indexer_service/indexer_config.json # Mount data volume - indexer_data:/var/lib/indexer_service diff --git a/lez/sequencer/service/Dockerfile b/lez/sequencer/service/Dockerfile index 5b5d3686..03ee007f 100644 --- a/lez/sequencer/service/Dockerfile +++ b/lez/sequencer/service/Dockerfile @@ -11,6 +11,7 @@ RUN apt-get update && apt-get install -y \ cmake \ ninja-build \ curl \ + unzip \ git \ && rm -rf /var/lib/apt/lists/* @@ -26,11 +27,11 @@ RUN ARCH=$(uname -m); \ else \ echo "Using manual build for $ARCH"; \ git clone --depth 1 --branch release-3.0 https://github.com/risc0/risc0.git; \ - git clone --depth 1 --branch r0.1.91.0 https://github.com/risc0/rust.git; \ + git clone --depth 1 --branch risc0-1.94.1 https://github.com/risc0/rust.git; \ cd /risc0; \ - cargo install --path rzup; \ + cargo install --locked --path rzup; \ rzup build --path /rust rust --verbose; \ - cargo install --path risc0/cargo-risczero; \ + cargo install --locked --path risc0/cargo-risczero; \ fi ENV PATH="/root/.cargo/bin:/root/.risc0/bin:${PATH}" RUN cp "$(which r0vm)" /usr/local/bin/r0vm @@ -81,16 +82,21 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry/index \ # Runtime stage - minimal image FROM debian:trixie-slim +# Install runtime dependencies +RUN apt-get update && apt-get install -y \ + curl \ + && rm -rf /var/lib/apt/lists/* + # Create non-root user for security -RUN useradd -m -u 1000 -s /bin/bash sequencer_user && \ +RUN useradd -m -u 1000 -s /bin/bash sequencer_service_user && \ mkdir -p /sequencer_service /etc/sequencer_service /var/lib/sequencer_service && \ - chown -R sequencer_user:sequencer_user /sequencer_service /etc/sequencer_service /var/lib/sequencer_service + chown -R sequencer_service_user:sequencer_service_user /sequencer_service /etc/sequencer_service /var/lib/sequencer_service # Copy binary from builder -COPY --from=builder --chown=sequencer_user:sequencer_user /usr/local/bin/sequencer_service /usr/local/bin/sequencer_service +COPY --from=builder --chown=sequencer_service_user:sequencer_service_user /usr/local/bin/sequencer_service /usr/local/bin/sequencer_service # Copy r0vm binary from builder -COPY --from=builder --chown=sequencer_user:sequencer_user /usr/local/bin/r0vm /usr/local/bin/r0vm +COPY --from=builder --chown=sequencer_service_user:sequencer_service_user /usr/local/bin/r0vm /usr/local/bin/r0vm VOLUME /var/lib/sequencer_service @@ -103,7 +109,7 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ -H "Content-Type: application/json" \ -d "{ \ \"jsonrpc\": \"2.0\", \ - \"method\": \"hello\", \ + \"method\": \"checkHealth\", \ \"params\": {}, \ \"id\": 1 \ }" || exit 1 @@ -114,7 +120,7 @@ ENV RUST_LOG=info # Set explicit location for r0vm binary ENV RISC0_SERVER_PATH=/usr/local/bin/r0vm -USER sequencer_user +USER sequencer_service_user WORKDIR /sequencer_service CMD ["sequencer_service", "/etc/sequencer_service/sequencer_config.json"] diff --git a/lez/sequencer/service/configs/debug/sequencer_config.json b/lez/sequencer/service/configs/debug/sequencer_config.json index 359c84f4..bdf4e53d 100644 --- a/lez/sequencer/service/configs/debug/sequencer_config.json +++ b/lez/sequencer/service/configs/debug/sequencer_config.json @@ -13,7 +13,6 @@ "channel_id": "0101010101010101010101010101010101010101010101010101010101010101", "node_url": "http://localhost:8080" }, - "indexer_rpc_url": "ws://localhost:8779", "genesis": [ { "supply_bridge_account": { diff --git a/lez/sequencer/service/configs/docker/sequencer_config.json b/lez/sequencer/service/configs/docker/sequencer_config.json index 69238fe7..5b9cda81 100644 --- a/lez/sequencer/service/configs/docker/sequencer_config.json +++ b/lez/sequencer/service/configs/docker/sequencer_config.json @@ -11,9 +11,8 @@ "max_retries": 5 }, "channel_id": "0101010101010101010101010101010101010101010101010101010101010101", - "node_url": "http://localhost:18080" + "node_url": "http://host.docker.internal:8080" }, - "indexer_rpc_url": "ws://localhost:8779", "genesis": [ { "supply_bridge_account": { diff --git a/lez/sequencer/service/docker-compose.yml b/lez/sequencer/service/docker-compose.yml index d9c7c2be..1b5811c4 100644 --- a/lez/sequencer/service/docker-compose.yml +++ b/lez/sequencer/service/docker-compose.yml @@ -2,7 +2,7 @@ services: sequencer_service: image: lez/sequencer_service build: - context: ../.. + context: ../../.. dockerfile: lez/sequencer/service/Dockerfile container_name: sequencer_service ports: