Containers

NOTE: The following directions use podman for container management/instantiation. This has CLI-level compatibility with docker, so the following could be run with s/podman/docker

The Container

The container is located at:

  • us-docker.pkg.dev/eluvio-containers-339519/public/elvmasterd-validator:latest

This can be pulled simply with:

podman pull us-docker.pkg.dev/eluvio-containers-339519/public/elvmasterd-validator:latest

It can then be verified with

podman run -ti --rm --name elvmasterd elvmasterd-validator:latest version

Container ENTRYPOINT

This container can be used as a stand-in for elvmasterd. The verification step above is equivalent to:

elvmasterd version

Any use of elvmasterd that can be needed is accessible this way. But, the container is more than just a proxy for elvmasterd. It also wraps two common steps:

  1. Wallet creation and initial setup (setup)
  2. Starting the daemon (daemon-start)

The container does this by use of a custom ENTRYPOINT.

Using containers

The permutations of ways this container can be used is limitless. For example, cloud providers like Google Cloud and AWS allow directly running machine instances based solely on a container. This document will not cover all those methods in detail. The following info is useful for understanding the remainder of the documentation, as well as determining best steps to run this on container solutions that are not podman on a Linux system.

  • Data is stored in the container at /data. By default, this directory will not persist. To make it persist, at a minimum, specify it as a volume (e.g. podman/docker’s -v flag). This volume can be a bare volume in the container environment, but it should be backed by a fast physical disk, as detailed in the Validator Setup Storage section
  • Configuration is stored in the container at /conf. Like data, this should be in a volume for persistence. This does not need to be performant storage, but it needs to be secure since an artifact of the setup process is a wallet/key pair.
  • Give the container a name. This will make it easy to use exec or to remove older instantiations. Paired with --rm=true makes it easy to keep things tidy.
  • This container will need to expose/bind a TCP and UDP port.

Setting up a new sever/validator

NOTE: Per the previous section, storage will be in a local filesystem volume of /fast-disk. It is presumed that whatever volume is used in your deployment, it exists and is read/writable by the user running the container. Also, flags like --rm=true and a name of --name org-validator-01 is used.

Using the setup verb will create a new wallet and place the info in /data and /conf of the container. The wallet is not protected by a password.

Here is an example of the container and setup in action:

podman run \
   --hostname org-validator-01 --rm=true -ti \
   -v /fast-disk/conf:/conf \
   -v /fast-disk/data:/data \
   -p 40304:40304 \
   -p 40304:40304/udp \
   elvmasterd-validator:latest setup

NOTE: the --hostname is used to set the “identity” in the config.toml

DEBUG: /usr/local/bin/elvmasterd-wrapper: arg -> will enter config setup
DEBUG: /usr/local/bin/elvmasterd-wrapper: Setting up config
DEBUG: /usr/local/bin/elvmasterd-wrapper: Setup presumes a podman/docker volume is mapped to /conf and /data
INFO [01-27|23:23:34.841] RECOVERED GENESIS block from enc_block parameter
ERROR[01-27|23:23:34.842] Failed to enumerate USB devices          hub=ledger vendor=11415 failcount=1 err="failed to initialize libusb: libusb: unknown error [code -99]"
ERROR[01-27|23:23:34.842] Failed to enumerate USB devices          hub=trezor vendor=21324 failcount=1 err="failed to initialize libusb: libusb: unknown error [code -99]"
ERROR[01-27|23:23:34.842] Failed to enumerate USB devices          hub=trezor vendor=4617  failcount=1 err="failed to initialize libusb: libusb: unknown error [code -99]"
ERROR[01-27|23:23:34.842] Failed to enumerate USB devices          hub=ledger vendor=11415 failcount=2 err="failed to initialize libusb: libusb: unknown error [code -99]"
ERROR[01-27|23:23:34.842] Failed to enumerate USB devices          hub=trezor vendor=21324 failcount=2 err="failed to initialize libusb: libusb: unknown error [code -99]"
ERROR[01-27|23:23:34.842] Failed to enumerate USB devices          hub=trezor vendor=4617  failcount=2 err="failed to initialize libusb: libusb: unknown error [code -99]"
INFO [01-27|23:23:34.842] Allocated cache and file handles         database=/data/elvmasterd/chaindata cache=16.00MiB handles=16
INFO [01-27|23:23:34.886] Writing custom genesis block
INFO [01-27|23:23:34.886] Persisted trie from memory database      nodes=11 size=1.81KiB time=108.538µs gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [01-27|23:23:34.887] Successfully wrote genesis state         database=chaindata                  hash=d43591…3719f8
INFO [01-27|23:23:34.887] Allocated cache and file handles         database=/data/elvmasterd/lightchaindata cache=16.00MiB handles=16
INFO [01-27|23:23:34.921] Writing custom genesis block
INFO [01-27|23:23:34.921] Persisted trie from memory database      nodes=11 size=1.81KiB time=76.809µs  gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [01-27|23:23:34.921] Successfully wrote genesis state         database=lightchaindata                  hash=d43591…3719f8
DEBUG: /usr/local/bin/elvmasterd-wrapper: Config setup DONE

The set the wallet passphrase rather than using the default empty string, set the ELVMASTERD_PASS variable and pass it in using --env like so:

ELVMASTERD_PASS='colla$se t0wer Strike' podman run \
   --hostname org-validator-01 --rm=true -ti \
   --env ELVMASTERD_PASS \
   -v /fast-disk/conf:/conf \
   -v /fast-disk/data:/data \
   -p 40304:40304 \
   -p 40304:40304/udp \
   elvmasterd-validator:latest setup

From this point, it is then possible to start the elvmasterd process to begin syncing the data:

podman run \
   --name org-validator-01 --rm=true -d \
   -v /fast-disk/conf:/conf \
   -v /fast-disk/data:/data \
   -p 40304:40304 \
   -p 40304:40304/udp \
   elvmasterd-validator:latest daemon-start

Sharing enode and other info

To get access to the address and enode info used to connect peers and allow voting into the clique, simply run the /usr/local/bin/print_validator_info script in the running container.

For example, here is the operation done on the container named similar to the above (org-validator-01):

podman exec -ti org-validator-01 /usr/local/bin/print_validator_info
$ podman pull us-docker.pkg.dev/eluvio-containers-339519/public/elvmasterd-validator:latest
Trying to pull us-docker.pkg.dev/eluvio-containers-339519/public/elvmasterd-validator:latest...
Getting image source signatures
Copying blob adf708d50b1a skipped: already exists
Copying blob 704fb6137790 skipped: already exists
Copying blob 23bfca7ac8c1 done
Copying blob 489626614d14 done
Copying blob 9abf515c7619 done
Copying config 5a86fe623b done
Writing manifest to image destination
Storing signatures
5a86fe623b828f49c4827eef25ea07e94cc3dd62e7e0e43bc7021eb2f1152cfc

$ ELVMASTERD_PASS='colla$se t0wer Strike' podman run --hostname org-validator-01 --rm=true --env ELVMASTERD_PASS -ti -v /fast-disk/conf:/conf -v /fast-disk/data:/data elvmasterd-validator:latest setup
DEBUG: /usr/local/bin/elvmasterd-wrapper: arg -> will enter config setup
DEBUG: /usr/local/bin/elvmasterd-wrapper: Setting up config
DEBUG: /usr/local/bin/elvmasterd-wrapper: Setup presumes a podman/docker volume is mapped to /conf and /data
INFO [01-28|02:58:27.661] RECOVERED GENESIS block from enc_block parameter
ERROR[01-28|02:58:27.662] Failed to enumerate USB devices          hub=ledger vendor=11415 failcount=1 err="failed to initialize libusb: libusb: unknown error [code -99]"
ERROR[01-28|02:58:27.662] Failed to enumerate USB devices          hub=trezor vendor=21324 failcount=1 err="failed to initialize libusb: libusb: unknown error [code -99]"
ERROR[01-28|02:58:27.662] Failed to enumerate USB devices          hub=trezor vendor=4617  failcount=1 err="failed to initialize libusb: libusb: unknown error [code -99]"
ERROR[01-28|02:58:27.662] Failed to enumerate USB devices          hub=ledger vendor=11415 failcount=2 err="failed to initialize libusb: libusb: unknown error [code -99]"
ERROR[01-28|02:58:27.662] Failed to enumerate USB devices          hub=trezor vendor=21324 failcount=2 err="failed to initialize libusb: libusb: unknown error [code -99]"
ERROR[01-28|02:58:27.662] Failed to enumerate USB devices          hub=trezor vendor=4617  failcount=2 err="failed to initialize libusb: libusb: unknown error [code -99]"
INFO [01-28|02:58:27.662] Allocated cache and file handles         database=/data/elvmasterd/chaindata cache=16.00MiB handles=16
INFO [01-28|02:58:27.711] Writing custom genesis block
INFO [01-28|02:58:27.712] Persisted trie from memory database      nodes=11 size=1.81KiB time=128.867µs gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [01-28|02:58:27.713] Successfully wrote genesis state         database=chaindata                  hash=d43591…3719f8
INFO [01-28|02:58:27.713] Allocated cache and file handles         database=/data/elvmasterd/lightchaindata cache=16.00MiB handles=16
INFO [01-28|02:58:27.755] Writing custom genesis block
INFO [01-28|02:58:27.756] Persisted trie from memory database      nodes=11 size=1.81KiB time=125.528µs gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [01-28|02:58:27.756] Successfully wrote genesis state         database=lightchaindata                  hash=d43591…3719f8
DEBUG: /usr/local/bin/elvmasterd-wrapper: Config setup DONE

$ podman run --name org-validator-01 --rm=true -d -v /fast-disk/conf:/conf -v /fast-disk/data:/data -p 40304:40304 -p 40304:40304/udp elvmasterd-validator:latest daemon-start
cb8b4f06a0c15f6be214ffcd588041e4b702b742dcab622df8bf2d1b0d527b7d

$ podman ps -a
CONTAINER ID  IMAGE                        COMMAND       CREATED        STATUS            PORTS   NAMES
cb8b4f06a0c1  elvmasterd-validator:latest  daemon-start  3 seconds ago  Up 3 seconds ago          org-validator-01

$ podman exec -ti org-validator-01 /usr/local/bin/print_validator_info
Details to provide other validators:
	enode: d3af7d732f870fa30a5afa8c5af90fb09d83e08ec7b44b48e31cc06167b1b09e85ff3b84a9e011696dbe3a2d1180a6bf13bc72b71974811f0add73109b58a24e
	address: 0xNOT7BF2REAL153IN65ANY53WAYbdATCfALLc190E

Keep this info for your records to recreate wallet:
	mnemonic: one two three four five six seven eight nine ten eleven twelve