-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvagrant_setup.sh
68 lines (54 loc) · 1.5 KB
/
vagrant_setup.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
#!/bin/bash
echo "Fixing tty issue with root"
sed -i 's/^mesg n$/tty -s \&\& mesg n/g' /root/.profile
echo "Updating package lists..."
apt-get -y update
aptitude -y upgrade --safe 2> /dev/null
apt-get -y install \
build-essential \
libssl-dev \
openssl \
python3-pip \
python3-dev \
libgeos-c1 \
gdal-bin \
git \
proj-bin \
libhiredis-dev \
postgresql \
postgresql-contrib \
postgis \
postgresql-9.3-postgis-2.1 \
libpq-dev \
libxml2-dev \
libxslt1-dev \
redis-server \
curl
# Install the python3 versions of virtualenv and wrapper
pip3 install virtualenv
pip3 install virtualenvwrapper
#service postgresql restart
sudo -u postgres /usr/bin/createuser -s vagrant
sudo -u postgres /usr/bin/createdb -E utf-8 -O vagrant bug_dev
sudo -u postgres /usr/bin/psql -d bug_dev -c "CREATE EXTENSION postgis;"
cat >> /home/vagrant/.bashrc << EOF
export PATH=/usr/local/bin:$PATH
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
source /usr/local/bin/virtualenvwrapper.sh
workon sherman_api
cd /vagrant
echo "Installing requirements.txt"
pip install -r /vagrant/requirements.txt
echo "Running Migrations"
./manage.py migrate
echo "--"
echo "To run the test suite: ./manage.py test"
echo ""
EOF
su vagrant -c "export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 && source /usr/local/bin/virtualenvwrapper.sh && mkvirtualenv --python=/usr/bin/python3 sherman_api"
echo ""
echo "Finished setting up the development server."
echo ""
echo "Login to the vagrant box with:"
echo "vagrant ssh"
echo ""