ExchangeUnion / xud-docker

Streamlined setup of xud and all dependencies via docker 🐳
https://docs.exchangeunion.com
GNU Affero General Public License v3.0
5 stars 5 forks source link

When update is declined, NOTHING works (getinfo, down etc) #358

Open reliveyy opened 4 years ago

reliveyy commented 4 years ago

EDIT by @kilrau : Issue description see https://github.com/ExchangeUnion/xud-docker/issues/358#issuecomment-748171843

kilrau commented 4 years ago

Not sure what "bring back old setup" means, but the requirement is simply:

Updated declined = start environment with existing local images.

Not more, not less.

reliveyy commented 4 years ago

There is a twisted logic behind this bug. It's becuase you are using a new utils image to check for updates. When you decline it the utils is already updated. So how do you rollback to old utils while current new utils running? We need to figure out a way to do this.

The instant thought about this is removing utils pulling logic in setup.sh. And we only do one thing in setup.sh

docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock exchangeunion/utils

The utils container will be self updated. That means this container will only be pulled once. And in later launches it will checking for updates and pulling new nodes setups and store them internally. But this requires a big change to utils. If you have any other thoughts about this problem. Please leave a comment here.

reliveyy commented 4 years ago

A more common problem is how do we update a docker running application. Becuase xud-docker is not some native python application. It's inside a docker container. How do we interactively update this "container application" properly?

See also https://medium.com/better-programming/automatically-update-docker-containers-f2ccc79f4313

kilrau commented 4 years ago

if you have any other thoughts about this problem. Please leave a comment here.

Understood. My thinking: we shouldn't roll back. We shouldn't pull the latest util and start environment with this in the first place since the user doesn't know it was updated. We should start the environment with the existing utils container if one exists and only if user accepts update prompt, we pull new utils container, launch it, open the shell there and kill the old uitls container. That's the only thing to figure out.

The whole update logic seems not optimal right now, taking another example: starting xud with my all-light config

[bitcoind]
neutrino = true

[litecoind]
neutrino = true

[geth]
external = true
infura-project-id = "abc"
infura-project-secret = "123"

it still checks and pulls geth which I am not even using:

3) Mainnet
Please choose the network: 3
Pulling image exchangeunion/utils:20.03.14
🚀 Launching mainnet environment
🌍 Checking for updates...
- Image exchangeunion/geth:1.9.12: missing
- Container mainnet_bitcoind_1: missing
- Container mainnet_litecoind_1: missing
- Container mainnet_lndbtc_1: missing
- Container mainnet_lndltc_1: missing
- Container mainnet_raiden_1: missing
- Container mainnet_xud_1: missing
Pulling exchangeunion/geth:1.9.12...

that should be changed too. After config read-in mark some images as "inactive" which are not being used.

kilrau commented 4 years ago

As discovered by @erkarl , a declined update can even lead to crashes since utils doesn't seem to find the images it's looking for:

Please choose the network: 3
Pulling image exchangeunion/utils:20.07.10
🚀 Launching mainnet environment
🌍 Checking for updates...
- Image exchangeunion/geth:1.9.16: missing
- Image exchangeunion/lnd:0.10.2-beta: missing
- Image exchangeunion/connext:7.0.0-alpha.14: missing
- Image exchangeunion/boltz:1.0.0: missing
- Image exchangeunion/xud:1.0.0-beta.5: missing
- Container mainnet_geth_1: outdated (image)
- Container mainnet_lndbtc_1: outdated (image)
- Container mainnet_connext_1: outdated (image)
- Container mainnet_boltz_1: missing
- Container mainnet_xud_1: outdated (image)
A new version is available. Would you like to upgrade (Warning: this may restart your environment and cancel all open orders)? [Y/n] n
Failed to start these nodes.
- boltz: 404 Client Error: Not Found ("No such image: exchangeunion/boltz:1.0.0")
Try again? [Y/n] n
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/launcher-1.0.0-py3.8.egg/launcher/__init__.py", line 169, in launch
    env.start()
  File "/usr/local/lib/python3.8/site-packages/launcher-1.0.0-py3.8.egg/launcher/__init__.py", line 151, in start
    self.node_manager.up()
  File "/usr/local/lib/python3.8/site-packages/launcher-1.0.0-py3.8.egg/launcher/node/__init__.py", line 187, in up
    parallel_execute(nodes, lambda n: n.start(), 60, print_failed, try_again)
  File "/usr/local/lib/python3.8/site-packages/launcher-1.0.0-py3.8.egg/launcher/utils.py", line 39, in parallel_execute
    raise ParallelExecutionError(failed)
launcher.utils.ParallelExecutionError: [(<Node name='boltz' mode='native' container='mainnet_boltz_1'>, ImageNotFound(HTTPError('404 Client Error: Not Found for url: http+docker://localhost/v1.35/containers/create?name=mainnet_boltz_1')))]
kilrau commented 4 years ago

Just noticed, that in current state when update is declined, down doesn't work, all containers stay up. https://paste.ubuntu.com/p/bZp5YzyrGT/

kilrau commented 3 years ago

EDIT by now nothing really works when update is declined (the down output is fake, it's all still running):

d@beast:~$ xud
1) Simnet
2) Testnet
3) Mainnet
Please choose the network: 3
🚀 Launching mainnet environment
🌍 Checking for updates...
- Container mainnet_connext_1: recreate
A new version is available. Would you like to upgrade (Warning: this may restart your environment and cancel all open orders)? [Y/n] n

                           .___           __  .__   
          ___  _____ __  __| _/     _____/  |_|  |  
          \  \/  /  |  \/ __ |    _/ ___\   __\  |  
           >    <|  |  / /_/ |    \  \___|  | |  |__
          /__/\_ \____/\____ |     \___  >__| |____/
                \/          \/         \/           
--------------------------------------------------------------

mainnet > deposit btc
mainnet > getinfo
mainnet > down
Stopping litecoind...
Stopping lndbtc...
Stopping lndltc...
Stopping connext...
Stopping arby...
Stopping boltz...
Stopping webui...
Stopping proxy...
Stopping xud...
Removing litecoind...
Removing lndbtc...
Removing lndltc...
Removing connext...
Removing arby...
Removing boltz...
Removing webui...
Removing proxy...
Removing xud...
Removing network mainnet_default