]> git.openstreetmap.org Git - nominatim-ui.git/blob - README-nominatim-docker.md
Convert some link functions to Svelte components (#296)
[nominatim-ui.git] / README-nominatim-docker.md
1 # How to run nominatim-ui together with a Nominatim docker container
2
3 Nominatim starting version 4.5 uses the [gunicorn](https://gunicorn.org/) webserver
4 returning JSON (or XML) content. Nominatim no longer returns HTML and one cannot add
5 files to the webserver configuration. In other words it's no longer easy to add
6 nominatim-ui into an existing Nominatim docker container.
7
8
9 Install Nominatim, for example:
10
11 ```bash
12 docker run -it \
13   -e PBF_URL=https://download.geofabrik.de/europe/monaco-latest.osm.pbf \
14   -p 8085:8080 \
15   --name nominatim-monaco \
16   mediagis/nominatim:4.5
17 ```
18
19 Nominatim now runs on port 8085 (http://localhost:8085/status)
20
21 ## Create a nominatim-ui Docker container
22
23    1. Go to nominatim-ui directory
24
25     Download the latest nominatim-ui release, then
26     
27     ```
28     cd nominatim-ui
29     ```
30
31    2. Create nominatim-ui configuration
32
33    ```bash
34    tee dist/theme/config.theme.js << EOFUICONF > /dev/null
35    Nominatim_Config.Nominatim_API_Endpoint = 'http://localhost:8085/';
36    EOFUICONF
37    ```
38
39    3. Create a webserver configuration
40    
41    ```bash
42    tee nginx.conf << EOFNGINXCONF > /dev/null
43    server {
44        listen 80;
45
46        server_name _;
47
48        location / {
49            root /usr/share/nginx/html;
50            index index.html;
51        }
52    }
53    EOFNGINXCONF
54    ```
55
56    4. Create Docker configuration
57
58    ```bash
59    tee Dockerfile << EOFDOCKERFILE > /dev/null
60    FROM nginx:alpine
61
62    COPY dist /usr/share/nginx/html
63
64    COPY nginx.conf /etc/nginx/conf.d/default.conf
65
66    EXPOSE 80
67    EOFDOCKERFILE
68    ```
69
70    5. Start the Docker container
71
72    ```bash
73    docker build --tag nominatim-ui-service .
74    docker run -it -p 8081:80 nominatim-ui-service
75    ```
76
77 nominatim-ui now runs on port 8081 (http://localhost:8081/). Your browser will try
78 to access the Nominatim API on http://localhost:8085/ If that's not reachable you
79 might need to use the server's IP address or hostname.