-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbootstrap.sh
62 lines (43 loc) · 1.46 KB
/
bootstrap.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
#!/usr/bin/env bash
# update apt-get
sudo apt-get update
# install various dependencies
sudo apt-get -y install build-essential libreadline-gplv2-dev libncursesw5-dev \
libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev sshpass \
git-core sloccount
# setup www folder
rm -rf /var/www
ln -fs /vagrant /var/www
# Install Python
sudo apt-get -y install python2.7 python-pip python-dev libpq-dev
sudo pip install --upgrade pip
# @see https://pip.pypa.io/en/latest/reference/pip.html
# Install code quality tools
sudo pip install -qqq pylint > /dev/null
sudo pip install --quiet mock coverage nose nosexcover clonedigger
# Install Flask Requirements
sudo pip install -qq -r /var/www/requirements.txt
# Setup Discover-Flask
APP_SETTINGS="config.ProductionConfig"
export APP_SETTINGS
# Install SQLite3
sudo apt-get -y install sqlite3 libsqlite3-dev
# create folder for SQLite DB
cd /tmp
mkdir tmp
sudo chown www-data:www-data /tmp/tmp
# create DB tables, set folder and file permissions
cd /var/www/
python db_create_users.py
python db_create_posts.py
sudo chown www-data:www-data /tmp/tmp/sample.db
sudo chmod -R 777 /tmp/tmp
# Open port 80
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables-save
# install Apache, configure, start it
sudo apt-get -y install apache2
sudo apt-get -y install libapache2-mod-wsgi
sudo cp /var/www/discover-flask.conf /etc/apache2/sites-enabled/discover-flask.conf
sudo /etc/init.d/apache2 reload
# sudo rm -R /var/www/html