forked from skylines-project/skylines
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
118 lines (73 loc) · 2.81 KB
/
Vagrantfile
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
$script = <<SCRIPT
set -e
# set environment variables
cat >> ~/.profile << EOF
export LANG=C
export LC_CTYPE=C
export POSTGIS_GDAL_ENABLED_DRIVERS=GTiff
export POSTGIS_ENABLE_OUTDB_RASTERS=1
EOF
sudo bash -c "cat > /etc/apt/sources.list.d/pgdg.list" << EOF
deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main
EOF
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
# update apt-get repository
sudo apt-get update
# install add-apt-repository tool
sudo apt-get install -y --no-install-recommends python-software-properties
# add ubuntu-toolchain-r/test PPA
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
# update apt-get repository
sudo apt-get update
# install base dependencies
sudo apt-get install -y --no-install-recommends \
g++-6 pkg-config libcurl4-openssl-dev python-dev git redis-server \
libpq-dev postgresql-9.4-postgis-2.2 postgresql-contrib-9.4 \
openjdk-7-jre-headless libfreetype6-dev libpng-dev libffi-dev
# set GCC 6 as default
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6
# install pip
wget -N -nv https://bootstrap.pypa.io/get-pip.py
sudo -H python get-pip.py
# install nvm, node 4.x, npm and bower
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash
export NVM_DIR="/home/vagrant/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
nvm install 4
npm install -g bower ember-cli phantomjs-prebuilt
# install skylines and the python dependencies
cd /vagrant
sudo -H pip install -r requirements.txt --no-binary greenlet
# install skylines frontend dependencies and build it
cd ember
npm install
bower install
ember build
cd ..
# create PostGIS databases
sudo sudo -u postgres createuser -s vagrant
sudo sudo -u postgres createdb skylines -O vagrant
sudo sudo -u postgres psql -d skylines -c 'CREATE EXTENSION postgis;'
sudo sudo -u postgres psql -d skylines -c 'CREATE EXTENSION fuzzystrmatch;'
sudo sudo -u postgres createdb skylines_test -O vagrant
sudo sudo -u postgres psql -d skylines_test -c 'CREATE EXTENSION postgis;'
sudo sudo -u postgres psql -d skylines_test -c 'CREATE EXTENSION fuzzystrmatch;'
./manage.py db create
# build assets
./manage.py assets build
# compile translations
./manage.py babel compile
SCRIPT
Vagrant.configure("2") do |config|
# TravisCI uses a Precise Pangolin base image
config.vm.box = 'ubuntu/precise64'
# increase memory size, required by 'npm install'
config.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
end
config.vm.network 'forwarded_port', guest: 5000, host: 5000
config.vm.network 'forwarded_port', guest: 5001, host: 5001
config.vm.network 'forwarded_port', guest: 5597, host: 5597, protocol: 'udp'
config.vm.provision 'shell', inline: $script, privileged: false
end