mirror of
https://github.com/osm-search/Nominatim.git
synced 2024-11-22 21:28:10 +03:00
fix for PHP7, added test setup
This commit is contained in:
parent
1d89098f77
commit
df764a3f3b
4
Vagrantfile
vendored
4
Vagrantfile
vendored
@ -14,6 +14,10 @@ Vagrant.configure("2") do |config|
|
||||
sub.vm.box = "ubuntu/trusty64"
|
||||
sub.vm.provision :shell, :path => "vagrant/ubuntu-trusty-provision.sh"
|
||||
end
|
||||
config.vm.define "ubuntu-php7" do |sub|
|
||||
sub.vm.box = "ubuntu/trusty64"
|
||||
sub.vm.provision :shell, :path => "vagrant/ubuntu-trusty-php7-provision.sh"
|
||||
end
|
||||
config.vm.define "centos" do |sub|
|
||||
sub.vm.box = "bento/centos-7.2"
|
||||
sub.vm.provision :shell, :path => "vagrant/centos-7-provision.sh"
|
||||
|
180
vagrant/ubuntu-trusty-php7-provision.sh
Executable file
180
vagrant/ubuntu-trusty-php7-provision.sh
Executable file
@ -0,0 +1,180 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script sets up a Nominatim installation on a Ubuntu box.
|
||||
#
|
||||
# For more detailed installation instructions see also
|
||||
# http://wiki.openstreetmap.org/wiki/Nominatim/Installation
|
||||
|
||||
## Part 1: System preparation
|
||||
|
||||
## During 'vagrant provision' this script runs as root and the current
|
||||
## directory is '/root'
|
||||
USERNAME=vagrant
|
||||
|
||||
###
|
||||
### maybe create ubuntu user
|
||||
###
|
||||
|
||||
# if [[ ! `id -u $USERNAME` ]]; then
|
||||
# useradd $USERNAME --create-home --shell /bin/bash
|
||||
#
|
||||
# # give sudo power
|
||||
# echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/99-$USERNAME-user
|
||||
# chmod 0440 /etc/sudoers.d/99-$USERNAME-user
|
||||
# service sudo restart
|
||||
#
|
||||
# # add basic .profile
|
||||
# cp -r .ssh .profile .bashrc /home/$USERNAME/
|
||||
# chown -R $USERNAME /home/$USERNAME/.*
|
||||
# chgrp -R $USERNAME /home/$USERNAME/.*
|
||||
#
|
||||
# # now ideally login as $USERNAME and continue
|
||||
# su $USERNAME -l
|
||||
# fi
|
||||
|
||||
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get upgrade -y
|
||||
sudo apt-get install -y build-essential libgeos-dev libpq-dev libbz2-dev \
|
||||
libtool automake libproj-dev libboost-dev libboost-system-dev \
|
||||
libboost-filesystem-dev libboost-thread-dev libexpat-dev
|
||||
sudo apt-get autoremove -y
|
||||
|
||||
# get arrow-keys working in terminal (e.g. editing in vi)
|
||||
echo 'stty sane' >> ~/.bash_profile
|
||||
echo 'export TERM=linux' >> ~/.bash_profile
|
||||
source ~/.bash_profile
|
||||
|
||||
|
||||
###
|
||||
### PostgreSQL 9.3 + PostGIS 2.1
|
||||
###
|
||||
|
||||
sudo apt-get install -y postgresql-9.3-postgis-2.1 postgresql-contrib-9.3 postgresql-server-dev-9.3
|
||||
# already included: proj-bin libgeos-dev
|
||||
|
||||
# make sure OS-authenticated users (e.g. $USERNAME) can access
|
||||
sudo sed -i "s/ident/trust/" /etc/postgresql/9.3/main/pg_hba.conf
|
||||
sudo sed -i "s/md5/trust/" /etc/postgresql/9.3/main/pg_hba.conf
|
||||
sudo sed -i "s/peer/trust/" /etc/postgresql/9.3/main/pg_hba.conf
|
||||
sudo /etc/init.d/postgresql restart
|
||||
|
||||
# creates the role
|
||||
sudo -u postgres createuser -s $USERNAME
|
||||
|
||||
|
||||
|
||||
###
|
||||
### PHP for frontend
|
||||
###
|
||||
sudo LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y apache2
|
||||
sudo apt-get install -y php7.0 php7.0-pgsql php7.0-fpm libapache2-mod-php7.0 php-pear php-db
|
||||
|
||||
|
||||
# get rid of some warning
|
||||
# where is the ini file? 'php --ini'
|
||||
echo "date.timezone = 'Etc/UTC'" | sudo tee /etc/php/7.0/cli/conf.d/99-timezone.ini > /dev/null
|
||||
|
||||
|
||||
|
||||
###
|
||||
### Nominatim
|
||||
###
|
||||
sudo apt-get install -y libgeos-c1 libgeos++-dev libxml2-dev
|
||||
|
||||
## Part 2: Nominatim installaion
|
||||
|
||||
# now ideally login as $USERNAME and continue
|
||||
cd /home/$USERNAME
|
||||
|
||||
# If the Nominatim source is not being shared with the host, check out source.
|
||||
if [ ! -d "Nominatim" ]; then
|
||||
sudo apt-get install -y git
|
||||
sudo -u $USERNAME git clone --recursive https://github.com/twain47/Nominatim.git
|
||||
fi
|
||||
|
||||
cd Nominatim
|
||||
|
||||
sudo -u $USERNAME ./autogen.sh
|
||||
sudo -u $USERNAME ./configure
|
||||
sudo -u $USERNAME make
|
||||
chmod +x ./
|
||||
chmod +x ./module
|
||||
|
||||
|
||||
LOCALSETTINGS_FILE='settings/local.php'
|
||||
if [[ -e "$LOCALSETTINGS_FILE" ]]; then
|
||||
echo "$LOCALSETTINGS_FILE already exist, writing to settings/local-vagrant.php instead."
|
||||
LOCALSETTINGS_FILE='settings/local-vagrant.php'
|
||||
fi
|
||||
|
||||
# IP=`curl -s http://bot.whatismyipaddress.com`
|
||||
IP=localhost
|
||||
echo "<?php
|
||||
// General settings
|
||||
@define('CONST_Database_DSN', 'pgsql://@/nominatim');
|
||||
// Paths
|
||||
@define('CONST_Postgresql_Version', '9.3');
|
||||
@define('CONST_Postgis_Version', '2.1');
|
||||
// Website settings
|
||||
@define('CONST_Website_BaseURL', 'http://$IP:8089/nominatim/');
|
||||
" > $LOCALSETTINGS_FILE
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
###
|
||||
### Setup Apache/website
|
||||
###
|
||||
|
||||
sudo -u postgres createuser -SDR www-data
|
||||
|
||||
echo '
|
||||
Listen 8089
|
||||
<VirtualHost *:8089>
|
||||
# DirectoryIndex index.html
|
||||
# ErrorDocument 403 /index.html
|
||||
|
||||
DocumentRoot "/var/www/"
|
||||
|
||||
<Directory "/var/www/nominatim/">
|
||||
Options FollowSymLinks MultiViews
|
||||
AddType text/html .php
|
||||
</Directory>
|
||||
</VirtualHost>
|
||||
' | sudo tee /etc/apache2/sites-enabled/nominatim.conf > /dev/null
|
||||
|
||||
|
||||
service apache2 graceful
|
||||
|
||||
|
||||
mkdir -m 755 /var/www/nominatim
|
||||
chown $USERNAME /var/www/nominatim
|
||||
sudo -u $USERNAME ./utils/setup.php --create-website /var/www/nominatim
|
||||
|
||||
|
||||
# if you get 'permission denied for relation word', then try
|
||||
# GRANT usage ON SCHEMA public TO "www-data";
|
||||
# GRANT SELECT ON ALL TABLES IN SCHEMA public TO "www-data";
|
||||
|
||||
##
|
||||
## Test suite (Python)
|
||||
## https://github.com/twain47/Nominatim/tree/master/tests
|
||||
##
|
||||
apt-get install -y python-dev python-pip python-Levenshtein python-shapely \
|
||||
python-psycopg2 tidy python-nose python-tidylib
|
||||
pip install certifi # deals with "SNI extension to TLS is not available" warning
|
||||
pip install lettuce==0.2.18 six==1.7 haversine
|
||||
pip install --upgrade pip setuptools
|
||||
|
||||
## Test suite (PHP)
|
||||
## https://github.com/twain47/Nominatim/tree/master/tests-php
|
||||
wget --quiet https://phar.phpunit.de/phpunit.phar
|
||||
chmod +x phpunit.phar
|
||||
mv phpunit.phar /usr/local/bin/phpunit
|
||||
|
@ -147,7 +147,7 @@ Listen 8089
|
||||
' | sudo tee /etc/apache2/sites-enabled/nominatim.conf > /dev/null
|
||||
|
||||
|
||||
apache2ctl graceful
|
||||
service apache2 graceful
|
||||
|
||||
|
||||
mkdir -m 755 /var/www/nominatim
|
||||
|
@ -14,7 +14,7 @@
|
||||
$fLon = CONST_Default_Lon;
|
||||
$iZoom = CONST_Default_Zoom;
|
||||
|
||||
$oGeocode =& new Geocode($oDB);
|
||||
$oGeocode = new Geocode($oDB);
|
||||
|
||||
$aLangPrefOrder = getPreferredLanguages();
|
||||
$oGeocode->setLanguagePreference($aLangPrefOrder);
|
||||
|
Loading…
Reference in New Issue
Block a user