mirror of https://gitlab.syncad.com/hive/hive.git
Supplemented description for exchanges specific to manual steps performed in dockerized deployment.
This commit is contained in:
parent
bf35c24fe2
commit
03253737cf
|
@ -58,6 +58,12 @@ But if you would still like to build from source, we also have [build instructio
|
|||
|
||||
Building a docker image is described here: [Building under Docker](https://gitlab.syncad.com/hive/hive/-/blob/master/doc/building.md#building-under-docker)
|
||||
|
||||
If you'd like to use our already pre-built official binary images, it's as simple as downloading it from the Dockerhub registry with only one command:
|
||||
|
||||
```
|
||||
docker pull hiveio/hive
|
||||
```
|
||||
|
||||
To run a Hive consensus node there are needed resources:
|
||||
- data directory to hold a blockchain file(s) (ca 400GB is required)
|
||||
- storage to hold a shared memory file (ca. 24GB of memory is required at the moment to store state data):
|
||||
|
|
|
@ -57,25 +57,13 @@ Both scenarios using --replay-blockchain, allows to continue previously stopped
|
|||
|
||||
Script accepts all options provided by hived. If you want to specify different p2p or http port, please use `--p2p-endpoint=` or `--webserver-http-endpoint=` or `--webserver-ws-endpoint=` options, since script will transpose them into docker port mappings accordingly.
|
||||
|
||||
### Clone the hive repo
|
||||
To start a cli_wallet in the dockerized environment, simplest solution is to use [run_cli_wallet_img.sh](://gitlab.syncad.com/hive/hive/-/blob/master/scripts/run_cli_wallet_img.sh). It assumes that wallet.json file should be located in the data-dir mapped to previously started hived container. So using paths specified in the exampole, you should **copy** it into `"$(pwd)/datadir/` directory and next start script.
|
||||
|
||||
Pull in the hive repo from the official source on github and then change into the directory that's created for it.
|
||||
```
|
||||
git clone https://github.com/openhive-network/hive
|
||||
cd hive
|
||||
```
|
||||
cli_wallet can be started in the interactive mode (default) or network daemon (handling JSON calls). To start a network daemon let's use `--rpc-http-endpoint=0.0.0.0:8093` and `--rpc-http-allowip=172.17.0.1` (default docker network IP range - please verify it before use).
|
||||
|
||||
### Build the image from source with docker
|
||||
### Performing each setup steps separately.
|
||||
|
||||
Docker isn't just for downloading already built images, it can be used to build from source the same way you would otherwise build. By doing this you ensure that your build environment is identical to what we use to develop the software. Use the below command to start the build:
|
||||
|
||||
```
|
||||
docker build -t=hiveio/hive --target=consensus_node .
|
||||
```
|
||||
|
||||
Don't forget the `.` at the end of the line which indicates the build target is in the current directory.
|
||||
|
||||
### Using our official Docker images without building from source
|
||||
This kind of setup mostly is covered by general build procedures - described in [building.md](https://gitlab.syncad.com/hive/hive/-/blob/master/doc/building.md#building-under-docker).
|
||||
|
||||
If you'd like to use our already pre-built official binary images, it's as simple as downloading it from the Dockerhub registry with only one command:
|
||||
|
||||
|
@ -83,54 +71,25 @@ If you'd like to use our already pre-built official binary images, it's as simpl
|
|||
docker pull hiveio/hive
|
||||
```
|
||||
|
||||
Running a docker image, in the API node case (specific to exhange deployment) like also using dockerized version of cli_wallet is described [here](https://gitlab.syncad.com/hive/hive/-/blob/master/README.md#scenarios-of-using-dockerized-hived-assumed-mainnet-configuration)
|
||||
|
||||
### Running a binary build without a Docker container
|
||||
|
||||
If you build with Docker but do not want to run hived from within a docker container, you can stop here with this step and instead extract the binary from the container with the commands below. If you are going to run hived with docker (recommended method), skip this step altogether. We're simply providing an option for everyone's use-case. Our binaries are built mostly static, only dynamically linking to linux kernel libraries. We have tested and confirmed binaries built in Docker work on Ubuntu and Fedora and will likely work on many other Linux distrubutions. Building the image yourself or pulling one of our pre-built images both work.
|
||||
|
||||
To extract the binary you need to start a container and then copy the file from it.
|
||||
To extract the binary you can use [export-binaries.sh](https://gitlab.syncad.com/hive/hive/-/blob/master/scripts/export-binaries.sh) or start a container and then copy the file from it:
|
||||
|
||||
```
|
||||
docker run -d --name hived-exchange hiveio/hive
|
||||
docker cp hived-exchange:/usr/local/hive/consensus/bin/hived /local/path/to/hived
|
||||
docker cp hived-exchange:/usr/local/hive/consensus/bin/cli_wallet /local/path/to/cli_wallet
|
||||
docker cp hived-exchange:/home/hived/bin/hived /local/path/to/hived
|
||||
docker cp hived-exchange:/home/hived/bin/cli_wallet /local/path/to/cli_wallet
|
||||
docker stop hived-exchange
|
||||
```
|
||||
|
||||
### Configuration file
|
||||
|
||||
For your convenience, we have provided a provided an [example\_config](example\_config.ini) that we expect should be sufficient to run your exchange node. Be sure to rename it to simply `config.ini`. Be sure to set the account name of your wallet account that you would like to track account history for in the config file. It is defined as `account-history-rocksdb-track-account-range = ["accountname","accountname"]`.
|
||||
If you want to use custom configuration while using docker, you can place this outside of your container and map to it by adding this argument to your docker run command: `-v /path/to/config.ini:/usr/local/hive/consensus/datadir/config.ini`.
|
||||
|
||||
### Create directories to store blockchain and wallet data outside of Docker
|
||||
|
||||
For re-usability, you can create directories to store blockchain and wallet data and easily link them inside your docker container.
|
||||
|
||||
```
|
||||
mkdir datadir
|
||||
mkdir hivewallet
|
||||
```
|
||||
|
||||
### Run the container
|
||||
|
||||
The below command will start a daemonized instance opening ports for p2p and RPC while linking the directories we created for blockchain and wallet data inside the container. Fill in `TRACK_ACCOUNT` with the name of your exchange account that you want to follow. The `-v` flags are how you map directories outside of the container to the inside, you list the path to the directories you created earlier before the `:` for each `-v` flag. The restart policy ensures that the container will automatically restart even if your system is restarted.
|
||||
|
||||
```
|
||||
docker run -d --name hived-exchange --env TRACK_ACCOUNT=nameofaccount --env USE_PUBLIC_BLOCKLOG=1 -p 2001:2001 -p 8090:8090 -v /path/to/hivewallet:/var/hivewallet -v /path/to/datadir:/usr/local/hive/consensus/datadir -v /home/exchange/datadir/config.ini:/usr/local/hive/consensus/datadir/config.ini --restart always hiveio/hive
|
||||
```
|
||||
|
||||
You can see that the container is running with the `docker ps` command.
|
||||
|
||||
To follow along with the logs, use `docker logs -f`.
|
||||
|
||||
Initial syncing will take between 12 and 72 hours depending on your equipment, faster storage devices will take less time and be more efficient. Subsequent restarts will not take as long.
|
||||
|
||||
### Running the cli_wallet
|
||||
|
||||
The command below will run the cli_wallet from inside the running container while mapping the `wallet.json` to the directory you created for it on the host.
|
||||
|
||||
```
|
||||
docker exec -it hived-exchange /usr/local/hive/consensus/bin/cli_wallet -w /var/hivewallet/wallet.json
|
||||
```
|
||||
If you want to use custom configuration while using docker, you can place this outside of your container and copy it into a data-dir mapped to your container.
|
||||
|
||||
### Upgrading for major releases that require a full reindex
|
||||
|
||||
|
@ -144,7 +103,7 @@ docker rm hived-exchange
|
|||
rm -rf datadir/blockchain/account-history-rocksdb-storage datadir/blockchain/block_log.index datadir/blockchain/shared_memory.bin
|
||||
touch datadir/blockchain/force_replay
|
||||
docker pull hiveio/hive
|
||||
docker run -d --name hived-exchange --env TRACK_ACCOUNT=nameofaccount --env USE_PUBLIC_BLOCKLOG=1 -p 2001:2001 -p 8090:8090 -v /path/to/hivewallet:/var/hivewallet -v /path/to/datadir:/usr/local/hive/consensus/datadir -v /home/exchange/datadir/config.ini:/usr/local/hive/consensus/datadir/config.ini --restart always hiveio/hive
|
||||
run_hived_img.sh hiveio/hive --name=hived-exchange --docker-option="-p 8093:8093" --data-dir=$(pwd)/datadir --shared-file-dir=/dev/shm/hived/consensus_node --webserver-http-endpoint=0.0.0.0:8091 --webserver-ws-endpoint=0.0.0.0:8090 --p2p-endpoint=0.0.0.0:2001 --force-replay
|
||||
```
|
||||
|
||||
### Upgrading for releases that do not require a reindex
|
||||
|
@ -155,5 +114,5 @@ For upgrades that do not require a full replay, you would use the following inst
|
|||
docker stop hived-exchange
|
||||
docker rm hived-exchange
|
||||
docker pull hiveio/hive
|
||||
docker run -d --name hived-exchange --env TRACK_ACCOUNT=nameofaccount --env USE_PUBLIC_BLOCKLOG=1 -p 2001:2001 -p 8090:8090 -v /path/to/hivewallet:/var/hivewallet -v /path/to/datadir:/usr/local/hive/consensus/datadir -v /home/exchange/datadir/config.ini:/usr/local/hive/consensus/datadir/config.ini --restart always hiveio/hive
|
||||
run_hived_img.sh hiveio/hive --name=hived-exchange --docker-option="-p 8093:8093" --data-dir=$(pwd)/datadir --shared-file-dir=/dev/shm/hived/consensus_node --webserver-http-endpoint=0.0.0.0:8091 --webserver-ws-endpoint=0.0.0.0:8090 --p2p-endpoint=0.0.0.0:2001
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue