update instructions for Vagrant

This commit is contained in:
Sarah Hoffmann 2024-11-19 09:26:59 +01:00
parent 9cf5970e22
commit 4e59efa178

View File

@ -1,6 +1,6 @@
# Install Nominatim in a virtual machine for development and testing # Install Nominatim in a virtual machine for development and testing
This document describes how you can install Nominatim inside a Ubuntu 22 This document describes how you can install Nominatim inside a Ubuntu 24
virtual machine on your desktop/laptop (host machine). The goal is to give virtual machine on your desktop/laptop (host machine). The goal is to give
you a development environment to easily edit code and run the test suite you a development environment to easily edit code and run the test suite
without affecting the rest of your system. without affecting the rest of your system.
@ -15,29 +15,22 @@ is.
2. [Vagrant](https://www.vagrantup.com/downloads.html) 2. [Vagrant](https://www.vagrantup.com/downloads.html)
3. Nominatim 3. Nominatim
git clone --recursive https://github.com/openstreetmap/Nominatim.git
If you forgot `--recursive`, it you can later load the submodules using
git submodule init
git submodule update
git clone https://github.com/openstreetmap/Nominatim.git
## Installation ## Installation
1. Start the virtual machine 1. Start the virtual machine
vagrant up ubuntu vagrant up ubuntu24-nginx
2. Log into the virtual machine 2. Log into the virtual machine
vagrant ssh ubuntu vagrant ssh ubuntu24-nginx
3. Import a small country (Monaco) 3. Import a small country (Monaco)
See the FAQ how to skip this step and point Nominatim to an existing database. See the FAQ how to skip this step and point Nominatim to an existing database.
``` ```
@ -61,73 +54,22 @@ see Nominatim in action on [localhost:8089](http://localhost:8089/nominatim/).
You edit code on your host machine in any editor you like. There is no need to You edit code on your host machine in any editor you like. There is no need to
restart any software: just refresh your browser window. restart any software: just refresh your browser window.
Note that the webserver uses files from the /build directory. If you change Use the functions of the `log()` object to create temporary debug output.
files in Nominatim/website or Nominatim/utils for example you first need to Add `&debug=1` to the URL to see the output.
copy them into the /build directory by running the `cmake` step from the
installation.
PHP errors are written to `/var/log/apache2/error.log`.
With `echo` and `var_dump()` you write into the output (HTML/XML/JSON) when
you either add `&debug=1` to the URL.
In the Python BDD test you can use `logger.info()` for temporary debug In the Python BDD test you can use `logger.info()` for temporary debug
statements. statements.
For more information on running tests, see
https://nominatim.org/release-docs/develop/develop/Testing/
## Running unit tests
cd ~/Nominatim/tests/php
phpunit ./
## Running PHP code style tests
cd ~/Nominatim
phpcs --colors .
## Running functional tests
Tests in `test/bdd/db` and `test/bdd/osm2pgsql` have to pass 100%. Other
tests might require full planet-wide data. Sadly even if you have your own
planet-wide data there will be enough differences to the openstreetmap.org
installation to cause false positives in the other tests (see FAQ).
To run the full test suite
cd ~/Nominatim/test/bdd
behave -DBUILDDIR=/home/vagrant/build/ db osm2pgsql
To run a single file
behave -DBUILDDIR=/home/vagrant/build/ api/lookup/simple.feature
Or a single test by line number
behave -DBUILDDIR=/home/vagrant/build/ api/lookup/simple.feature:34
To run specific groups of tests you can add tags just before the `Scenario line`, e.g.
@bug-34
Scenario: address lookup for non-existing or invalid node, way, relation
and then
behave -DBUILDDIR=/home/vagrant/build/ --tags @bug-34
## FAQ ## FAQ
##### Will it run on Windows? ##### Will it run on Windows?
Yes, Vagrant and Virtualbox can be installed on MS Windows just fine. You need a 64bit Yes, Vagrant and Virtualbox can be installed on MS Windows just fine. You need
version of Windows. a 64bit version of Windows.
##### Will it run on Apple Silicon? ##### Will it run on Apple Silicon?
@ -136,11 +78,11 @@ There is no free/open source version of Parallels.
##### Why Monaco, can I use another country? ##### Why Monaco, can I use another country?
Of course! The Monaco import takes less than 30 minutes and works with 2GB RAM. Of course! The Monaco import takes less than 10 minutes and works with 2GB RAM.
##### Will the results be the same as those from nominatim.openstreetmap.org? ##### Will the results be the same as those from nominatim.openstreetmap.org?
No. Long running Nominatim installations will differ once new import features (or No. Long-running Nominatim installations will differ once new import features (or
bug fixes) get added since those usually only get applied to new/changed data. bug fixes) get added since those usually only get applied to new/changed data.
Also this document skips the optional Wikipedia data import which affects ranking Also this document skips the optional Wikipedia data import which affects ranking
@ -188,7 +130,3 @@ e.g. `psql --host localhost --port 9999 nominatim_it`
Yes. It's possible to start the virtual machine on [Amazon AWS (plugin)](https://github.com/mitchellh/vagrant-aws) Yes. It's possible to start the virtual machine on [Amazon AWS (plugin)](https://github.com/mitchellh/vagrant-aws)
or [DigitalOcean (plugin)](https://github.com/smdahlen/vagrant-digitalocean). or [DigitalOcean (plugin)](https://github.com/smdahlen/vagrant-digitalocean).