|
1 |
| -# Nominatim Docker (Nominatim version 3.6) |
| 1 | +# Nominatim (Nominatim version 3.6) |
2 | 2 |
|
3 |
| -0. Copy .env-nominatim.example to .env-nominatim |
| 3 | +This version of Nominatim was copy from https://github.com/mediagis/nominatim-docker/tree/master/3.6, with certain updates to fit in osm-seed enviroment |
4 | 4 |
|
5 |
| -1. Build |
| 5 | +### Configuration |
6 | 6 |
|
7 |
| - ``` |
8 |
| - cd images/nominatim |
9 |
| - docker build --pull --rm -t nominatim . |
10 |
| - ``` |
11 |
| - See below for optional build arguments to include postcode data in your image. |
| 7 | +In order to run this container we need environment variables, these can be found in the following files👇: |
12 | 8 |
|
13 |
| -2. Copy <your_country>.osm.pbf to a local directory (i.e. /home/me/nominatimdata) |
| 9 | +- [.env.nominatim.example](./../../envs/.env.nominatim.example) |
14 | 10 |
|
15 |
| -3. Initialize Nominatim Database |
| 11 | +**Note**: Rename the above files as `.env.nominatim` |
16 | 12 |
|
17 |
| - ``` |
18 |
| - docker run -t -v /home/me/nominatimdata:/data nominatim sh /app/init.sh /data/<your_country>.osm.pbf postgresdata 4 |
19 |
| - ``` |
20 |
| - Where 4 is the number of threads to use during import. In general the import of data in postgres is a very time consuming |
21 |
| - process that may take hours or days. If you run this process on a multiprocessor system make sure that it makes the best use |
22 |
| - of it. You can delete the /home/me/nominatimdata/<your_country>.osm.pbf once the import is finished. |
| 13 | +#### Running nominatim - DB and API container |
23 | 14 |
|
24 |
| -5. Start database |
25 |
| - |
26 |
| - ``` |
27 |
| - docker run --name nominatim-db --restart=always -p 6432:5432 -d -v /home/me/nominatimdata/postgresdata:/var/lib/postgresql/12/main nominatim sh /app/startpostgres.sh |
28 |
| - ``` |
29 |
| - |
30 |
| -6. Start API server |
31 |
| - ``` |
32 |
| - docker run --name web --restart=always -p 7070:8080 -d -v /home/me/nominatimdata/:/data nominatim sh /app/startapache.sh |
33 |
| - ``` |
34 |
| - |
35 |
| -7. Configure incremental update. By default CONST_Replication_Url configured for Monaco. |
36 |
| -If you want a different update source, you will need to declare `CONST_Replication_Url` in local.php. Documentation [here] (https://github.com/openstreetmap/Nominatim/blob/master/docs/admin/Import-and-Update.md#updates). For example, to use the daily country extracts diffs for Gemany from geofabrik add the following: |
37 |
| - ``` |
38 |
| - @define('CONST_Replication_Url', 'http://download.geofabrik.de/europe/germany-updates'); |
39 |
| - ``` |
40 |
| - |
41 |
| - Now you will have a fully functioning nominatim instance available at : [http://localhost:7070/](http://localhost:7070). Unlike the previous versions |
42 |
| - this one does not store data in the docker context and this results to a much slimmer docker image. |
43 |
| - |
44 |
| -# Postcodes |
45 |
| - |
46 |
| -Nominatim requires additional data files to accurately assign postcodes data in the US and Great Britain (Northern Ireland postcodes are not included in this file) as described in [these Nominatim docs](https://nominatim.org/release-docs/latest/admin/Import-and-Update/#downloading-additional-data). Without this data, you may get incorrect postcodes for some address lookups. |
47 |
| - |
48 |
| -These data files aren't downloaded by default, but you can add them with additional arguments at the build stage. To include the US postcode data file, add "--build-arg with_postcodes_us=1" to the command line in stage 1, above. To include GB postcodes, run with "--build-arg with_postcodes_gb=1". You can run with both at once if desired, eg: |
49 |
| - ``` |
50 |
| - docker build --pull --rm -t nominatim --build-arg with_postcodes_us=1 --build-arg with_postcodes_gb=1 . |
51 |
| - ``` |
52 |
| - |
53 |
| -# Update |
54 |
| - |
55 |
| -Full documentation for Nominatim update available [here](https://github.com/osm-search/Nominatim/blob/master/docs/admin/Update.md). For a list of other methods see the output of: |
56 |
| - ``` |
57 |
| - docker exec -it nominatim sudo -u postgres ./src/build/utils/update.php --help |
58 |
| - ``` |
59 |
| - |
60 |
| -To initialise the updates run |
61 |
| - ``` |
62 |
| - docker exec -it nominatim sudo -u postgres ./src/build/utils/update.php --init-updates |
63 |
| - ``` |
64 |
| - |
65 |
| -The following command will keep your database constantly up to date: |
66 |
| - ``` |
67 |
| - docker exec -it nominatim sudo -u postgres ./src/build/utils/update.php --import-osmosis-all |
68 |
| - ``` |
69 |
| -If you have imported multiple country extracts and want to keep them |
70 |
| -up-to-date, have a look at the script in |
71 |
| -[issue #60](https://github.com/openstreetmap/Nominatim/issues/60). |
72 |
| - |
73 |
| -# Upgrade Guide for 3.6.x |
74 |
| - |
75 |
| -## Upgrade from 3.5.0 to 3.6.0 |
76 |
| - |
77 |
| -As referenced in the Nominatim release ([https://github.com/osm-search/Nominatim/releases/tag/v3.5.2](https://github.com/osm-search/Nominatim/releases/tag/v3.6.0)) the HTML frontend was removed from the project and moved to a separate project ([https://github.com/osm-search/nominatim-ui](https://github.com/osm-search/nominatim-ui)) if you need more than the API. |
78 |
| - |
79 |
| -In addition there is an extensive migration path to upgrade from 3.5 to 3.6 (see: [https://nominatim.org/release-docs/latest/admin/Migration/#350-360](https://nominatim.org/release-docs/latest/admin/Migration/#350-360)), so you should consider a full reimport of your data. |
80 |
| - |
81 |
| -# Docker image upgrade to 3.6 from <= 3.4 |
82 |
| - |
83 |
| -With 3.5 we have switched to Ubuntu 20.04 (LTS) which uses PostgreSQL 12. If you want to reuse your old data dictionary without importing the data again you have to make sure to migrate the data from PostgreSQL 11 to 12 with a command like ```pg_upgrade``` (see: [https://www.postgresql.org/docs/current/pgupgrade.html](https://www.postgresql.org/docs/current/pgupgrade.html)). |
84 |
| - |
85 |
| -You can try a script like [https://github.com/tianon/docker-postgres-upgrade](https://github.com/tianon/docker-postgres-upgrade) with some modifications. |
| 15 | +```sh |
| 16 | + # Docker compose |
| 17 | + docker-compose run nominatim-db |
| 18 | + docker-compose run nominatim-api |
| 19 | +``` |
0 commit comments