forked from ridewithgps/ridewithgps-tilemill
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.sh
61 lines (51 loc) · 1.83 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
#!/usr/bin/env bash
cd /vagrant
if [ ! -f /initdone ];
then
apt-get update
apt-get install -y python-software-properties
cat > /etc/apt/sources.list.d/pgdg.list <<EOF
deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main
#deb-src http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main
EOF
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add -
apt-add-repository -y ppa:developmentseed/mapbox
apt-add-repository -y ppa:kakrueger/openstreetmap
apt-get update
apt-get --no-install-recommends install -y postgresql-9.3-postgis-2.2 postgresql-contrib-9.3 \
tilemill libmapnik nodejs osm2pgsql osmosis mapnik-input-plugin-postgis\
vim
tee /etc/tilemill/tilemill.config <<FOF
{
"files": "/usr/share/mapbox",
"server": true,
"listenHost": "0.0.0.0"
}
FOF
sudo -u postgres createuser gis
sudo -u postgres createdb -O gis gis
sudo -u postgres psql -c "CREATE EXTENSION hstore; CREATE EXTENSION postgis;" -d gis
sudo -u postgres psql -c "ALTER TABLE geometry_columns OWNER TO gis; ALTER TABLE spatial_ref_sys OWNER TO gis;" -d gis
#setup trusting auth so no errors with osm2pgsql
sudo sed -i 's/peer/trust/g' /etc/postgresql/9.3/main/pg_hba.conf
sudo service postgresql restart
if [ ! -f portland.osm ];
then
wget --quiet http://osm-extracted-metros.s3.amazonaws.com/portland.osm.bz2
bunzip2 portland.osm.bz2
fi
sudo -u postgres osm2pgsql --slim -d gis -U gis -C 512 --hstore --multi-geometry portland.osm
echo 'cd /vagrant' > /home/vagrant/.bashrc
touch /initdone
else
echo "blah blah blah"
fi
#not sure why, but on initial provision linking /vagrant doesn't work
for dir in /vagrant/styles/*; do
if [ -d "$dir" ]; then
if [ ! -f "/usr/share/mapbox/project/$(basename "$dir")" ]; then
sudo ln -s $dir /usr/share/mapbox/project/
fi
fi
done
start tilemill