Conversation
…r management of code
shannona
left a comment
There was a problem hiding this comment.
The scripts are looking very nice. I like the organization and the use of the config file.
I did a medium-level dive, reading the README, reading the config file, and trying out an install on a fairly fresh Debian 9 system with c-lightning. Generally looks great, but there seem to be a few discrepancies in the script and more notably c-lightning didn't install.
| # if you are going to access it locally then you can just use your hostname and add .local like so: hostname.local | ||
| FQDN= | ||
| # the region in which the server is hosted. Required for timezone settings | ||
| REGION= |
There was a problem hiding this comment.
Need to give an example of this, or tell users where to go to get the right format.
There was a problem hiding this comment.
Added the following:
FQDN : e.g. myawesomedomain.com
REGION : e.g. UCT, GMT, Pacific, America/New_York, Europe/Madrid, Asia/Kolkata
There was a problem hiding this comment.
debian comes with curl, so the commands below might be useful if you don't know the codes by heart
curl https://ipinfo.io/ip
curl https://json.geoiplookup.io/<Public_IP>
Although this would probably only work with a VPS (unless they have a static IP)
| ########################### | ||
| # The bitcoin network you want bitcoind to start with. Valid choices: | ||
| # mainnet, testnet or regtest | ||
| NETWORK=mainnet |
There was a problem hiding this comment.
I'd suggest we default this to testnet, to force someone to purposefully change it to choose to engage with real funds.
|
|
||
| 3. Edit config for your node setup using your favourite text editor: | ||
| # nano ss.conf | ||
|
|
There was a problem hiding this comment.
It'd be helpful to say. "You must change [A], and you will probably want to change [B] and [C], but look at the whole file.
There was a problem hiding this comment.
Added the following:
You must modify USERPASS else, your server will be unprotected and provide values for all the variables under VPS if installing on a VPS and set to true. Do note that the script defaults to testnet full node. Make appropriate changes.
| # c-lightning options | ||
| ########################### | ||
| # http-plugin | ||
| # CLN_HTTP_PLUGIN=flase |
There was a problem hiding this comment.
This hasn't been implemented, hence set to false
|
|
||
| 5. Display help: | ||
| # source ss_00_main.sh -h | ||
|
|
There was a problem hiding this comment.
Shouldn't be an extra step. (This implies that you need to source the script, then get the help.)
There was a problem hiding this comment.
changed to source ss_01_help.sh
| # prompt user before continuing with installation | ||
| if ! "$NOPROMPT"; then | ||
| read -rp "Continue with installation? (Y/n): " confirm | ||
| fi |
There was a problem hiding this comment.
This ("Y/n") implies that "Y"es is the default, but when I just hit return, it said "Entered . Exiting.." and quit.
Either this should be set to "Y" as a default (e.g., $confirm = "Y") or it should requery if you fail to enter an answer.
| cp -r $SCRIPTS_DIR ~standup/ | ||
| chown standup ~standup/scripts-conf | ||
| cd ~standup/scripts-conf | ||
| rm -r $SCRIPTS_DIR |
There was a problem hiding this comment.
This seems to be the first use of ~standup/scripts-conf:
chown: cannot access '/home/standup/scripts-conf': No such file or directory
-bash: cd: /home/standup/scripts-conf: No such file or directory
There was a problem hiding this comment.
We should probably tell people that if they want to review the scripts they're in ~standup/scripts
There was a problem hiding this comment.
Done. Added following to README:
- Move the
standup-scriptsdirectory to/home/standup/standup-scripts. If you want to review the scripts later, you can find them at this location.
| sudo -u standup git clone https://github.com/Start9Labs/c-lightning-http-plugin.git "$LIGHTNING_DIR"/plugings/ | ||
| cd "$LIGHTNING_DIR"/plugings/c-lightning-http-plugin/ | ||
| cargo build --release | ||
| chmod a+x /home/you/.lightning/plugins/c-lightning-http-plugin/target/release/c-lightning-http-plugin |
| #!/bin/bash | ||
|
|
||
| # standup script - install c-lightning | ||
|
|
There was a problem hiding this comment.
Some type of fatal error here:
-------Standup - downloading & Installing c-lightning
fatal: Could not change back to '/root/Bitcoin-Standup-Scripts/Scripts/scripts': Permission denied
-bash: cd: /home/standup/lightning: No such file or directory
error: pathspec 'v0.9.1' did not match any file(s) known to git.
Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'
-bash: ./configure: No such file or directory
make: *** No targets specified and no makefile found. Stop.
make: *** No rule to make target 'install'. Stop.
-bash: : command not found
Debian 9. Fresh Linode (with a bit of security added). Run as root.
There was a problem hiding this comment.
That's strange. If run as root, it should be able to cd. I haven't had issues with this. What security measures might have caused this?
Did you initiate c-lightning installation after completing the installation of bitcoind?
|
|
||
| QR Code: | ||
| -------- | ||
| Upon completion of the script there will be a QR code saved to /qrcode.png which you can open and scan: |
There was a problem hiding this comment.
I don't see anything that installs a qrcode.png right now.
ls -lagh /qrcode.png
ls: cannot access '/qrcode.png': No such file or directory
There was a problem hiding this comment.
Good catch. I definitely missed that one
|
After this settles, my next question is going to be: how can we merge this into the StackScript for Linode, since that's our preferred methodology for the Learning Bitcoin course (and at the least we'd like the automatic c-lightning install.) |
I can just merge relevant parts into a single script with c-lightning for the StackScript. Does that work? |
Definitely! |
|
@jodobear wrote
Did this happen? Should this PR be closed, or is there still useful code for the future here? |
|
Funny timing Nick, I started looking at it just a little while ago as well |
nochiel
left a comment
There was a problem hiding this comment.
Looks good to me. I've annotated some scripts with a few comments/questions.
| @@ -0,0 +1,60 @@ | |||
| #!/bin/bash | |||
There was a problem hiding this comment.
Assuming availability of coreutils, shouldn't the shebang be#!/usr/bin/env bash instead of hardcoding the location of bash?
| bold=$(tput bold) | ||
| normal=$(tput sgr0) | ||
| underline=$(tput smul) |
There was a problem hiding this comment.
Should the script check for ncurses before using tput? (Or can we assume that it is always install wtih the debian base system.)
Update: No need to check for ncurses because the Debian base system install contains:
# aptitude search ~pimportant ~prequired ~pimportant -F%p
adduser
apt
apt-utils
base-files
base-passwd
bash
bsdmainutils
bsdutils
coreutils
cpio
cron
dash
debconf
debconf-i18n
debian-archive-keyring
debianutils
diffutils
dmidecode
dpkg
e2fslibs
e2fsprogs
fdisk
findutils
gdbm-l10n
gpgv
grep
gzip
hostname
ifupdown
init
init-system-helpers
iproute2
iptables
iputils-ping
isc-dhcp-client
isc-dhcp-common
kmod
less
libapt-inst2.0
libapt-pkg5.0
libc-bin
libcomerr2
libpam-modules
libpam-modules-bin
libpam-runtime
libss2
libudev1
login
logrotate
mawk
mount
nano
ncurses-base
ncurses-bin
netbase
passwd
perl-base
procps
readline-common
rsyslog
sed
sensible-utils
systemd
systemd-sysv
sysvinit-utils
tar
tasksel
tasksel-data
tzdata
udev
util-linux
vim-common
vim-tiny
whiptail
| 5. Display help: | ||
| # source ss_00_main.sh -h | ||
|
|
||
| This script can be installed on any Debian based system. By default this script will: |
There was a problem hiding this comment.
| This script can be installed on any Debian based system. By default this script will: | |
| This script can be installed on any Debian based system. The [Debian base system](https://www.debian.org/doc/debian-policy/ch-binary.html#base-system) installs the following packages which this script assumes are [standard](https://wiki.debian.org/tasksel#A.22standard.22_task): | |
| <pre> | |
| $ aptitude search ~pimportant ~prequired ~pimportant -F%p | |
| adduser | |
| apt | |
| apt-utils | |
| base-files | |
| base-passwd | |
| bash | |
| bsdmainutils | |
| bsdutils | |
| coreutils | |
| cpio | |
| cron | |
| dash | |
| debconf | |
| debconf-i18n | |
| debian-archive-keyring | |
| debianutils | |
| diffutils | |
| dmidecode | |
| dpkg | |
| e2fslibs | |
| e2fsprogs | |
| fdisk | |
| findutils | |
| gdbm-l10n | |
| gpgv | |
| grep | |
| gzip | |
| hostname | |
| ifupdown | |
| init | |
| init-system-helpers | |
| iproute2 | |
| iptables | |
| iputils-ping | |
| isc-dhcp-client | |
| isc-dhcp-common | |
| kmod | |
| less | |
| libapt-inst2.0 | |
| libapt-pkg5.0 | |
| libc-bin | |
| libcomerr2 | |
| libpam-modules | |
| libpam-modules-bin | |
| libpam-runtime | |
| libss2 | |
| libudev1 | |
| login | |
| logrotate | |
| mawk | |
| mount | |
| nano | |
| ncurses-base | |
| ncurses-bin | |
| netbase | |
| passwd | |
| perl-base | |
| procps | |
| readline-common | |
| rsyslog | |
| sed | |
| sensible-utils | |
| systemd | |
| systemd-sysv | |
| sysvinit-utils | |
| tar | |
| tasksel | |
| tasksel-data | |
| tzdata | |
| udev | |
| util-linux | |
| vim-common | |
| vim-tiny | |
| whiptail | |
| </pre> | |
| By default this script will: |
| @@ -0,0 +1,60 @@ | |||
| #!/bin/bash | |||
There was a problem hiding this comment.
| #!/bin/bash | |
| #!/usr/bin/env bash |
| @@ -0,0 +1,320 @@ | |||
| #!bin/bash | |||
There was a problem hiding this comment.
| #!bin/bash | |
| #!/usr/bin/env bash |
| if [ -n "$SSH_KEY" ] && [[ "$SSH_KEY" != "__UNDEFINED__" ]]; then | ||
| mkdir ~standup/.ssh | ||
| echo "$SSH_KEY" >> ~standup/.ssh/authorized_keys | ||
| chown -R standup ~standup/.ssh |
There was a problem hiding this comment.
| chown -R standup ~standup/.ssh | |
| chown -R standup ~standup/.ssh | |
| chmod 0400 ~standup/.ssh/authorized_keys |
| " | ||
| # To use source lines with https:// in /etc/apt/sources.list the apt-transport-https package is required. Install it with: | ||
| if [ -z "$(which apt-transport-https)" ]; then | ||
| apt-get install apt-transport-https -y |
There was a problem hiding this comment.
| apt-get install apt-transport-https -y | |
| apt-get install apt-transport-https -y | |
| apt-get install lsb-release apt-transport-https -y |
Make sure the user has lsb-release so that setting '/etc/apt/sources.list has a valid distribution.
| fi | ||
|
|
||
| # We need to set up our package repository before you can fetch Tor. First, you need to figure out the name of your distribution: | ||
| DEBIAN_VERSION=$(lsb_release -c | awk '{ print $2 }') |
There was a problem hiding this comment.
| DEBIAN_VERSION=$(lsb_release -c | awk '{ print $2 }') | |
| DEBIAN_VERSION=$(lsb_release -c | awk '{ print $2 }') | |
| if [[ -z "$DEBIAN_VERSION" ]]; then | |
| DEBIAN_VERSION="stable" | |
| fi |
| $MESSAGE_PREFIX downloading & Installing c-lightning | ||
| " | ||
| # get & compile clightning from github | ||
| sudo -u standup git clone https://github.com/ElementsProject/lightning.git ~standup/lightning |
There was a problem hiding this comment.
Is it preferable to compile from source instead of using pre-compiled binaries?
| echo " | ||
| $MESSAGE_PREFIX getting lnd... depending on your network it can take more than an hour. With good network it usually takes about 5-10 mins. | ||
| " | ||
| go get -d github.com/lightningnetwork/lnd |
There was a problem hiding this comment.
Is it preferable to compile from source instead of using pre-compiled binaries?
| apt-get install nodejs -y | ||
|
|
||
| # get esplora & set electrs api url | ||
| sudo -u standup git clone https://github.com/Blockstream/esplora "$ESPLORA_REPO" |
There was a problem hiding this comment.
Would like to change this repo to link to the new esplora fork at BlockchainCommons/esplora
Installs: