-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathserver_setup.sh
More file actions
149 lines (108 loc) · 4.2 KB
/
Copy pathserver_setup.sh
File metadata and controls
149 lines (108 loc) · 4.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/bin/bash
# NOTE: This is not an automated script.
# Rather, it's the sequence of commands that were used to setup the geth Ropsten linux server.
# They will occasionally require provide prompts for input.
# initial server setup
sudo apt-get -y update
sudo apt-get -y upgrade
USR="truebit"
adduser $USR
usermod -aG sudo $USR
# To automate above, need to allow $USR to run sudo without typing password
# refer to this: https://askubuntu.com/questions/192050/how-to-run-sudo-command-with-no-password
su - $USR
mkdir ~/.ssh
chmod 700 ~/.ssh # set the permissions to only this user into it
vim ~/.ssh/authorized_keys
# step 1 – vim and paste in your public key.
# step 2 – paste in the public key of the app server.
# automate the above.
chmod 600 ~/.ssh/authorized_keys # set the permissions so only this user is allowed to access it
# check that you can ssh into server with $USR account
sudo sed -i -e "s/PermitRootLogin yes/PermitRootLogin no/" /etc/ssh/sshd_config
sudo sed -i -e "s/PasswordAuthentication yes/PasswordAuthentication no/" /etc/ssh/sshd_config
sudo service ssh restart
#-------------------------------------
# add swap space
# basically following this structure: https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04
# check current setup
sudo swapon -s
free -m
df -h
# create swap file
sudo fallocate -l 8G /swapfile
ls -lh /swapfile # verify
sudo chmod 600 /swapfile
ls -lh /swapfile # verify
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon -s # verify
free -m
# make the swap file permanent
sudo vim /etc/fstab
# add this line to bottom of file:
/swapfile none swap sw 0 0
# upate swap configs
sudo sysctl vm.swappiness=10
sudo sysctl vm.vfs_cache_pressure=50
sudo vim /etc/sysctl.conf
# at the bottom add:
vm.swappiness=10
vm.vfs_cache_pressure = 50
#----------------------------------
# installed sina's dotfiles :)
# follow the directions
git clone git@github.com:sinahab/dotfiles.git
# install tmux
sudo apt-get install tmux
#----------------------------------
# install geth
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum
sudo apt install geth
# to run on the Ropsten network: https://github.com/ethereum/ropsten
geth --testnet --fast --bootnodes "enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02b14182d37ea7c3c8b9c2683aeb6b733a1@52.169.14.227:30303,enode://6ce05930c72abc632c58e2e4324f7c7ea478cec0ed4fa2528982cf34483094e9cbc9216e7aa349691242576d552a2a56aaeae426c5303ded677ce455ba1acd9d@13.84.180.240:30303"
# to run on teh Rinkeby network: https://gist.github.com/cryptogoth/10a98e8078cfd69f7ca892ddbdcf26bc
geth --rinkeby
#----------------------------------
# install parity
sudo apt-get install build-essential openssl libssl-dev libudev-dev
# download the latest stable release:
wget https://parity-downloads-mirror.parity.io/v1.8.8/x86_64-unknown-linux-gnu/parity_1.8.8_amd64.deb
sudo apt install ./parity_1.8.8_amd64.deb
# follow the README:
# kill this after ~ 5 seconds, when the dev db is setup.
parity --chain dev
#----------------------------------
# install postgres
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
# give your user the ability to execute commands as postgres user
# by giving it the right permissions in pg_hba.conf
sudo vim /etc/postgresql/9.5/main/pg_hba.conf
# set METHOD to trust for all local connections – for now..
# restart postgres
sudo service postgresql restart
#----------------------------------
# clone the scrypt-interactive repo
git clone git@github.com:TrueBitFoundation/scrypt-interactive.git
# install node – @TODO: use nvm in the future
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install -y build-essential
#----------------------------------
# go through the README installation directions:
cd scrypt-interactive
# install node modules
npm install
sudo npm install -g sequelize-cli
sudo npm install -g truffle
# setup the dbs
sequelize db:create
sequelize db:migrate
NODE_ENV=test sequelize db:create
NODE_ENV=test sequelize db:migrate
# compile the contracts –
truffle compile