talaia-labs / python-teos

The Eye of Satoshi - Lightning Watchtower
https://talaia.watch
MIT License
100 stars 15 forks source link

Cannot start watchtower-plugin #302

Open johnongit opened 3 years ago

johnongit commented 3 years ago

I'm looking for some help about watchtower-plugins usage.

Currently, I'm running c-lightning with docker. So, in order to add use watchtower-plugin, I've managed to build a new c-lightning image with python-teos. it's looks like this RUN mkdir -p /python-plugin/plugins && \ git clone https://github.com/talaia-labs/python-teos.git && \ cd python-teos && pip3 install . && \ cd watchtower-plugin && pip3 install -r requirements.txt

I'm able to build my customized image but the plugins does not start properly when I use it in the lightning.conf plugin=/python-teos/watchtower-plugin/watchtower.py

watchtower-plugin fails with the following error

Traceback (most recent call last): File "/python-teos/watchtower-plugin/watchtower.py", line 19, in from common.config_loader import ConfigLoader, UnknownConfigParam ImportError: cannot import name 'UnknownConfigParam' from 'common.config_loader' (/usr/local/lib/python3.9/dist-packages/common/config_loader.py)

I'm not really sure the way to use the plugin

sr-gi commented 3 years ago

Hi @johnongit

Can you provide the steps to reproduce?

Have you simply edited the Dockerfile from c-lightning master and added:

RUN mkdir -p /python-plugin/plugins && \ git clone https://github.com/talaia-labs/python-teos.git && \ cd python-teos && pip3 install . && \ cd watchtower-plugin && pip3 install -r requirements.txt
johnongit commented 2 years ago

Hello. You can find my dockerfile here https://github.com/johnongit/lightning-1/blob/install-watchtower/Dockerfile

With this image, I configure a c-lightning on signet by adding the following line in my config file

plugin=/python-teos/watchtower-plugin/watchtower.py

The error are displayed during lightningd boot time.

sr-gi commented 2 years ago

Got it, I was able to reproduce.

The issue you're facing comes from a version error so to speak. You're pulling from master which has an updated version of teos-common but the watchtower-plugin is installing teos-common version 1.1, which is the stable version.

You should be able to fix the issue by running pip install . from the teos-common folder. That will update the teos-common code to match master. You could also pull from v1.1 instead but you'll be missing from some of the latest improvements both from the tower and the plugin.

I'll be documenting this, or releasing a minor version to fix it.

johnongit commented 2 years ago

Hello. Thx for your answer. Sorry, I'm not really sure to catch it. I'm unable to find teos-common folder

Currently, in my current dockerfile I'm running pip3 install . in python-teos and (after) in watchtower-plugin

sr-gi commented 2 years ago

Oh sorry, teos-common is the package name. The folder is called common and is located in the root of the repo.

sr-gi commented 2 years ago

Did that work @johnongit? Can this be closed?

Jossec101 commented 2 years ago

Hi @sr-gi perhaps a new version like teos-common 0.1.X-unstable or whatever naming you might find appropiate would be really cool, I've been struggling until I found this issue when trying to run CLN v0.11.1 + python-teos from master and I really want to test the latest version. I think that maybe the watchtower-plugin requirements.txt should point to a unstable version of the common lib if master and point to the stable versions (based on the tag version) on tagged branches.

I let here a working Dockerfile where I made it work. Someone might find it useful (it uses the official lightnind docker image)

FROM elementsproject/lightningd:v0.11.1

RUN apt update -y
RUN apt-get install python3-pip -y
RUN apt-get install python3-dev -y
RUN python3 -m pip install --upgrade pip
RUN apt install build-essential -y

COPY ./python-teos /opt/python-teos

RUN pip3 install -r /opt/python-teos/watchtower-plugin/requirements.txt
RUN pip3 install pyln-client pyln-bolt1 pyln-bolt7 pyln-bolt2 pyln-bolt4 pyln-proto

RUN pip3 install /opt/python-teos
RUN chmod +x /opt/python-teos/watchtower-plugin/watchtower.py
sr-gi commented 2 years ago

Hi @Jossec101, sorry about that. I've been working on rust-teos (the rust version of the tower) in order to deprecate python-teos and I completely neglected fixing / documenting this issue.

Currently, there is a release of rust-teos and the CoreLN plugin is under review, so I think I'll just leave this issue open in case someone needs to fix the installation of python-teos.

I'd encourage you to migrate to rust-teos once that's ready given it's a far more efficient implementation, and this one will be (or has been, to be fair) discontinued.

Jossec101 commented 2 years ago

Hi @Jossec101, sorry about that. I've been working on rust-teos (the rust version of the tower) in order to deprecate python-teos and I completely neglected fixing / documenting this issue.

Currently, there is a release of rust-teos and the CoreLN plugin is under review, so I think I'll just leave this issue open in case someone needs to fix the installation of python-teos.

I'd encourage you to migrate to rust-teos once that's ready given it's a far more efficient implementation, and this one will be (or has been, to be fair) discontinued.

Sorry for the off-topic, is rust-teos compatible with the python CLN plugin? Or shall I test it using the rust CLN plugin which you say is WIP, I don't mind if its not stable but at least functional, we are actually researching about Watchtowers and avoiding a deprecated codebase is way better.

sr-gi commented 2 years ago

The two codebase are actually not compatible. There are small discrepancies. I may write a migration script if current users ask for it though.

If you are gonna set up a new one, I'd encourage you to go for Rust. Especially if you want to try things out.

Feel free to ping me if you need any support (either here or on Slack).