Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Commit

Permalink
refactor(offchain): transform host-server-manager into host-runner
Browse files Browse the repository at this point in the history
- Rename the host-server-manager to host-runner.
- Remove redundant files from the host-runner crate.
- Remove dates from copyright.
- Replace env-logger with tracing.
- Replace structopt with clap.
- Use grpc-interfaces crate in host-runner.
- Add host-runner to the offchain workspace Cargo.toml.
- Add host-runner to the offchain Dockerfile.
- Add host-runner to the Github CI.
  • Loading branch information
gligneul committed Jun 21, 2023
1 parent 0bcb783 commit 3244690
Show file tree
Hide file tree
Showing 59 changed files with 873 additions and 3,739 deletions.
3 changes: 2 additions & 1 deletion .github/.scopes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
advance-runner [For every change inside the offchain/advance-runner service]
host-runner [For every change inside the offchain/host-runner service]
dispatcher [For every change inside the offchain/dispatcher service]
graphql-server [For every change inside the offchain/graphql-server service]
indexer [For every change inside the offchain/indexer service]
Expand All @@ -8,4 +9,4 @@ offchain [For every change inside the offchain that doesn't belong to any of the
contracts [For every change inside the onchain/rollups/contracts]
deploy [For every change inside the onchain/rollups/deploy]
arbitration [For every change inside the onchain/rollups-arbitration]
cli [For every change inside the onchain/rollups-cli]
cli [For every change inside the onchain/rollups-cli]
8 changes: 8 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,14 @@ jobs:
image-name: rollups-advance-runner
secrets: inherit

host_runner:
needs: build_docker
uses: ./.github/workflows/docker.yml
with:
target: host-runner
image-name: rollups-host-runner
secrets: inherit

hardhat:
needs: build_docker
uses: ./.github/workflows/docker.yml
Expand Down
8 changes: 8 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ group "default" {
"dispatcher",
"graphql-server",
"hardhat",
"host-runner",
"inspect-server",
"indexer",
"state-server"
Expand Down Expand Up @@ -64,6 +65,13 @@ target "advance-runner" {
context = "."
}

target "host-runner" {
inherits = ["docker-metadata-action", "docker-platforms"]
dockerfile = "offchain/Dockerfile"
target = "host_runner"
context = "."
}

target "hardhat" {
inherits = ["docker-metadata-action", "docker-platforms"]
context = "./onchain"
Expand Down
4 changes: 4 additions & 0 deletions docker-bake.override.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ target "graphql-server" {
tags = ["${DOCKER_ORGANIZATION}/rollups-graphql-server:${TAG}"]
}

target "host-runner" {
tags = ["${DOCKER_ORGANIZATION}/rollups-host-runner:${TAG}"]
}

target "hardhat" {
tags = ["${DOCKER_ORGANIZATION}/rollups-hardhat:${TAG}"]
}
Expand Down
162 changes: 161 additions & 1 deletion offchain/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions offchain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ members = [
"dispatcher",
"graphql-server",
"grpc-interfaces",
"host-runner",
"http-health-check",
"indexer",
"inspect-server",
Expand Down
8 changes: 8 additions & 0 deletions offchain/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ RUN PATH="$PATH:$HOME/.local/bin" cargo build --release --bin advance-runner
FROM builder as graphql_server_build
RUN cargo build --release --bin graphql-server

FROM builder as host_runner_build
RUN cargo build --release --bin host-runner

# define runtime image
FROM debian:bookworm-20230612-slim as runtime
RUN addgroup --system --gid 102 cartesi && \
Expand Down Expand Up @@ -124,6 +127,11 @@ COPY --from=graphql_server_build /usr/src/app/offchain/target/release/graphql-se
USER cartesi
ENTRYPOINT ["/opt/cartesi/bin/graphql-server"]

FROM runtime AS host_runner
COPY --from=host_runner_build /usr/src/app/offchain/target/release/host-runner /opt/cartesi/bin/host-runner
USER cartesi
ENTRYPOINT ["/opt/cartesi/bin/host-runner"]

FROM scratch AS deployments

WORKDIR /opt/cartesi/share/deployments
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
[package]
name = "host-server-manager"
version = "0.9.1"
name = "host-runner"
version = "1.0.0"
edition = "2021"

[[bin]]
name = "host-server-manager"
path = "src/main.rs"
name = "host-runner"

[dependencies]
grpc-interfaces = { path = "../grpc-interfaces" }

actix-web = "4.3"
async-trait = "0.1"
byteorder = "1.4"
env_logger = "0.10"
clap = { version = "4.2", features = ["derive", "env"] }
ethabi = "18.0"
futures-util = "0.3"
hex = "0.4"
log = "0.4"
prost = "0.11"
reqwest = { version = "0.11", features = ["json"] }
serde = { version = "1.0", features = ["derive"] }
sha3 = { version = "0.10", features = ["std"] }
snafu = "0.7"
structopt = "0.3"
tokio = { version = "1.28", features = ["macros", "time", "rt-multi-thread"] }
tonic = "0.9"
tonic-health = "0.9"
ethabi = "18.0"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }

[dev-dependencies]
rollups-http-client = { path = "../rollups-http-client" }

mockall = "0.11"
rand = "0.8"
serial_test = "2.0"
rollup-http-client = { path = "third-party/machine-emulator-tools/linux/rollup/http/rollup-http-client" }

[build-dependencies]
tonic-build = "0.9"
tracing-test = "0.2"
Loading

0 comments on commit 3244690

Please sign in to comment.