diff --git a/README.md b/README.md index 7539d289..98163dd0 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,8 @@ ## Setup Guide A setup guide with scripts to install prerequisites can be found in the [setup-scripts](./setup-scripts) directory. + +Once the setup guide is complete you will be running: +- `siad` configured as a ViewNode +- a NodeJS app running a Skynet Portal +- an nginx proxy diff --git a/setup-scripts/README.md b/setup-scripts/README.md index 3a118879..ba950232 100644 --- a/setup-scripts/README.md +++ b/setup-scripts/README.md @@ -23,6 +23,53 @@ You a can now ssh into your machine as the user `user`. 7. Now logged in as `user`: `sudo apt-get install git` 8. `git clone https://github.com/NebulousLabs/skynet-webportal` 9. `cd skynet-webportal/setup-scripts` -10. Add ssh pubkeys to `authorized_keys` file. 11. `./setup.sh` 12. Once DNS records are set you can run: `./letsencrypt-setup.sh` +13. You should also change the nginx configuration to listen on port 443 + instead. + +## Setting up siad + +NOTE: You must be running `siad` and `siac` by building from the `viewnode` +branch. + +You still need to setup `siad` for the backend to be complete. +1. `cd ~/; mkdir siad` +2. `nohup siad &>/dev/null &` + +This will start syncing `siad` in the background. + +## ViewNode setup + +When `siad` is done syncing, create a new wallet and unlock the wallet. + +Then set an allowance (`siac renter setallowance`), with the suggested values +below: +- 10 KS (keep 25 KS in your wallet) +- default period +- default number of hosts +- 8 week renewal time +- 500 GB expected storage +- 500 GB expected upload +- 5 TB expected download +- default redundancy + +Once your allowance is set you need to set your node to be a viewnode with the +following command: +`siac renter setallowance --view-contract-initial-price 10SC` + +Now your node will begin making 10 contracts per block with many hosts so it can +potentially view the whole network's files. + +## Running the Portal +`cd` into the parent directory and run `yarn` to build dependencies. + +We recommend running the Portal through `pm2` (a nodejs process manager) in the background with the command: + +`pm2 --name skynet start npm -- start` + +`yarn start` will also work if not using `pm2`. + +The Protal which will automatically read your `siad` API password and startup a +portal on `localhost:3000`. nginx will expose this to port 80 or 443 if you +configured it for SSL. diff --git a/setup-scripts/setup.sh b/setup-scripts/setup.sh index d47efd94..56d457da 100755 --- a/setup-scripts/setup.sh +++ b/setup-scripts/setup.sh @@ -6,6 +6,11 @@ cp ./tmux.conf ~/.tmux.conf cp ./bashrc ~/.bashrc source ~/.bashrc +# Add SSH keys and set SSH configs +sudo cp ./ssh_config /etc/ssh/ssh_config +mkdir -p ~/.ssh +cat ./authorized_keys >> ~/.ssh/authorized_keys + # Nodejs install prerequisite. From official documentation. curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash - @@ -22,27 +27,11 @@ sudo apt-get -y install ufw tmux ranger htop nload nginx certbot \ sudo npm i -g pm2 # terminfo for alacritty terminal via ssh +# If you don't use the alacritty terminal you can remove this step. wget -c https://raw.githubusercontent.com/alacritty/alacritty/master/extra/alacritty.info sudo tic -xe alacritty,alacritty-direct alacritty.info rm alacritty.info -# Install Go 1.13.7. -wget -c https://dl.google.com/go/go1.13.7.linux-amd64.tar.gz -sudo tar -C /usr/local -xzf go1.13.7.linux-amd64.tar.gz -source ~/.bashrc -rm go1.13.7.linux-amd64.tar.gz - -# Sanity check that will pass if go was installed correctly. -go version - -# Install Sia -cwd=$(pwd) -cd ~/ -git clone https://gitlab.com/NebulousLabs/Sia -cd Sia && git checkout viewnode && make - -cd $cwd - # Setup nginx config sudo cp ./skynet-nginx.conf /etc/nginx/sites-available/skynet sudo nginx -t @@ -57,16 +46,23 @@ sudo ufw allow ssh sudo ufw allow 'Nginx Full' sudo ufw allow 'Nginx HTTP' -# Setup skynet frontend. +# Install Go 1.13.7. +wget -c https://dl.google.com/go/go1.13.7.linux-amd64.tar.gz +sudo tar -C /usr/local -xzf go1.13.7.linux-amd64.tar.gz +source ~/.bashrc +rm go1.13.7.linux-amd64.tar.gz + +# Sanity check that will pass if go was installed correctly. +go version + +cwd=$(pwd) + +# Install Sia cd ~/ -git clone https://github.com/NebulousLabs/skynet-webportal && cd skynet-webportal -yarn +git clone https://gitlab.com/NebulousLabs/Sia +cd Sia && git checkout viewnode && make -# Start the frontend. -pm2 --name skynet start npm -- start - -# Add SSH keys and set SSH configs +# Setup skynet frontend. cd $cwd -sudo cp ./ssh_config /etc/ssh/ssh_config -mkdir -p ~/.ssh -cat ./authorized_keys >> ~/.ssh/authorized_keys +cd ../ +yarn