mrz1703 / elrond-node

6 stars 3 forks source link

Autoupdater Release #3

Open joesixpack opened 4 years ago

joesixpack commented 4 years ago

Autoupdate container won't work if the data directory has been removed for a fresh start, otherwise it will orphan:

image

Making an empty data directory allows autoupdate container to work. But autoupdate container does not seem to use the ~/elrond-node/data/elrond-x structure anymore. So where to put the pem files? Actually, if the data node directory structure needs to be created by running without using autoupdater yml first, then that creates an added complication because they need to be pruned first before running autoupdate yml. I can say for sure that launching the nodes va autoupdater container does not create the data directory structure, or possibly it's being created inside the autoupdater container and not the local system.

Worse, docker-compose down -v considers working autoupdate container to be another orphan container and needs to be removed with --remove-orphan. But there is no way other than manually to down the running node containers generated by autoupdate container which also seem to be duplicate images of the original node images created by docker-compose build:

image

Partial solution to above is NOT run docker-compose build before the autoupdater yml so you wont have double set of images.

Maybe there's a title mismatch with the autoupdater generated containers vs without:

image

image

I think it would have been far easier to integrate autoupdater.sh into each node container and preserve the existing structure than try to be cute with a universal container for all.

My normal procedure before this release was copy edited .env and docker-compose.yml, etc. to the repository directories, then up -d, down -v, copy over the pem files, up -d. Trying that with the new release:

image

image

Not sure what is going on, but autoupdater yml simply doesn't like any node containers existing before it launches.

joesixpack commented 4 years ago

This works without any errors:

!/bin/bash

git clone https://github.com/mrz1703/elrond-node.git cd ~/elrond-node cp ~/elrond-config/docker-compose.yml docker-compose.yml cp ~/elrond-config/env .env cd .build

cp ~/elrond-config/Dockerfile .

cp ~/elrond-config/entrypoint.sh . cd .. docker-compose build docker-compose up -d docker-compose down -v docker system prune -af cd data/elrond-1/config unzip -o ~/elrond-config/elrondpemsoptiplex2.zip cd ../../elrond-2/config unzip -o ~/elrond-config/elrondpemsoptiplex2b.zip cd ../../elrond-3/config unzip -o ~/elrond-config/elrondpemsoptiplex3.zip cd ~/elrond-node docker-compose -f docker-compose.autoupdater.yml build docker-compose -f docker-compose.autoupdater.yml up -d ctop

joesixpack commented 4 years ago

There seems to be a bug in autoupdater where it runs the build nodes process twice.

joesixpack commented 4 years ago

Yeah that script approach didnt work at all, all the nodes are running as observers.

mrz1703 commented 4 years ago

1) in order to complete all the containers you had to run the following command: docker-compose -f docker-compose.autoupdater.yml run docker-compose down -v

The problem is that the name of the folder inside the container is different from the one in which you execute the commands for docker-compose (I already fixed it)

2) unfortunately it is impossible to integrate auto-updates into the docker container, this is a bit contrary to the docker working correctly, but you can just run the autoupdate.sh script and it will work exactly the same (almost ... you need to install several applications on your local machine to work , this is curl, grep, sed). But unfortunately this option will not work on operating systems other than linux. Therefore, I adhere to the ability to run on any operating system.

3) the problem with the data folder is resolved. You just had to create a directory. Now keys are generated automatically if they are not. After creating them, you can stop the containers, replace the keys with yours and start it again.

4) There is also now auto-backup of data, they are automatically backed up from the data folder to the backup folder with the backup time stamped.

5) Now you can watch the logs of both the full auto-adapter and only the important ones. I think there will be less problems with new versions of updates and my fixes, if I find a more practical way to update, I will definitely execute it. So that users do not have such pain and suffering! docker-compose -f docker-compose.autoupdater.yml run logs -f cat autoupdater.log

I am grateful to you for the issue, and I try to fix it.

I advise you to run the following commands before upgrading:

cd elrond-node
docker-compose -f docker-compose.autoupdater.yml run docker-compose down -v
docker-compose down -v
cd ../
# new clone
git clone https://github.com/mrz1703/elrond-node.git
cd ~/elrond-node
docker-compose build
docker-compose up -d
docker-compose down -v
###
copy you .pem keys to folders data/*/config/
###
docker-compose -f docker-compose.autoupdater.yml up -d

I hope you will no longer have problems, and if they do, I will help you solve them!))