lncm / noma

Noma - Bitcoin lightning node management CLI utility & Python API
https://lncm.io
Apache License 2.0
5 stars 2 forks source link

Add debian installation routine #47

Closed AnotherDroog closed 5 years ago

AnotherDroog commented 5 years ago

This lets install.sh check whether an Alpine or Debian-based system is present and install accordingly.

Vagrantfile is updated to test Debian 10.

Done: combine Alpine, Debian & Ubuntu in one Vagrantfile

nolim1t commented 5 years ago

This is testable by using vagrant up ?

meeDamian commented 5 years ago

Plus, I was wondering, why calling containers by their (I think) volatile names is preferable to calling them through docker-compose binary?

AnotherDroog commented 5 years ago

Plus, I was wondering, why calling containers by their (I think) volatile names is preferable to calling them through docker-compose binary?

The containers here should probably all be called from noma itself. Then the code and config file are responsible for dynamic changes.

This would also allow for a bare-metal mode down the road where binaries are fetched & signature-checked according to uname, then run directly

AnotherDroog commented 5 years ago

This is testable by using vagrant up ?

Yes, this is testable with vagrant up, or alternatively by cloning this branch and running sudo ./install.sh on an Alpine or Debian-based system (amd64, arm32, arm64)

meeDamian commented 5 years ago

@AnotherDroog I was (slightly) wrong on a suggestion to change:

if [ -x "$(command -v <cmd>)" ]; then

to

if command -v <cmd>; then

As the in latter, the command built-in doesn't check if the binary is executable in some shells :(.

We can go with the simpler notation, and risk an error in a line later on a system that has apt-get not executable O_o, or stay with a slightly less obvious one, and be slightly more robust. No opinion really d^.^b .

AnotherDroog commented 5 years ago

Vagrant can now choose between Alpine 3.10, Debian 10 and Ubuntu 18.04 LTS

vagrant up # defaults to alpine vagrant up debian vagrant up ubuntu

Warning! Do not run VMs simultaneously as they access the same wallet files over NFS!

meeDamian commented 5 years ago

If not too much trouble, perhaps make a "lock" file within that can be checked for before start?

And removed on graceful shutdown.

AnotherDroog commented 5 years ago

If not too much trouble, perhaps make a "lock" file within that can be checked for before start? ...

@meeDamian That’s one possible solution.

The stateless option would be to give alpine NFS and the others rsync (copies), that way nothing gets in the way.

Which would you prefer?

nolim1t commented 5 years ago

Seems like the installation fails on an alpine system

Steps

  1. Have an empty alpine syste,
  2. Run ./install.sh on the cloned noma directory

Actual Result

Fetching compose from noma repo
Source directory already exists
Going to attempt update with git pull
fatal: not a git repository (or any of the parent directories): .git
Traceback (most recent call last):
  File "/usr/bin/noma", line 11, in <module>
    load_entry_point('noma', 'console_scripts', 'noma')()
  File "/media/noma/noma/noma/noma.py", line 83, in main
    node_fn(args)
  File "/media/noma/noma/noma/noma.py", line 61, in node_fn
    node.start()
  File "/media/noma/noma/noma/node.py", line 66, in start
    os.chdir(cfg.COMPOSE_MODE_PATH)
FileNotFoundError: [Errno 2] No such file or directory: '/media/noma/compose/neu
trino'
Waiting 3s for lnd to start up...
❌ Error: lnd directory does not exist!
Error: No such container: neutrino_lnd_1
Waiting 5s for wallet to be created...
Error: No such container: neutrino_lnd_1

Directory Structure

/home/lncm/src/noma:# ls /media/noma/
noma

Expected Result

The git clone should be in /media not in /media/noma so all the files exist

AnotherDroog commented 5 years ago

Looking at this

meeDamian commented 5 years ago

Is till see no changes here :(

Perhaps merging both PRs into one might be easier?

AnotherDroog commented 5 years ago

@nolim1t @meeDamian Could you check again?

nolim1t commented 5 years ago

Can we remove this line

https://github.com/lncm/noma/blob/c4d8253468e29097cc5944561b44e43fb61e4816/install.sh#L148

And add -p to the below

https://github.com/lncm/noma/blob/c4d8253468e29097cc5944561b44e43fb61e4816/install.sh#L149

We also need to test for existance of the directories too so it doesn't just quit out if either of those directories don't exist

nolim1t commented 5 years ago

Also seems to quit out at

Using /usr/lib/python3.7/site-packages
Finished processing dependencies for noma==0.4.5
Error: public_html directory not found
AnotherDroog commented 5 years ago

public_html is created by install.sh

We can move that into pure python to solve the issue for those using pip directly

nolim1t commented 5 years ago

Should I just create public_html?

AnotherDroog commented 5 years ago

Should I just create public_html?

Not necessary, if we are writing a check for the directory. And there's relevant api functions and code for it already.

AnotherDroog commented 5 years ago

Thank you for your thorough testing! @nolim1t

I've applied fixes for the bare-metal case, which can be tested more conveniently on alpine using vagrant up empty

public_html is now being created properly by using curl instead of wget

I expect sudo ./install.sh is now a workable entry-point on Alpine, Debian and Ubuntu

AnotherDroog commented 5 years ago
    from docker import from_env
ModuleNotFoundError: No module named 'docker'

Had to do a sudo pip3 install docker after doing a sudo ./install.sh to correct this issue

I don't see how this can happen since our setup.py references docker-compose as a dependency, which in turn depends on docker, as you can see in their git repo

Also strange how this slipped past 3 tests.

Can you post your setup.py for verification?