From 8f5297eb97190cf32d58a646bcc6a64fc3fc027f Mon Sep 17 00:00:00 2001 From: nolash Date: Fri, 12 Nov 2021 05:33:46 +0100 Subject: [PATCH] Add bloxberg systemd installer --- README.md | 15 +++++++-------- setup.sh | 13 ------------- setup_bloxberg.sh | 25 ++++++++++++++++++------- systemd/bloxberg.service | 9 +++++++++ systemd/env/01-bloxberg.conf | 2 ++ var/bloxberg/bootnode.toml | 8 ++++---- 6 files changed, 40 insertions(+), 32 deletions(-) create mode 100644 systemd/bloxberg.service create mode 100644 systemd/env/01-bloxberg.conf diff --git a/README.md b/README.md index f8c08f7..e9772f1 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Services installer temporarily for internal use by GE. The os-level dependencies below must be met both at install and run time. -The version numbers are the version numbers used at implmentation time. It may very well work with earlier versions of the components, as long as they are not too old. +The version numbers are the version numbers used at implmentation time. It may very well work with earlier versions of the components, as long as they are not too old. An internet connection will be needed if the python dependencies cannot be resolved locally, either through a local repository or an existing package cache. - systemd (249) - gcc (11.1.0) @@ -80,12 +80,11 @@ systemctl --user status cic-cache-tracker systemctl --user status cic-cache-server ``` -Please note that although installing the bloxberg node is an optional feature of the installer, there is currently no supporting files for running the bloxberg node. - -To run the bloxberg node manually: +The bloxberg node, if installed, runs in the same manner: ``` -/home/lash/.local/bin/parity -c /home/cic/.local/share/io.parity.ethereum/bloxberg/bootnode.toml +systemctl --user start bloxberg +systemctl --user status bloxberg ``` @@ -111,10 +110,12 @@ All paths relative to `$HOME` | `.config/cic/staff-client/user.asc` | gnupg public key used by cicada for authentication | no | | `.config/cic/staff-client/.gnupg` | gnupg homedir used by cicada for authentication | no | | `.config/systemd/user/cic-cache-*.service` | systemd user service definition file for `cic-cache-*` services | yes, with `systemctl --user edit ` | +| `.config/systemd/user/bloxberg.service` | systemd user service definition file for bloxberg | yes, with `systemctl --user edit ` | | `.config/environment.d/01-cic-cache-*.conf` | environment variables for systemd user services | yes | | `.local/share/cic/.gnupg` | gnupg homedir for holding trust keys for global cic configurations | no | | `.local/share/cic/clicada/.secret` | A gnupg encrypted symmetric secret used to encrypt local cached content | no | -| `.local/share/io.parity.ethereum/bloxberg` | Bloxberg configurations and chain data | no | +| `.local/share/io.parity.ethereum/bloxberg` | Bloxberg chain data | no | +| `.config/io.parity.ethereum/bloxberg` | Bloxberg configurations and chain data | bootnode.toml and bootnode.txt only | ## Installing as a different user @@ -130,5 +131,3 @@ machinectl login ``` Another alternative can be to open an `ssh` session. - - diff --git a/setup.sh b/setup.sh index f44592d..a477909 100644 --- a/setup.sh +++ b/setup.sh @@ -123,19 +123,6 @@ if [ $update -gt 0 ]; then fi -#dbg $dbg_info "using CIC_REGISTRY $CIC_REGISTRY_ADDRESS" - -#if [ -z "$CIC_TRUST_ADDRESS" ]; then -# u="$CIC_ROOT_URL/cic_trust_address" -# dbg $dbg_trace "retrieve trust address from $u" -# curl -X GET $u -o cic_trust_address -# gpg --verify cic_trust_address -# export CIC_TRUST_ADDRESS=`gpg -d cic_trust_address` -#fi -#dbg $dbg_info "using CIC_TRUST_ADDRESS $CIC_TRUST_ADDRESS" - -#popd - dbg $dbg_debug "installing configurations" t=`mktemp` if [ -f $HOME/.config/cic/cache/config.ini ]; then diff --git a/setup_bloxberg.sh b/setup_bloxberg.sh index b397944..d5d151e 100644 --- a/setup_bloxberg.sh +++ b/setup_bloxberg.sh @@ -1,8 +1,13 @@ +. aux/bdbg/bdbg.sh +. setup_path.sh + GIT_OPENETHEREUM=${GIT_OPENETHEREUM:-https://github.com/openethereum/openethereum} OPENETHEREUM_PATH=${OPENETHEREUM_PATH:-$HOME/.local/bin/parity} openethereum_dir=`realpath $(dirname $OPENETHEREUM_PATH)` default_openethereum_run=$HOME/.local/share/io.parity.ethereum/bloxberg -OPENETHEREUM_RUN=${OPENETHEREUM_RUN:-$default_openethereum_run} +default_openethereum_config=$HOME/.config/io.parity.ethereum/bloxberg +export OPENETHEREUM_RUN=${OPENETHEREUM_RUN:-$default_openethereum_run} +export OPENETHEREUM_CONFIG=${OPENETHEREUM_CONFIG:-$default_openethereum_config} install_env= if [ ! -f $OPENETHEREUM_PATH ]; then @@ -15,6 +20,8 @@ if [ ! -f $OPENETHEREUM_PATH ]; then git checkout 2662d1925ec794f3ad7c5759b2412ff5128d259b rustup install 1.47.0 cargo build --release --features final + cp -v $t/target/release/parity $HOME/.local/bin/ + export OPENETHEREUM_PATH=$HOME/.local/bin/parity else dbg $dbg_info "found bloxberg node executable in $OPENETHEREUM_PATH" fi @@ -22,12 +29,16 @@ fi #OPENETHEREUM_RUN=$HOME/.local/share/bloxberg if [ ! -d $OPENETHEREUM_RUN ]; then mkdir -vp $OPENETHEREUM_RUN/bootnode - touch $OPENETHEREUM_RUN/bootnode.pwd - dd if=/dev/urandom bs=32 count=1 2> /dev/null | hexdump -v -n 32 -e '1/1 "%02x"' > $OPENETHEREUM_RUN/bootnode.pwd - chmod 400 $OPENETHEREUM_RUN/bootnode.pwd - ./aux/bash-templater/templater.sh var/bloxberg/bootnode.toml > $OPENETHEREUM_RUN/bootnode.toml - cp -v var/bloxberg/bloxberg.json $OPENETHEREUM_RUN/ - cp -v var/bloxberg/bootnodes.txt $OPENETHEREUM_RUN/ + mkdir -vp $OPENETHEREUM_CONFIG + touch $OPENETHEREUM_CONFIG/bootnode.pwd + dd status=xfer if=/dev/urandom bs=32 count=1 2> /dev/null | hexdump -v -n 32 -e '1/1 "%02x"' > $OPENETHEREUM_CONFIG/bootnode.pwd + chmod -v 400 $OPENETHEREUM_CONFIG/bootnode.pwd + ./aux/bash-templater/templater.sh var/bloxberg/bootnode.toml > $OPENETHEREUM_CONFIG/bootnode.toml + cp -v var/bloxberg/bloxberg.json $OPENETHEREUM_CONFIG/ + cp -v var/bloxberg/bootnodes.txt $OPENETHEREUM_CONFIG/ + cp -v systemd/bloxberg.service $HOME/.config/systemd/user/ + ./aux/bash-templater/templater.sh systemd/env/01-bloxberg.conf > $HOME/.config/environment.d/01-bloxberg.conf + systemctl --user daemon-reload fi update_path $openethereum_dir diff --git a/systemd/bloxberg.service b/systemd/bloxberg.service new file mode 100644 index 0000000..f6e7d54 --- /dev/null +++ b/systemd/bloxberg.service @@ -0,0 +1,9 @@ +[Unit] +Description=Bloxberg openethereum node +After=network.target + +[Service] +ExecStart=/bin/bash -c ${OPENETHEREUM_PATH} --config ${OPENETHEREUM_CONFIG}/bootnode.toml + +[Install] +WantedBy=network.target diff --git a/systemd/env/01-bloxberg.conf b/systemd/env/01-bloxberg.conf new file mode 100644 index 0000000..a531617 --- /dev/null +++ b/systemd/env/01-bloxberg.conf @@ -0,0 +1,2 @@ +OPENETHEREUM_PATH={{OPENETHEREUM_PATH}} +OPENETHEREUM_CONFIG={{OPENETHEREUM_CONFIG}} diff --git a/var/bloxberg/bootnode.toml b/var/bloxberg/bootnode.toml index 798f86b..988cf1b 100644 --- a/var/bloxberg/bootnode.toml +++ b/var/bloxberg/bootnode.toml @@ -1,12 +1,12 @@ # File bootnode.toml [parity] -chain = "{{HOME}}/.local/share/io.parity.ethereum/bloxberg/bloxberg.json" -base_path = "{{HOME}}/.local/share/io.parity.ethereum/bloxberg/bootnode" +chain = "{{OPENETHEREUM_CONFIG}}/bloxberg.json" +base_path = "{{OPENETHEREUM_RUN}}/bootnode" [network] port = 30303 -reserved_peers = "{{HOME}}/.local/share/io.parity.ethereum/bloxberg/bootnodes.txt" +reserved_peers = "{{OPENETHEREUM_CONFIG}}/bootnodes.txt" # reserved_only = true max_peers = 100 snapshot_peers = 25 @@ -26,7 +26,7 @@ interface = "all" origins = ["all"] [account] -password = ["{{HOME}}/.local/share/io.parity.ethereum/bloxberg/bootnode.pwd"] +password = ["{{OPENETHEREUM_CONFIG}}/bootnode.pwd"] [footprint] tracing = "on"