Hive Node-in-a-box FAQ / Help

How do I update Hive-in-a-box (HIAB) or the hive software on my Node-in-a-box (NIAB) server?

Updating Hive-in-a-box (HIAB)

You can update HIAB's core files (the application which helps with managing Hive nodes) very easily, and you do not have to stop/restart your node to do this.

Simply run the following commands, in order:

su
cd /hive
git checkout master
git pull

Your Hive-in-a-box core files are now up to date :)

Updating Hive itself

For minor updates which don't require a replay, for example upgrading from 0.22.1 to 0.22.2, you may do this yourself quite easily.

Before updating, make sure your HIAB core files are up to date (see above), as there may be important fixes to HIAB itself that are needed to upgrade hive safely.

To update to the latest available Hive image:

su
cd /hive
./run.sh install
./run.sh restart

Check the logs to see if the update was successful or not:

./run.sh logs

For MAJOR updates which may require a replay, for example upgrading from 0.24.0 to 0.25.0, we recommend checking our Discord and waiting until we've released an updated pre-replayed hive image for the software update.

Then you may contact Privex Support and ask for your server to be re-installed with the latest Node-in-a-box image.

Help, my /var/lib/docker folder is full!

Old docker images

If you've had your Node-in-a-box server for a while, it's likely that you've accumulated a lot of old docker images that are eating up disk space.

Use the command docker images to view the currently installed Docker images

hiveseed-se :: /hive ‹master*› » docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hive               latest              f2f8cf0342bb        2 hours ago         1.49GB
someguy123/hive    latest-mira         f2f8cf0342bb        2 hours ago         1.49GB
someguy123/hive     <none>              93df4e15cd21        5 months ago        1.49GB
<none>              <none>              410a51bc3f9b        5 months ago        1.04GB
someguy123/jussi    latest              c9644f83413e        5 months ago        2.2GB
ubuntu              bionic              a2a15febcdf3        6 months ago        64.2MB

It should generally be safe to remove images for someguy123/hive that are older than the latest version installed.

Do not remove the ubuntu docker image however - it's used by someguy123/hive. Removing the Ubuntu docker image may break your install.

You can delete old images by running:

docker rmi [image_id]

In some cases, you may get an error about the image being used by a "stopped container". This means that there's an old container based on the image that wasn't removed properly after it was shutdown.

To see all containers, including stopped containers, use the command:

docker ps -a

You can then remove any un-needed containers using:

docker rm [container_id]

Below is an example of this scenario:

# We can't remove this old someguy123/hive image because there's a stopped container using it...
hiveseed-se :: /hive ‹master*› » docker rmi 93df4e15cd21
Error response from daemon: conflict: unable to delete 93df4e15cd21 (must be forced) - image is being used by stopped container 56f6b478dda5

# We can see the container was running hive's cli_wallet, but wasn't removed correctly after the wallet was closed
hiveseed-se :: /hive ‹master*› » docker ps -a 
CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS                      PORTS                              NAMES
56f6b478dda5        93df4e15cd21           "cli_wallet -s ws://…"   5 months ago        Exited (255) 5 months ago                                      quizzical_pasteur

# Now let's remove that old wallet container - it won't touch your hive node's wallet, that's stored OUTSIDE of docker.
hiveseed-se :: /hive ‹master*› » docker rm 56f6b478dda5
56f6b478dda5

# We can finally remove that old someguy123/hive image
hiveseed-se :: /hive ‹master*› » docker rmi 93df4e15cd21
Untagged: someguy123/hive@sha256:d4ef39ce9d73f72cb9d6319c29bb57ac4c08106a54a68f098d39a24b70b44702
Deleted: sha256:93df4e15cd21016af0b58972ed1cbfd4611dabde88a8ccf1a21bc4d57f7311a7
Deleted: sha256:829ae06d00cd6f5c6b27dc8bec17f9168e7c3955a0ff68da04e2533990a48495
Deleted: sha256:b07a516d052c9975e5f2b445d7b0e50de81a6adfc6e79e2b754c3ff7e1a616ee
Deleted: sha256:b830334c638652fcb7094287328948a365f280ab81b0e7ea3d18fc093aec4613

Large docker log files

On some of our older Node-in-a-box servers, Docker wasn't configured to correctly handle log rotation (splitting logs when they get too big, plus compressing / removing older log files).

This can result in log files getting as big as several gigabytes!

Before you're able to properly remove the log files, you'll need to stop your hive server, as well as the Docker daemon.

su
cd /hive
./run.sh stop
 systemctl stop docker

To find these log files, we recommend using the program ncdu. You can install it from apt:

apt update
apt install -y ncdu

Run ncdu against the docker folder:

ncdu /var/lib/docker

You can select files/folders with your arrow keys, and to look inside of a folder just hit ENTER (RETURN).

To go back a folder (upwards), select the folder /.. at the top of ncdu and hit ENTER

Docker log files are generally named with the extension -json.log. These are the files you want to look for and delete.

Usually, you'll find the log files within sub-folders of /var/lib/docker/containers. For example, in the image above, you can see there's a log file taking up 5.1mb of space:

5ab7395c713f9adade36d0cbe91a4f97c6e1e0ecd070ca353cfa6ea1ff3614c0-json.log

To delete a file from ncdu, just select the file with your arrow keys, and then press the letter D on your keyboard.

Select "yes" with your arrow keys, and then hit ENTER to delete the file.

Repeat this for each large log file you find.

Once you've finished removing log files, press the letter Q to exit ncdu.

Remember to start the Docker daemon again, as well as your hive node:

systemctl start docker
cd /hive
./run.sh start

Preventing large Docker log files

Our Hive "node-in-a-box" images are pre-configured with Docker log rotation as of the above date.

Otherwise, follow the commands below to setup Docker log rotation, which will prevent logs from filling up your /var/lib/docker partition.

First, make sure you're logged in as root by using the command su (or sudo su - on some systems):

su

Next, copy the entire command block below, paste it into your terminal, and then press ENTER:

cat > /etc/docker/daemon.json <<"EOF"
{
    "log-driver": "json-file",
    "log-opts": {
        "max-size": "300m",
        "max-file": "1",
        "compress": "false"
    }
}
EOF

Stop your Hive node:

cd /hive
./run.sh stop

Restart the Docker daemon:

systemctl restart docker

Now start your hive node again:

./run.sh start

Now, whenever the log file for a Docker container exceeds 300MB, Docker will start removing old log lines, to keep the log file below 300MB.

This means that each Docker container can have no more than 300MB of log files.