status-im / design

Mozilla Public License 2.0
6 stars 3 forks source link

Design Status node instructions #40

Closed hesterbruikman closed 4 years ago

hesterbruikman commented 4 years ago

Project

Objectives

Deliverables

UPDATE: It's important that all deliverables are editable.

Scope

Platforms

Linux system

Use cases

  1. Set up node ~* (nano)PC with Ethereum fullnode (can be LES, ULC)~
    • (nano)PC without Ethereum fullnode
  2. Configure node (Mailserver, Whisper, Bootnode only)
  3. Run node
  4. Connect Status to node
  5. Review/monitor Logs

Target users

Anyone with a dedicated computer that can run Linux

Background

Status currently hosts nodes that act as Whisper network bootnodes and Mailservers to enable its messaging functionality. These nodes are hosted in US, Asia and Europe and are paid for by Status. This introduces a dependency. There are several reasons why this is undesirable:

It's essential for the sustainability of the Status Network that more people are able to set up a node independently or with support of the community.

For more background info read this thread: https://discuss.status.im/t/increasing-bootstrap-node-diversity-kiss-edition/1138

Note 1: Status nodes are different from Ethereum bootnodes which people might already be running. Note 2: Once set up a node can have different configurations: a) Mailserver mode - around 600 MB per month b) Whisper Network bootnode mode In addition you can set up an Ethereum full node, this takes significantly more diskspace 160-180GB Setting up an Ethereum full node is outside of the scope of this bounty.

Contributor profile

To complete this bounty you ideally have the following skills and equipment:

Skills

Equipment

https://our.status.im/bulletproofing-against-chaos-unicorns-with-status-on-arm/

Collaboration

Online communication with:

hesterbruikman commented 4 years ago

cc for thumbs and rockets 🤗 @andmironov @oskarth @rachelhamlin @DanBigM

hesterbruikman commented 4 years ago

Ping @rachelhamlin @danbigm @andmironov @StatusSceptre

corpetty commented 4 years ago

This will be helpful, it is a WIP of my log so far with my node (it is a bit outdated as geth 1.9 came out: https://notes.status.im/3Y__B0rAStqKLUOu__hBvw#

gitcoinbot commented 4 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 500.0 DAI (500.0 USD @ $1.0/DAI) attached to it.

rachelhamlin commented 4 years ago

@hesterbruikman I can't edit this repo - could you please add this to the Bounty Tracker project board? 🙏 (It's for accounting)

hesterbruikman commented 4 years ago

@rachelhamlin added 👍

luisberns commented 4 years ago

Hello everyone, I recently started working on this issue, until now I have all the process documented following instructions from this blog post, a bootnode configured on my Linux machine (Ubuntu 19.04) and am planning some research with users.

For the research process, I intend to use initial documentation following similar steps as the blog post on the link above, but I have some questions about the process:

I intend to do user testing through the whole creation process, from the raw documentation to the site content with the UI design applied.

Thank you.

rachelhamlin commented 4 years ago

Hey @luisberns! Let me think of who can help you with this. Potentially @oskarth - do you think you could weigh in on this one?

afaik there aren't any improvements planned to this build process.

oskarth commented 4 years ago

Thanks Luis!

Some initial work on this was done before, don't know where to find this off the top of my head. Best person would probably be @adambabik @jakubgs or @andremedeiros (Igor was doing some work on this). IIRC we had some Dappnode integration/instructions before as well.

As for improving this in general, I would love to see it done. Realistically it is up to Core and its priorities, but some things are likely to be low hanging fruit.

luisberns commented 4 years ago

Thanks for the replies!

I understand that implementing new improvements could be hard due to the priorities.

In respect of the documentation for the config files for the Status bootnode, is there any reference in that area? Or the config files are only necessary for the statusgo installation?

Cheers.

jakubgs commented 4 years ago

Currently there's several run-* targets in our Makefile: https://github.com/status-im/status-go/blob/464c30a4/Makefile#L301-L314 You're probably most interested in run-bootnode-docker, but that is the most neglected one as far as I know. It essentially just runs targets from this Makefile: https://github.com/status-im/status-go/blob/develop/_assets/compose/bootnode/Makefile And it almost mirrors the setup in: https://github.com/status-im/status-go/blob/develop/_assets/compose/mailserver/Makefile They both use docker-compose to configure a container with the right settings.

Currently there exist an alternative that doesn't use Docker for mailservers which is here: https://github.com/status-im/status-go/blob/464c30a4/Makefile#L304-L305 And allows user to run the mailserver as a systemd service, which is preferable for most. This is documented here:

You can use these as a starting point. I should probably add a systemd one for bootnodes too tho.

jakubgs commented 4 years ago

The reference for the configuration is the code itself: https://github.com/status-im/status-go/blob/develop/params/config.go

luisberns commented 4 years ago

Thank you @jakubgs I'll check those links!

jakubgs commented 4 years ago

I've implemented a way to run a bootnode via systemd in: https://github.com/status-im/status-go/pull/1709

Please check out the run-bootnode-systemd branch and see how the Makefile located under _assets/systemd/bootnode works for you. Please report any issues in that PR.

jakubgs commented 4 years ago

@luisberns I have merged https://github.com/status-im/status-go/pull/1709 so you can base your work off of those changes. The BOOTNODE.md file should be the starting point.

luisberns commented 4 years ago

Hello, @jakubgs I spend this weekend working with the systemd installation file that you included in the repository.

I found that using the systemd method could make the flow way easier for the user, thank you for that!

How I got to run the bootnode in my machine

Even with the problems that I'll describe bellow I could get to run the bootnode in my machine, I changed the SERVICE_DIR variable to the system folder and removed the --user flag from the systemctl commands in the Makefile.

This would be enough to understand the installation process and proceed with the documentation and site design, but I thought it would be important to share the information about the errors that I encountered.

What problems I encountered

I found some problems trying to run the command sudo make run-bootnode-systemd, I'll describe here and I can make a PR further if necessary. I'm not an experienced developer so I'm sorry for any misinterpretation and please correct me if you think it is needed.

First, different directory for register the service

The systemd Makefile considers this variable to be the directory for storing/registering the service that will be called by the systemctl command export SERVICE_DIR ?= $(HOME)/.config/systemd/user/

When trying to run the service from this directory the service is not recognized by the systemctl.

Second, the systemctl uses the --user flag

When using the user flag the systemctl is directing for the user services and not the system services, but I was getting an error Failed to connect to bus. I didn't find any clear information about this error, but I supposed that this second point is directly connected to the first where the service is registered in a user-related folder.

jakubgs commented 4 years ago

I'm not sure why you are trying to run that with sudo. None of the instructions I wrote indicate that it should be run with sudo. I intentionally made it run as a user service under systemd to make the setup simpler. What reason do you have to run it as a system service rather than a user one?

Also, you said that:

When trying to run the service from this directory the service is not recognized by the systemctl.

What does that mean? Service isn't running from that directory, the current working directory of the service is defined by the WorkingDirectory setting in the service definition(see service.template file), which by default is set to $DATA_PATH, not $SERVICE_DIR. The $SERVICE_DIR variable - which should be set to ~/.config/systemd/user/ - is simply the location from where systemd loads service definitions.

And the Failed to connect to bus simply comes from you running it with sudo, which causes this line in the Makefile to fail:

STATUS    = $(shell systemctl --user is-active $(SERVICE_NAME))
luisberns commented 4 years ago

The reason why was running the process with sudo is, I'll state the steps that I followed to come to the actual moment:

  1. Made a pull from Git to update the code that you added in the repo. Tried to run make run-bootnode-systemd. Output:
    Failed to connect to bus: Connection refused
    cat: /var/tmp/status-go-boot/nodeaddr: No such file or directory
    /bin/sh: 1: cannot create /var/tmp/status-go-boot/nodeaddr: Permission denied
  2. Tried again, but this time with with sudo, sudo make run-bootnode. Output:
    Failed to connect to bus: No such file or directory
    cat: /var/tmp/status-go-boot/nodeaddr: No such file or directory
    CRIT [12-09|18:37:34.556] Failed to load ecdsa key from            file=/var/tmp/status-go-boot/nodekey error="open /var/tmp/status-go-boot/nodekey: no such file or directory"
  3. Added genkey to the all: task in the Makefile (I don't know if this is the correct way to go, I was just trying to fix the errors that I was getting with the installation). Output:
    Failed to connect to bus: No such file or directory
    INFO [12-09|18:38:39.277] Generating key file                      path=/var/tmp/status-go-boot/nodekey
    * Generating 'bootnode' service...
    * Enabling 'bootnode' service...
    systemctl --user enable bootnode
    Failed to connect to bus: No such file or directory
  4. Removed the --user flag from systemctl command and changed the SERVICE_DIR (that by your previous comment doesn't make a difference because if I understand right the DATA_PATH that sets the directory). Output (I'm omitting the enode/ip addresses):
    Failed to connect to bus: No such file or directory
    * Generating 'bootnode' service...
    * Enabling 'bootnode' service...
    systemctl enable bootnode
    * Restarting 'bootnode' service...
    systemctl restart bootnode
    * Your bootnode is listening on: <ip:port>
    * Make sure that IP and TCP port are available from the internet!
    Your enode address is: <enode@ip:port>

Can you help me to understand what would be the correct way to go? Thank you!

jakubgs commented 4 years ago

You're right, the genkey target was missing from all. Good catch, fixed in: https://github.com/status-im/status-go/pull/1728

But don't use it with sudo. Clean it up with make clean in the folder and try again.

luisberns commented 4 years ago

@jakubgs I was trying to redo the process without sudo but once again I was getting permissions errors so I installed a new Ubuntu 16.04 LTS on a Virtual Machine for doing the process from a clean state.

I want to confirm with you some things:

Also, I'm getting an error with the setup, I'll explain my process below.


New distro for a bootnode:

Install the requirements and clone the repo

# Install systemd for a new installation of Ubuntu distro
$ sudo apt-get install systemd

# Install golang-go following this process https://github.com/golang/go/wiki/Ubuntu
$ sudo add-apt-repository ppa:longsleep/golang-backports
$ sudo apt-get update
$ sudo apt-get install golang-go

# Install and setup git for cloning the repository
$ sudo apt-get install git
$ git config --global user.name "username"
$ git config --global user.email "useremail"

# Clone the status-go git repository
$ git clone https://github.com/status-im/status-go $HOME/status-go
$ cd status-go

# Define GOPATH env variable
$ GOPATH=$HOME/status-go
$ echo $GOPATH
// [$HOME]/status-go

Make a bootnode using systemd process

# Still inside the status-go folder where was cloned
$ make run-bootnode-systemd

I'm getting the following output:

make[1]: Entering directory '/home/louis/status-go/_assets/systemd/bootnode'
cat: /var/tmp/status-go-boot/nodeaddr: No such file or directory
* Building bootnode binary...
make[2]: Entering directory '/home/louis/status-go'
go build -i -o /home/louis/status-go/build/bin/bootnode -v -tags '' -ldflags ' -X main.buildStamp=2019-12-11.16:17:13 -X github.com/status-im/status-go/params.Version=0.38.0 -X github.com/status-im/status-go/params.GitCommit=58fc7e4 -X github.com/status-im/status-go/vendor/github.com/ethereum/go-ethereum/metrics.EnabledStr=true' ./cmd/bootnode/
cmd/bootnode/main.go:12:2: cannot find package "github.com/ethereum/go-ethereum/crypto" in any of:
    /usr/lib/go-1.6/src/github.com/ethereum/go-ethereum/crypto (from $GOROOT)
    ($GOPATH not set)
cmd/bootnode/main.go:13:2: cannot find package "github.com/ethereum/go-ethereum/log" in any of:
    /usr/lib/go-1.6/src/github.com/ethereum/go-ethereum/log (from $GOROOT)
    ($GOPATH not set)
cmd/bootnode/main.go:14:2: cannot find package "github.com/ethereum/go-ethereum/p2p/discv5" in any of:
    /usr/lib/go-1.6/src/github.com/ethereum/go-ethereum/p2p/discv5 (from $GOROOT)
    ($GOPATH not set)
Makefile:82: recipe for target 'bootnode' failed
make[2]: *** [bootnode] Error 1
make[2]: Leaving directory '/home/louis/status-go'
Makefile:96: recipe for target '/home/louis/status-go/build/bin/bootnode' failed
make[1]: *** [/home/louis/status-go/build/bin/bootnode] Error 2
make[1]: Leaving directory '/home/louis/status-go/_assets/systemd/bootnode'
Makefile:302: recipe for target 'run-bootnode-systemd' failed
make: *** [run-bootnode-systemd] Error 2

It seems that the GOPATH is not defined, but I did define it and check before trying to create the bootnode, what I'm doing wrong in this process?

Thank you!

jakubgs commented 4 years ago
$ GOPATH=$HOME/status-go

Wrong.

The GOPATH environment variable is used to specify directories outside of $GOROOT that contain the source for Go projects and their binaries. https://github.com/golang/go/wiki/GOPATH

Each directory listed in GOPATH must have a prescribed structure:

The src directory holds source code. The path below src determines the import path or executable name. https://golang.org/cmd/go/#hdr-GOPATH_environment_variable

By default the GOPATH is set to ~/go and does not need to be changed:

 $ go env | grep GOPATH
GOPATH="/home/myuser/go"

And package sources are expected to be available under src, so if your package is from: https://github.com/status-im/status-go Then running this:

go get github.com/status-im/status-go

Should get you:

 $ cat ~/go/src/github.com/status-im/status-go/VERSION   
0.37.3
jakubgs commented 4 years ago
cat: /var/tmp/status-go-boot/nodeaddr: No such file or directory

This is just a warning caused by this line in the Makefile, because before you run the setup process for the first time the /var/tmp/status-go-boot doesn't exist yet. That can be ignored. Although I might want to look at suppressing it. It's using = which is "lazy" assignment, which means it should happen only when the variable is needed.

jakubgs commented 4 years ago

Can I do this process in a virtual machine like this?

Why not? If it has either Docker or systemd it shouldn't matter. Part of the point of virtual machines is that on the inside they seem like a normal host on normal hardware.

What are the other distros that I could use and that will be needed in the documentation?

Ones that have either Docker or systemd.

hesterbruikman commented 4 years ago

@jakubgs @luisberns thank you both for all the progress on this issue! Per @luisberns suggestion, shall we have a call to go over the first version of documentation?

Related development: a survey among core contributors showed that obtaining a static IP address from an ISP is a potential blocker for a number of people to run a node. Therefore, as a starting point, it would be great to complete a manual to send/receive _your own messages_ first.

I suggest we use the call to go over steps in the manual that are required for different node configurations.

luisberns commented 4 years ago

@jakubgs Thank you for your replies and recommendations!

When I started working with the bounty I was using this Status blog article as a reference where changing the GOPATH was one of the steps for running a bootnode was to redefine the GOPATH to the status-go folder.

I repeated the installation process without changing the default GOPATH and this time I performed the process trying to use both methods systemd and Docker and running in two different Ubuntu versions (16.04 and 18.04, both LTS).

I'm still having some errors with the process so I'll describe my process and outputs bellow. As the errors are the same for both versions of Ubuntu I'll be running in the 18.04 version for the log bellow.

Run a Status Bootnode

Install required software and clone the git repository

# Install required software
$ sudo apt-get install \
        golang-go \
    systemd \
    make \
    curl \
        git

# Config git and clone the status-go repository
$ git config --global user.name "username"
$ git config --global user.email "useremail"
$ git clone https://github.com/status-im/status-go $HOME/status-go
$ cd status-go

Running a bootnode

Systemd method

# Use make to run the setup process
$ make run-bootnode-systemd

My output:

make[1]: Entering directory '/home/louis/status-go/_assets/systemd/bootnode'
cat: /var/tmp/status-go-boot/nodeaddr: No such file or directory
* Building bootnode binary...
make[2]: Entering directory '/home/louis/status-go'
go build -i -o /home/louis/status-go/build/bin/bootnode -v -tags '' -ldflags ' -X main.buildStamp=2019-12-15.23:42:40 -X github.com/status-im/status-go/params.Version=0.38.0 -X github.com/status-im/status-go/params.GitCommit=52dd8356 -X github.com/status-im/status-go/vendor/github.com/ethereum/go-ethereum/metrics.EnabledStr=true' ./cmd/bootnode/
cmd/bootnode/main.go:12:2: cannot find package "github.com/ethereum/go-ethereum/crypto" in any of:
    /usr/lib/go-1.10/src/github.com/ethereum/go-ethereum/crypto (from $GOROOT)
    /home/louis/go/src/github.com/ethereum/go-ethereum/crypto (from $GOPATH)
cmd/bootnode/main.go:13:2: cannot find package "github.com/ethereum/go-ethereum/log" in any of:
    /usr/lib/go-1.10/src/github.com/ethereum/go-ethereum/log (from $GOROOT)
    /home/louis/go/src/github.com/ethereum/go-ethereum/log (from $GOPATH)
cmd/bootnode/main.go:14:2: cannot find package "github.com/ethereum/go-ethereum/p2p/discv5" in any of:
    /usr/lib/go-1.10/src/github.com/ethereum/go-ethereum/p2p/discv5 (from $GOROOT)
    /home/louis/go/src/github.com/ethereum/go-ethereum/p2p/discv5 (from $GOPATH)
Makefile:82: recipe for target 'bootnode' failed
make[2]: *** [bootnode] Error 1
make[2]: Leaving directory '/home/louis/status-go'
Makefile:96: recipe for target '/home/louis/status-go/build/bin/bootnode' failed
make[1]: *** [/home/louis/status-go/build/bin/bootnode] Error 2
make[1]: Leaving directory '/home/louis/status-go/_assets/systemd/bootnode'
Makefile:302: recipe for target 'run-bootnode-systemd' failed
make: *** [run-bootnode-systemd] Error 2

Docker method

# Use make to run the setup process
$ make run-bootnode-docker

My output:

make[1]: Entering directory '/home/louis/status-go/_assets/compose/bootnode'
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.
Makefile:59: recipe for target 'keys/nodekey' failed
make[1]: *** [keys/nodekey] Error 126
make[1]: Leaving directory '/home/louis/status-go/_assets/compose/bootnode'
Makefile:305: recipe for target 'run-bootnode-docker' failed
make: *** [run-bootnode-docker] Error 2
jakubgs commented 4 years ago

I think you are using old go version. And your user is not in the docker group.

luisberns commented 4 years ago

I made a mistake in the process above that the git repository was cloned to the $HOME path. I corrected it using this orientation in the following way:

$ go get github.com/status-im/status-go
$ cd $HOME/go/src/github.com/status-im/status-go/
$ make run-bootnode-systemd

Success, now I got to run the Status Bootnode with systemd! 🎉

I'll update the steps for installation and post here on the issue as well.


For the docker installation I create the docker group following this doc and was able to run without a permission issue, but got this output:

make[1]: Entering directory '/home/louis/go/src/github.com/status-im/status-go/_assets/compose/bootnode'
Unable to find image 'statusteam/bootnode:latest' locally
latest: Pulling from statusteam/bootnode
8e3ba11ec2a2: Pull complete 
bd7c8273c1bf: Pull complete 
5b11a42c09d3: Pull complete 
Digest: sha256:[key-ommited]
Status: Downloaded newer image for statusteam/bootnode:latest
flag provided but not defined: -genkey
Usage of bootnode:
  -addr string
        listen address (default ":30301")
  -keydata string
        hex encoded private key
  -n value
        These nodes are used to connect to the network if the table is empty and there are no known nodes in the database.
  -nodekey string
        private key filename
  -verbosity int
        log verbosity (0-9) (default 3)
  -vmodule string
        log verbosity pattern
Makefile:59: recipe for target 'keys/nodekey' failed
make[1]: *** [keys/nodekey] Error 2
make[1]: Leaving directory '/home/louis/go/src/github.com/status-im/status-go/_assets/compose/bootnode'
Makefile:305: recipe for target 'run-bootnode-docker' failed
make: *** [run-bootnode-docker] Error 2
luisberns commented 4 years ago

Thank you Pedro, I could run with systemd now!!

I wasn't able to connect to the docker demon before, I added the docker group and I could run, still with an error though I updated the issue with a new error that I got from the docker method.

On Mon, Dec 16, 2019 at 6:17 AM Pedro Pombeiro notifications@github.com wrote:

@luisberns https://github.com/luisberns Can you please try running docker system info to see if you're able to connect to the Docker daemon? It doesn't look like Docker is running on your machine. Also, remember to clone status-go to the right location under GOPATH, as mentioned here https://github.com/status-im/design/issues/40#issuecomment-564968730

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/status-im/design/issues/40?email_source=notifications&email_token=ABJX7YD4INNQ5B5UVJNQ6Y3QY5BRRA5CNFSM4JDLWSG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG6BEUQ#issuecomment-565973586, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJX7YDCQQY3YHGFBRLXBKDQY5BRRANCNFSM4JDLWSGQ .

-- Luís BernsUX Designer & PM

louisuntitled@gmail.com +55 (44) 9 9972-5926

jakubgs commented 4 years ago

Ah yes, that's because I implemented the -genkey flag but never pushed the updated image. I did it using make bootnode-image and pushed it to Docker Hub. You should now be able to get it to work.

The new image now has the missing flags:

 $ docker run --rm -it statusteam/bootnode:latest -h                                     
Usage of /usr/local/bin/bootnode:
  -addr string
        listen address (default ":30301")
  -genkey string
        generate a node key
  -keydata string
        hex encoded private key
  -n value
        These nodes are used to connect to the network if the table is empty and there are no known nodes in the database.
  -nodekey string
        private key filename
  -verbosity int
        log verbosity (0-9) (default 3)
  -vmodule string
        log verbosity pattern
  -writeaddress
        write out the node's public key and quit

If it doesn't work you might have to remove the old image, but it should.

Also added some more checks in Makefiles: https://github.com/status-im/status-go/pull/1739

luisberns commented 4 years ago

Hello everyone!

As we agreed in the call on Wednesday this is the link for the documentation that we'll revise and comment on: https://notes.status.im/WJqu-tZoRtqVRO61Ic4NxQ

This week I started doing some research with developers to test the documentation and I'll edit when needed until Monday, after that I'll wait for comments/suggestions/critics on the note before changing anything.

luisberns commented 4 years ago

@jakubgs After I install the bootnode on my linux machine I ran systemctl --user status bootnode and turns out that the service failed to install, I'll paste here the output, do you have any clue why that happened? What can I do to fix it?

Output of systemctl --user status bootnode:

● bootnode.service - Status.im Bootnode Service
   Loaded: loaded (/home/louis/.config/systemd/user/bootnode.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2019-12-20 12:40:23 -03; 14s ago
  Process: 3392 ExecStart=/home/louis/go/src/github.com/status-im/status-go/build/bin/bootnode -verbosity=3 -nodekey=/var/tmp/status-go-boot/nodekey -add
 Main PID: 3392 (code=exited, status=1/FAILURE)

dez 20 12:40:23 louis-VirtualBox systemd[2590]: bootnode.service: Service hold-off time over, scheduling restart.
dez 20 12:40:23 louis-VirtualBox systemd[2590]: bootnode.service: Scheduled restart job, restart counter is at 5.
dez 20 12:40:23 louis-VirtualBox systemd[2590]: Stopped Status.im Bootnode Service.
dez 20 12:40:23 louis-VirtualBox systemd[2590]: bootnode.service: Start request repeated too quickly.
dez 20 12:40:23 louis-VirtualBox systemd[2590]: bootnode.service: Failed with result 'exit-code'.
dez 20 12:40:23 louis-VirtualBox systemd[2590]: Failed to start Status.im Bootnode Service.
lines 1-12/12 (END)
jakubgs commented 4 years ago

Check logs:

cd _assets/systemd/bootnode
# this is equivalent to runnin 'journalctl --user-unit statusd'
make logs 

Why did it fail?

Also, try running the command by hand to see the full error. Though you might have to adjust the -c option to use an absolute path. This has been already fixed in https://github.com/status-im/status-go/pull/1753 along with addition of some new checks.

My guess would be try you are trying to run both a mailserver and a bootnode on the same port.

luisberns commented 4 years ago

Async review

Last week I did some research with people to validate the documentation - if you wish to view a more detailed report access here - after finding some things to improve I updated the note:

luisberns commented 4 years ago

@jakubgs the problem that I comment previously it was indeed the port problem. I stopped the Docker container and restarted the Bootnode service and it was activated properly.

jakubgs commented 4 years ago

You can setup the service on a different port by setting the LISTEN_PORT variable, which by default is set to 30303 for both:

make LISTEN_PORT=12345
jakubgs commented 4 years ago

it wasn't clear for these users that docs presented two ways to install and one of them was optional

Weird, because I thought the docs made it pretty clear, from MAILSERVER.md:

This document describes the two easiest ways to start a Status Mailserver:

Maybe it should be:

This document describes the two alternative ways to start a Status Mailserver:

jakubgs commented 4 years ago

Updated the wording in https://github.com/status-im/status-go/pull/1755 which also allows for running the systemd service as a system rather than user service.

hesterbruikman commented 4 years ago

Great work @luisberns !

I went into the notes doc :

3 open points/questions @jakubgs , helpful if you can weigh in here as well:

  1. What is the benefit of using systemd? I noticed running directly in your machine., but I'm not sure what that means. Right now, it's a bit hard to determine which option to go for.
  2. I'm missing the connection to step 4 Configure node and step 5 Set Status app to use your node. At the step Check if your node is active. Does the output provide an address that can be copied into Status? For reference, I'm looking for what to enter on the screen below. Still love the QR code idea, but happy to let that be for now.
  3. The recommended device is this nanoPC with extended memory and storage. What would be needed to interface with this device? Can you plug it into your laptop or do you need a separate monitor and wired mouse and keyboard? (@corpetty as you have this exact device, how did you connect it?) Basically I want to make the table in this section as complete as possible so you don't get stuck half way.

Screenshot_20191230-154743_Status

Hope y'all are having a wonderful Christmas/New Years break!

jakubgs commented 4 years ago

Replaced the reference to Bootnode with node and occasionally Status node, with the intro explaining there are different types of nodes in layman's terms.

Doesn't sound like a good change to me. Status node and a bootnode are different things. Normal users that just want a service to relay their messages don't need a bootnode at all.


What is the benefit of using systemd? I noticed running directly in your machine., but I'm not sure what that means. Right now, it's a bit hard to determine which option to go for.

There are 2 ways available. Docker container and systemd service:

For example. When I run a History node(Mailserver) under systemd, I can see that the parent process of the node is systemd:

 $ make run-mailserver-systemd
 $ pstree -pTs $(pgrep statusd)
systemd(1)───systemd(2358)───statusd(2374)

But when I run the same History node(Mailserver) using Docker, I can see that the parent process is Docker:

 $ make clean-mailserver-systemd 
 $ make run-mailserver-docker
 $ pstree -pTs $(pgrep statusd)  
systemd(1)───dockerd(1358)───docker-containe(1783)───docker-containe(62395)───statusd(62410)

And in addition to being managed by Docker it is also limited by things like cgroups or namespaces.


At the step Check if your node is active. Does the output provide an address that can be copied into Status?

If you run make run-mailserver-* it does show you your enode address:

 $ make run-mailserver-systemd
* Generating 'statusd' config...
Generating config at: /var/tmp/status-go-mail/config.json
* Generating 'statusd' service...
* Enabling 'statusd' service...
systemctl --user enable statusd
Created symlink /home/sochan/.config/systemd/user/default.target.wants/statusd.service → /home/sochan/.config/systemd/user/statusd.service.
* Restarting 'statusd' service...
systemctl --user restart statusd
* Your mailserver is listening on: 93.105.176.182:30304
* Make sure that IP and TCP port are available from the internet!
Your enode address is:
enode://be87d447b217901ab7e4417c92f61c55f4f33cb9089a172088b55741ae024b07aad677466aa69aab19fc54b5bed8bd00ffbc27f3b3e0c7f8fd109562b68a1379@12.34.56.78:30303

Although I have thought that we could optionally provide a UTF QR code in the console, but that would require additional tools that most people wouldn't have installed.


The recommended device is this nanoPC with extended memory and storage. What would be needed to interface with this device?

The "nanoPC", as the name implies, is a nano... PC. It's a full fledged personal computer but slightly larger than a credit card when viewed from the top. It needs a screen, a keyboard, a mouse if you want GUI, and an ethernet or wifi connection to the internet, like any other PC would. Though it can be set up to just be accessible via SSH. See that it has an HDMI as well as USB and Ethernet: nanoPC T4

And I don't know about it being "recommended", it should be capable of running statusd just fine with plenty of resources left and it's also cute as a button.

jakubgs commented 4 years ago

Oh yeah, and happy new year.

hesterbruikman commented 4 years ago

Terminology

Doesn't sound like a good change to me. Status node and a bootnode are different things. Normal users that just want a service to relay their messages don't need a bootnode at all.

@jakubgs This is mostly why I want to remove the reference to bootnode I don't think it makes sense to beginners only wanting to fetch and send messages through their own node and get familiar. In this list of Small, Medium, Large, does either classify as a bootnode or is it a different category altogether?

SMALL - Messaging only, for personal use (a.k.a. Mailserver or History node) Send and receive messages messages with your own client on the same network.

MEDIUM - Messaging only, for yourself and others (a.k.a. Mailserver or History node) Send and receive messages messages with your own client as well as allowing others to do the same using your node.

LARGE - Messaging and transactions for yourself and others (a.k.a. Ethereum full node) Send and receive messages messages and transactions with your own client as well as allowing others to do the same using your node.


1. systemd vs docker explanation

There are 2 ways available. Docker container and systemd service:

Thanks for clarifying! Is it correct to state that you can run systemd on a dedicated device, but if you install the (boot)node on a multipurpose device (old PC or laptop on which you may be running a server or some IoT home trinkets), it's best to use Docker?


2. Configure node step

@luisberns could you add this as a separate step? Something like

3. Recommended device

✅ updated the table to include Ethernet outlet and Cable as well as Keyboard, mouse, display, cables ass optional and added a commend that the Nano PC can also be used through SSH.

jakubgs commented 4 years ago

In this list of Small, Medium, Large, does either classify as a bootnode or is it a different category altogether?

I don't think so. The only purpose of a bootnode is letting nodes know about other nodes. It's a digital matchmaker if you will. I'd agree with not posting instructions about running it yet, since it can only confuse people.

And the LARGE option in that list doesn't make sense, because I don't believe our app has an option to use something else than Infura for transactions right now.

Is it correct to state that you can run systemd on a dedicated device, but if you install the (boot)node on a multipurpose device (old PC or laptop on which you may be running a server or some IoT home trinkets), it's best to use Docker?

Probably. Dedicated devices have less resources, and avoiding additional layers like Docker can reduce the overhard for the software running, so in that sense yes. But in general the way you run a process is up to you and your operating system. If you look at systemd adoption you'll see that most major Linux distributions use it as their Init process, so it's the most sensible choice for most users. Using Docker requires installing additional packages, while for most using systemd doesn't.

hesterbruikman commented 4 years ago

I don't think so. The only purpose of a bootnode is letting nodes know about other nodes. It's a digital matchmaker if you will. I'd agree with not posting instructions about running it yet, since it can only confuse people.

Added it to the Types of nodes and the comparison table. for context. Assuming a bootnode needs a static IP, router configuration, stabel internet connection, but no significant storage space.

And the LARGE option in that list doesn't make sense, because I don't believe our app has an option to use something else than Infura for transactions right now.

Added a note: LARGE is currently not usable with Status until the number of available Large nodes reaches a critical mass to support the Status client in the number and frequency of transaction updates.*

Probably. Dedicated devices have less resources, and avoiding additional layers like Docker can reduce the overhard for the software running, so in that sense yes. But in general the way you run a process is up to you and your operating system. If you look at systemd adoption you'll see that most major Linux distributions use it as their Init process, so it's the most sensible choice for most users. Using Docker requires installing additional packages, while for most using systemd doesn't.

@jakubgs Assuming that people order the NanoPC, use it only to run a node, is systemd the recommended option in that case?

hesterbruikman commented 4 years ago

fyi: added a reference to https://discuss.status.im/c/messaging-network as a forum to discuss issues during installation.

luisberns commented 4 years ago

Happy new year y'all!


@hesterbruikman I added the instructions for adding the ENODE address in Status app. I think we could add some screenshots to make easier for people to configure the Bootnode on the app. But the most important thing on this process is the ENODE address, is it possible to collect the ENODE address besides when is logged on the terminal in the installation process?

Also, I made a small adjustment on this summary:

How to run your own node

  1. Get the recommended device
  2. Install required
  3. Install and configure node
  4. Set Status app to use your node
hesterbruikman commented 4 years ago

Thanks for these updates @luisberns @jakubgs should the enode address be added to both Profile > Settings > Advanced > Bootnode as well as Profile > Settings > Sync settings > Mailserver

I'm assuming that setting it as bootnode only makes sense if you have a static IP address, and else it's best left disabled in bootnode settings, is that right?

jakubgs commented 4 years ago

Bootnode should go to Bootnodes and Mailserver(History node) should go to Mailservers.

But as I said, normal users should never have to run a bootnode. We really should stop talking about that.

hesterbruikman commented 4 years ago

fyi @luisberns trial of the documentation is underway while we smooth over the above details: https://discuss.status.im/t/get-your-node-running/1488/3?u=hester

hesterbruikman commented 4 years ago

@luisberns can you please check if there's any additional information in this notes doc that's worthwhile to incorporate or link to? https://notes.status.im/A0VSe1h2SD2ED_95Zy6AEA?view#Installing-Status

Other than that I think we're as ready as can be to add the manual to status.im. @jakubgs do you think this could be an update of https://github.com/status-im/status.im/blob/develop/source/technical/run_status_node.md or rather a new file?

I believe this was the workflow:

jakubgs commented 4 years ago

Yeah, the run_status_node.md is probably the right place for this. No need to rename it.