6 # set locale to UTF-8 compatible. apologies to non-english speakers...
8 update-locale LANG=en_GB.utf8 LC_ALL=en_GB.utf8
10 export LC_ALL=en_GB.utf8
12 # make sure we have up-to-date packages
15 # upgrade all packages
18 # install packages as explained in INSTALL.md
19 apt-get install -y ruby2.7 libruby2.7 ruby2.7-dev \
20 libxml2-dev libxslt1-dev nodejs yarnpkg \
21 build-essential git-core firefox-geckodriver \
22 postgresql postgresql-contrib libpq-dev libvips-dev \
23 libsasl2-dev libffi-dev libgd-dev libarchive-dev libbz2-dev
24 gem2.7 install --version "~> 2.1.4" bundler
26 ## install the bundle necessary for openstreetmap-website
27 pushd /srv/openstreetmap-website
28 # do bundle install as a convenience
29 bundle install --retry=10 --jobs=2
30 # do yarn install as a convenience
31 bundle exec bin/yarn install
32 # create user and database for openstreetmap-website
33 db_user_exists=`sudo -u postgres psql postgres -tAc "select 1 from pg_roles where rolname='vagrant'"`
34 if [ "$db_user_exists" != "1" ]; then
35 sudo -u postgres createuser -s vagrant
36 sudo -u vagrant createdb -E UTF-8 -O vagrant openstreetmap
37 sudo -u vagrant createdb -E UTF-8 -O vagrant osm_test
40 # set up sample configs
41 if [ ! -f config/database.yml ]; then
42 sudo -u vagrant cp config/example.database.yml config/database.yml
44 if [ ! -f config/storage.yml ]; then
45 cp config/example.storage.yml config/storage.yml
47 touch config/settings.local.yml
48 # migrate the database to the latest version
49 sudo -u vagrant bundle exec rails db:migrate