Skip to content

Commit

Permalink
Merge pull request #38 from ethpandaops/skylenet/make-web-server-opti…
Browse files Browse the repository at this point in the history
…onal

make web server optional
  • Loading branch information
skylenet authored Jun 7, 2023
2 parents 4b310ee + c6c0bc2 commit 675da72
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 22 deletions.
32 changes: 11 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,36 @@
# ethereum-genesis-generator

Create a ethereum consensus/execution layer testnet genesis and expose it via a webserver for testing purposes.
Create a ethereum consensus/execution layer testnet genesis and optionally expose it via a web server for testing purposes.

### Examples

Running with the default configuration. Check the [config-example](config-example) directory.
You can provide your own configuration directory. Have a look at the example in [`config-example`](config-example).

```sh
mkdir data
docker run --rm -it -u $UID -v $PWD/data:/data -p 127.0.0.1:8000:8000 ethpandaops/ethereum-genesis-generator:latest all # Create EL+CL genesis
docker run --rm -it -u $UID -v $PWD/data:/data -p 127.0.0.1:8000:8000 ethpandaops/ethereum-genesis-generator:latest cl # Just CL
docker run --rm -it -u $UID -v $PWD/data:/data -p 127.0.0.1:8000:8000 ethpandaops/ethereum-genesis-generator:latest el # Just EL
```

You can overwrite configuration files. To do so, please update the values in the `config-example/values.env` file
apply it using the docker volume mount:
# Create the output directory
mkdir output

```sh
# Overwriting the config files and generating the EL and CL genesis
docker run --rm -it -u $UID -v $PWD/data:/data -p 127.0.0.1:8000:8000 \
docker run --rm -it -u $UID -v $PWD/output:/data \
-v $PWD/config-example:/config \
ethpandaops/ethereum-genesis-generator:latest all

# Just creating the EL genesis
docker run --rm -it -u $UID -v $PWD/data:/data -p 127.0.0.1:8000:8000 \
docker run --rm -it -u $UID -v $PWD/output:/data \
-v $PWD/config-example:/config \
ethpandaops/ethereum-genesis-generator:latest el

# Just creating the CL genesis
docker run --rm -it -u $UID -v $PWD/data:/data -p 127.0.0.1:8000:8000 \
docker run --rm -it -u $UID -v $PWD/output:/data \
-v $PWD/config-example:/config \
ethpandaops/ethereum-genesis-generator:latest cl
```

After that, access `http://localhost:8000` on your browser to see the genesis files

### Environment variables

Name | Default | Description
---- |-------- | ----
SERVER_PORT | 8000 | Web server port
Name | Default | Description
-------------- |-------- | ----
SERVER_ENABLED | false | Enable a web server that will serve the generated files
SERVER_PORT | 8000 | Web server port

Besides that, you can also use ENV vars in your configuration files. One way of doing this is via the [values.env](config-example/values.env) configuration file. These will be replaced during runtime.

Expand All @@ -51,4 +42,3 @@ eth2-testnet-genesis | https://github.com/protolambda/eth2-testnet-genesis
eth2-val-tools | https://github.com/protolambda/eth2-val-tools
zcli | https://github.com/protolambda/zcli
el-gen | [apps/el-gen](apps/el-gen)

5 changes: 4 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash -e
source /config/values.env
SERVER_ENABLED="${SERVER_ENABLED:-false}"
SERVER_PORT="${SERVER_PORT:-8000}"
WITHDRAWAL_ADDRESS="${WITHDRAWAL_ADDRESS:-0xf97e180c050e5Ab072211Ad2C213Eb5AEE4DF134}"

Expand Down Expand Up @@ -99,4 +100,6 @@ case $1 in
esac

# Start webserver
cd /data && exec python -m SimpleHTTPServer "$SERVER_PORT"
if [ "$SERVER_ENABLED" = true ] ; then
cd /data && exec python -m SimpleHTTPServer "$SERVER_PORT"
fi

0 comments on commit 675da72

Please sign in to comment.