Skip to content

Instantly share code, notes, and snippets.

@0mkara
Forked from zelig/swarm-server-setup.sh
Created August 4, 2016 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0mkara/226dbb933ba6fc60e34314ac07eda9e2 to your computer and use it in GitHub Desktop.
Save 0mkara/226dbb933ba6fc60e34314ac07eda9e2 to your computer and use it in GitHub Desktop.
swarm server setup
cat > ~/.gitconfig <<EOF
[github]
user = zelig
token =
[user]
name = zelig
email = viktor.tron@gmail.com
[core]
pager = less -FRX
[color]
ui = true
[filter "media"]
clean = git-media-clean %f
smudge = git-media-smudge %f
[branch]
autosetupmerge = always
[push]
default = simple
[credential]
helper = cache --timeout 7200
EOF
cat > ~/.screenrc <<EOF
defscrollback 10000
#http://stackoverflow.com/questions/810025/unable-to-use-screen-efficiently-in-macs-terminal
escape ^Zz
# Make xterm scrolling work properly with screen.
termcapinfo xterm-256color|xterm-color|xterm|xterms|xs|rxvt ti@:te@
#termcapinfo xterm ti@:te@
setenv SSH_AUTH_SOCK /tmp/ssh_auth_sock
#https://rvm.io/workflow/screen/
shell -/bin/bash
EOF
cat > ~/.ssh/config <<EOF
Host *
ForwardAgent yes
ServerAliveCountMax 100
ServerAliveInterval 60
TCPKeepAlive yes
EOF
cat > ~/.bash_aliases <<EOF
alias mimetype="file -b --mime-type"
export GETH_DIR=~/go-ethereum
export GETH=$GETH_DIR/geth
export SWARM_DIR=~/bzz
export SWARM_NETWORK_ID=322
alias swarm='bash $GETH_DIR/swarm/cmd/swarm/swarm.sh $SWARM_DIR $SWARM_NETWORK_ID'
EOF
chmod 400 ~/.ssh/id_rsa
eval `ssh-agent`
ssh-add
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo add-apt-repository -y ppa:ethereum/ethereum-dev
sudo apt-get update
sudo apt-get install -y build-essential golang libgmp32-dev git
export GOPATH=~/go
export PATH=$GOPATH/bin:$PATH
git clone git@github.com:ethersphere/go-ethereum.git $GOPATH/src/github.com/ethereum/go-ethereum
go get github.com/tools/godep
cd $GOPATH/src/github.com/ethereum/go-ethereum
git remote add upstream git@github.com:ethereum/go-ethereum.git
git remote update
git checkout -b swarm --track upstream/swarm
godep go build -v ./cmd/geth
# install node, npm but need to upgrade to later vol
sudo apt-get install -y npm node
sudo npm install -g npm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
nvm install 0.12
git clone https://github.com/cubedro/eth-netstats
cd eth-netstats
npm install
sudo npm install -g grunt-cli
export WS_SECRET=BZZ322
npm start
# setting up internal
sudo apt-get install -y nginx
# nginx config for public
sudo cat > /etc/nginx/sites-available/web3.download <<EOF
server {
listen 80;
server_name web3.download;
location / {
proxy_pass http://127.0.0.1:32200;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
EOF
sudo ln -sf ../sites-available/web3.download /etc/nginx/sites-
sites-available/ sites-enabled/
# nginx config for netstats server
sudo cat > /etc/nginx/sites-available/swormhole <<EOF
server {
listen 80;
server_name swormhole.net;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
EOF
sudo ln -sf ../sites-available/swormhole.net /etc/nginx/sites-enabled
sudo apt-get install npm node
sudo npm install -g npm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
nvm install 0.12
git clone git@github.com:cubedro/eth-net-intelligence-api.git
cd eth-net-intelligence-api
npm install
sudo npm install -g pm2
CLUSTER_NAME=ethersphere
WS_SECRET="BZZ322"
swarm netstatconf 00 4 $CLUSTER_NAME "ws://146.185.130.117" $WS_SECRET
pm2 start $SWARM_DIR/$SWARM_NETWORK_ID/$CLUSTER_NAME.netstat.json
swarm netstatconf 00 4 muladhara "ws://146.185.130.117" $WS_SECRET
sudo ufw allow 32200:32299/tcp
sudo ufw allow 30200:30299/tcp
sudo ufw allow 30300:30399/tcp
sudo ufw allow 30300:30399/udp
sudo ufw allow ssh
sudo ufw allow 80/tcp
sudo ufw enable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment