forked from official-stockfish/fishtest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SETUP
73 lines (58 loc) · 1.81 KB
/
SETUP
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
Setting up the server
sudo pip install pyramid
sudo pip install waitress
sudo pip install boto
sudo pip install requests
Installing Mongo:
Install latest MongoDB x64 to ~/mongodb
Start MongoDB:
- sudo mkdir -p /data/db
- sudo chown fishtest:fishtest /data/db
- cd ~/mongodb/bin
- nohup ./mongod >mongod.out &
Restore database from s3 fishtest/backup/archive/20130623:
- mkdir -p ~/backup/restore
- cd ~/backup/restore
- Using boto "fetch_file s3://fishtest/backup/archive/20130623/dump.tar.gz -o dump.tar.gz"
- tar xvf dump.tar.gz
- ~/mongodb/bin/mongorestore dump
iptables setup:
# Block common attacks
sudo iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
sudo iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP
sudo iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP
# Allow localhost connections
sudo iptables -A INPUT -i lo -j ACCEPT
# Allow web traffic
sudo iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
# Allow ssh
sudo iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
# Allow established connections
sudo iptables -I INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow all outgoing connections
sudo iptables -P OUTPUT ACCEPT
# Drop everything else
sudo iptables -P INPUT DROP
Mapping port 6543 to port 80:
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 6543
sudo iptables -I INPUT -p tcp --dport 6543 -j ACCEPT
sudo iptables -t nat -A OUTPUT -o lo -p tcp --dport 80 -j REDIRECT --to-port 6543
sudo /sbin/service iptables save
Setting up fishtest:
cd ~/fishtest/fishtest
sudo python setup.py develop
# Setting up fishtest to start on boot
sudo vi /etc/rc.d/rc.local
add "su - fishtest -c /home/fishtest/startup.sh" to end
startup.sh:
#!/bin/zsh
cd /home/fishtest
(
cd mongodb/bin
nohup ./mongod >mongod.out &!
)
sleep 5
(
cd fishtest/fishtest
./start.sh
)