]> git.openstreetmap.org Git - rails.git/blob - script/vagrant/setup/provision.sh
21d5daf5924075b90bad38cffb0f3b9fd9d5f27b
[rails.git] / script / vagrant / setup / provision.sh
1 #!/usr/bin/env bash
2
3 # set locale to UTF-8 compatible. apologies to non-english speakers...
4 update-locale LANG=en_GB.utf8 LC_ALL=en_GB.utf8
5 locale-gen
6 export LANG=en_GB.utf8
7 export LC_ALL=en_GB.utf8
8
9 # make sure we have up-to-date packages
10 apt-get update
11
12 ## vagrant grub-pc fix from: https://gist.github.com/jrnickell/6289943
13 # parameters
14 echo "grub-pc grub-pc/kopt_extracted boolean true" | debconf-set-selections
15 echo "grub-pc grub2/linux_cmdline string" | debconf-set-selections
16 echo "grub-pc grub-pc/install_devices multiselect /dev/sda" | debconf-set-selections
17 echo "grub-pc grub-pc/install_devices_failed_upgrade boolean true" | debconf-set-selections
18 echo "grub-pc grub-pc/install_devices_disks_changed multiselect /dev/sda" | debconf-set-selections
19 # vagrant grub fix
20 dpkg-reconfigure -f noninteractive grub-pc
21
22 # upgrade all packages
23 apt-get upgrade -y
24
25 # install packages as explained in INSTALL.md
26 apt-get install -y ruby1.9.1 libruby1.9.1 ruby1.9.1-dev ri1.9.1 \
27     libmagickwand-dev libxml2-dev libxslt1-dev nodejs \
28     apache2 apache2-threaded-dev build-essential git-core \
29     postgresql postgresql-contrib libpq-dev postgresql-server-dev-all \
30     libsasl2-dev
31 gem1.9.1 install bundle
32
33 ## install the bundle necessary for openstreetmap-website
34 pushd /srv/openstreetmap-website
35 # do bundle install as a convenience
36 sudo -u vagrant -H bundle install
37 # create user and database for openstreetmap-website
38 sudo -u postgres createuser -s vagrant
39 sudo -u vagrant -H createdb -E UTF-8 -O vagrant openstreetmap
40 sudo -u vagrant -H createdb -E UTF-8 -O vagrant osm_test
41 # add btree_gist extension
42 sudo -u vagrant -H psql -c "create extension btree_gist" openstreetmap
43 # TODO: build and set up postgres extensions
44 # set up sample configs
45 sudo -u vagrant cp config/example.database.yml config/database.yml
46 sudo -u vagrant cp config/example.application.yml config/application.yml
47 popd