Skip to content

Issue #374 - support for Hived node exchange deployment

Bartek Wrona requested to merge bw_issue_374_exchange_deployment into develop

build_and_setup_exchange_instance.sh allows to be downloaded from gitlab and next executed without cloning repository. Only dockerized deployment is supported, to eliminate need to install hived dependencies on host machine.

Building step.

Script covers following deployment scenarios:

  1. On local machine exists already prebuilt image to be deployed - then source checkout and build procedures are skipped.
  2. If build step is needed, it can be done by checkout of specified branch or using existing directory containing hived sources (see --use-source-dir and --branch options)

Prepare step for Hived node data directory

  1. If not present, config.ini file is automatically copied from doc/example_config.ini. Otherwise it is left untouched.
  2. If block_log or block_log.artifacts file(s) are missing in the blockchain sudirectory located inside specified node data-directory, they will be automatically downloaded. By default, there is used https://gtg.openhive.network/get/blockchain/compressed/ url, which can be customized by passing alternate url to --block-log-base-url option.
  3. Additional (regular) hived options can be passed directly to the script to intruct hived to perform some actions (i.e. loading snapshot or performing a replay).

Script options:

Script supports --help to display its options.

./scripts/build_and_setup_exchange_instance.sh parameters: --help
Usage: ./scripts/build_and_setup_exchange_instance.sh <image_tag> [OPTION[=VALUE]]... [<hived_option>]...

Setup script for a Hived instance dedicated to use of exchange purposes.
Allows to (optionally build if not present) image containing preconfigured hived instance and next start a container holding it.
If you need to rebuild image, just remove the image using docker tools

OPTIONS:
  --webserver-http-endpoint=<endpoint>  Allows to map hived internal http endpoint to specified external one. As endpoint can be passed simple port number or ip-address:port.
  --webserver-ws-endpoint=<endpoint>    Allows to map hived internal WS endpoint to specified external one. As endpoint can be passed simple port number or ip-address:port.
  --p2p-endpoint=<endpoint>             Allows to map hived internal P2P endpoint to specified external one. As endpoint can be passed simple port number or ip-address:port.
  --data-dir=DIRECTORY_PATH             Obligatory. Allows to specify given directory as hived data directory. If this directory does not contain a config.ini file, default one will be created.
  --shared-file-dir=DIRECTORY_PATH      Allows to specify dedicated location for shared_memory_file.bin

  --branch=branch                       Optionally specify a branch of Hived to checkout and build. Defaults to master branch.
  --use-source-dir=PATH                 Allows to specify explicit Hived source directory instead of performing git clone/checkout.

  --block-log-base-url=url              Optional, allows to download Hive blockchain block_log file(s) from given url. File(s) will be downloaded into `blockchain` subdirectory located inside specified node data directory (by --data-dir option).
  --name=CONTAINER_NAME                 Allows to specify a dedicated name to the spawned container instance
  --docker-option=OPTION                Allows to specify additional docker option, to be passed to underlying docker run spawn.

  --option-file=PATH                    Allows to specify options through file
  --help                                Display this help screen and exit
Edited by Bartek Wrona

Merge request reports