-
Notifications
You must be signed in to change notification settings - Fork 1
/
setupServer.sh
125 lines (81 loc) · 3.7 KB
/
setupServer.sh
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
#echo install ssh authorized keys to login
#sudo echo "fluffy ALL = NOPASSWD: ALL" > /etc/sudoers.d/cullen ;
#sudo chmod 0440 /etc/sudoers.d/cullen
#sudo echo "fluffy ALL=(postgres) NOPASSWD: ALL" >> /etc/sudoers.d/cullen
sudo apt-get update
sudo apt-get -y install ufw
sudo ufw default deny
sudo ufw logging on
sudo ufw allow ssh/tcp
sudo ufw limit ssh/tcp
sudo ufw allow http/tcp
sudo ufw allow https/tcp
#sudo ufw allow http-alt/tcp
echo y | sudo ufw enable
sudo apt-get -y upgrade
#echo you might want to reboot your server about here
sudo apt-get -y install fail2ban
sudo apt-get -y install logcheck logcheck-database
echo "America/Edmonton" | sudo tee /etc/timezone
sudo dpkg-reconfigure --frontend noninteractive tzdata
#sudo apt-get -y remove ax25-node libax25
sudo apt-get -y install emacs24-nox git-core build-essential gcc tcsh
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
sudo apt-get -y install curl
#sudo sh -c 'echo "deb http://stable.packages.cloudmonitoring.rackspace.com/ubuntu-14.04-x86_64 cloudmonitoring main" > /etc/apt/sources.list.d/rackspace-monitoring-agent.list'
#curl https://monitoring.api.rackspacecloud.com/pki/agent/linux.asc | sudo apt-key add -
#sudo apt-get update
#sudo apt-get install rackspace-monitoring-agent
#sudo apt-get -y install mongodb
#sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
#sudo sh -c 'echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" > /etc/apt/sources.list.d/mongodb.list '
#sudo apt-get update
#sudo apt-get -y install mongodb-org
#sudo apt-get -y install redis
#sudo apt-get -y install redis-server
#sudo cp /etc/redis/redis.conf /etc/redis/redis.conf.default
#sudo service redis-server restart
#curl http://www.rabbitmq.com/rabbitmq-signing-key-public.asc | sudo apt-key add -
#sudo sh -c 'echo "deb http://www.rabbitmq.com/debian/ testing main" > /etc/apt/sources.list.d/rabbitmq.list '
#sudo apt-get update
#sudo apt-get -y install rabbitmq-server
#sudo apt-get -y install nodejs
#sudo apt-get -y install npm
# Forever seems to need this
#sudo ln -s `which nodejs` /usr/local/bin/node
#sudo apt-get -y install node-legacy
#sudo npm install -g forever
#sudo npm install -g forever-monitor
#sudo npm install -g bower
# no idea why trying this twice is better
#sudo npm install -g forever
#sudo npm install -g forever-monitor
sudo apt-get -y install nginx
sudo rm /etc/nginx/sites-enabled/default
sudo apt-get -y install python-django
cd ~
git clone https://github.com/fluffy/SprayWind.git
# copy setting.tmpl to settings.py
cp SprayWind/website/settings.tmpl SprayWind/website/settings.py
mkdir SprayWind/static
sudo apt-get -y install uwsgi
sudo apt-get -y install uwsgi-plugin-python3
sudo apt-get -y install uwsgi-plugin-python
# adduser --system spraywind
cp /root/SprayWind/sprayWind-uwsgi.ini /etc/uwsgi/apps-available/sprayWind-uwsgi.ini
ln -s /etc/uwsgi/apps-available/sprayWind-uwsgi.ini /etc/uwsgi/apps-enabled/sprayWind-uwsgi.ini
cp /root/SprayWind/sprayWind-nginx.conf /etc/nginx/sites-available/sprayWind-nginx.conf
ln -s /etc/nginx/sites-available/sprayWind-nginx.conf /etc/nginx/sites-enabled/sprayWind-nginx.conf
#sudo service uwsgi restart
#sudo service nginx restart
#tail -f /var/log/nginx/access.log &
#tail -f /var/log/nginx/error.log &
# systemctl status uwsgi
chmod a+rx /Root
chown -R www-data /root/SprayWind
# systemctl restart uwsgi
# systemctl restart nginx
# git pull ; chown -R www-data /root/SprayWind; cp /root/SprayWind/sprayWind-uwsgi.ini /etc/uwsgi/apps-available/sprayWind-uwsgi.ini ; cp /root/SprayWind/sprayWind-nginx.conf /etc/nginx/sites-available/sprayWind-nginx.conf
sudo apt-get -y install python-pip
pip install uwsgitop
# uwsgitop "127.0.0.1:7001"