Skip to content

Commit

Permalink
Merge pull request #18 from 0glabs/docker-file
Browse files Browse the repository at this point in the history
chore: Docker file
  • Loading branch information
MiniFrenchBread authored Oct 8, 2024
2 parents aa8eb21 + 82248b9 commit faeed84
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM rust
VOLUME ["/data"]
COPY . .
RUN apt-get update && apt-get install -y protobuf-compiler libclang-dev clang
RUN ./dev_support/download_params.sh
RUN cargo build --release
CMD ["./target/release/server", "--config", "config.toml"]
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,62 @@
# 0g-DA-signer

## Download Encoding Params

Download verifier params before running server by
```sh
./dev_support/download_params.sh
```

## Configuration

Create a `config.toml` file and set the following field to proper values:
```
log_level = "info"
data_path = "./db/"
# path to downloaded params folder
encoder_params_dir = "params/"
# grpc server listen address
grpc_listen_address = "0.0.0.0:34000"
# chain eth rpc endpoint
eth_rpc_endpoint = ""
# public grpc service socket address to register in DA contract
# ip:34000 (keep same port as the grpc listen address)
# or if you have dns, fill your dns
socket_address = "<public_ip/dns>"
# data availability contract to interact with
da_entrance_address = ""
# deployed block number of da entrance contract
start_block_number = 0
# signer BLS private key
signer_bls_private_key = ""
# signer eth account private key
signer_eth_private_key = ""
# miner eth account private key, (could be the same as `signer_eth_private_key`, but not recommended)
miner_eth_private_key = ""
# whether to enable data availability sampling
enable_das = "true"
```

# Build from source
```
cargo build --release
./target/release/server --config config.toml
```

# Run in Docker
set following fields in your `config.toml`:
```
data_path = "/data"
encoder_params_dir = "/params"
```
build docker image and run:
```
docker build -t 0g-da-node .
docker run -d -v <YOUR_DATA_FOLDER>:/data -v <YOUR_CONFIG_TOML>:/config.toml --name <CONTAINER_NAME> --net=host 0g-da-node
```
2 changes: 1 addition & 1 deletion chain-state/src/da_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub async fn start_da_monitor(chain_state: Arc<ChainState>, start_block_number:
match check_da_logs(chain_state.clone()).await {
Ok(_) => {}
Err(e) => {
error!("poll check_new_epoch error: {:?}", e);
error!("poll da logs error: {:?}", e);
}
}
sleep(Duration::from_secs(5)).await;
Expand Down

0 comments on commit faeed84

Please sign in to comment.