6 # make sure we have up-to-date packages
12 # install packages as explained in INSTALL.md
13 apt-get install -y ruby ruby-dev ruby-bundler \
14 libxml2-dev libxslt1-dev nodejs npm \
15 build-essential git-core firefox-esr \
16 postgresql postgresql-contrib libpq-dev libvips-dev libyaml-dev \
17 libsasl2-dev libffi-dev libgd-dev libarchive-dev libbz2-dev
18 npm install --global yarn
20 ## install the bundle necessary for openstreetmap-website
21 pushd /srv/openstreetmap-website
22 # do bundle install as a convenience
23 bundle install --retry=10 --jobs=2
24 # do yarn install as a convenience
25 bundle exec bin/yarn install
26 # create user and database for openstreetmap-website
27 db_user_exists=`sudo -u postgres psql postgres -tAc "select 1 from pg_roles where rolname='vagrant'"`
28 if [ "$db_user_exists" != "1" ]; then
29 sudo -u postgres createuser -s vagrant
32 # set up sample configs
33 if [ ! -f config/database.yml ]; then
34 sudo -u vagrant cp config/example.database.yml config/database.yml
36 if [ ! -f config/storage.yml ]; then
37 cp config/example.storage.yml config/storage.yml
39 touch config/settings.local.yml
40 # create the databases
41 sudo -u vagrant bundle exec rails db:create
42 # migrate the database to the latest version
43 sudo -u vagrant bundle exec rails db:migrate