Skip to content

Commit 0835e51

Browse files
authored
Docs 2 (#20)
* chore: simplify application-docker.properties configuration - Removed unused server and static resource settings. - Updated property names for consistency (`paikka.import-configuration.threads` → `paikka.import.threads`). - Adjusted default path for `paikka.stats-db-path`. * chore: add STATS_DIR environment variable and directory setup in Dockerfile * chore: update docker-compose.yml service configuration - Simplified environment variables for `paikka` service. - Adjusted `start_period` in healthcheck. - Removed unused volume drivers for cleaner setup. * docs: update README formatting and environment variable details - Improved list indentation for better readability. - Clarified admin password requirements and `.env` setup in Docker Compose section. - Updated memory and swap recommendations for import operations. - Enhanced example commands with detailed parameter descriptions.
1 parent d4699bf commit 0835e51

4 files changed

Lines changed: 137 additions & 125 deletions

File tree

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ RUN apt update && DEBIAN_FRONTEND=noninteractive apt-get -yq install osmium-tool
1515
ENV SPRING_PROFILES_ACTIVE=docker
1616
ENV APP_HOME=/app
1717
ENV DATA_DIR=/data
18+
ENV STATS_DIR=/stats
1819

1920
# Create application directory
2021
RUN mkdir -p $APP_HOME && \
@@ -46,6 +47,9 @@ fi
4647
mkdir -p $DATA_DIR
4748
chown -R paikka:paikka $DATA_DIR
4849

50+
mkdir -p $STATS_DIR
51+
chown -R paikka:paikka $STATS_DIR
52+
4953
# Switch to data directory
5054
cd $DATA_DIR
5155

README.md

Lines changed: 124 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -17,38 +17,39 @@ Standard geocoding solutions often fall short for specific personal tracking nee
1717

1818
## Relationship to Reitti
1919

20-
[Reitti](https://github.com/dedicatedcode/reitti) is a comprehensive personal location tracking and analysis application that helps you understand your movement patterns and significant places. PAIKKA acts as the dedicated "location engine" for Reitti, converting raw GPS coordinates into human-readable context.
20+
[Reitti](https://github.com/dedicatedcode/reitti) is a comprehensive personal location tracking and analysis application that helps you understand your movement patterns and significant places. PAIKKA acts as the dedicated "location engine" for Reitti, converting raw GPS
21+
coordinates into human-readable context.
2122

2223
## Limitations
2324

2425
- Boundary data is dependent on availability within the source nodes.
2526
- Optimized for read-heavy serving; updates require re-importing prepared data.
2627
- Focused strictly on reverse geocoding (coordinates to place).
2728
- **Highly Opinionated POI Selection:** PAIKKA is deliberately selective about which Points of Interest it imports. It only includes POIs with the following OSM tags:
28-
- `amenity` (e.g., restaurant, school, hospital, fuel, atm)
29-
- `shop` (e.g., supermarket, clothes, bakery)
30-
- `tourism` (e.g., hotel, museum, attraction)
31-
- `leisure` (e.g., fitness_centre, playground, park)
32-
- `office` (e.g., company, government, insurance)
33-
- `craft` (e.g., carpenter, electrician, painter)
34-
- `healthcare` (e.g., hospital, pharmacy, clinic)
35-
- `emergency` (e.g., ambulance_station, fire_hydrant)
36-
- `historic` (e.g., monument, archaeological_site)
37-
- `natural` (e.g., peak, cave, waterfall)
38-
- `man_made` (e.g., tower, pier, windmill)
39-
- `place` (e.g., city, town, village, neighborhood)
40-
- `sport` (e.g., tennis, swimming, fitness)
41-
- `public_transport` (e.g., stop_position, station)
42-
- `railway` (stations only)
43-
- `aeroway` (e.g., aerodrome, helipad)
44-
- `building` (commercial, retail, industrial, office – but not residential or generic "yes")
45-
29+
- `amenity` (e.g., restaurant, school, hospital, fuel, atm)
30+
- `shop` (e.g., supermarket, clothes, bakery)
31+
- `tourism` (e.g., hotel, museum, attraction)
32+
- `leisure` (e.g., fitness_centre, playground, park)
33+
- `office` (e.g., company, government, insurance)
34+
- `craft` (e.g., carpenter, electrician, painter)
35+
- `healthcare` (e.g., hospital, pharmacy, clinic)
36+
- `emergency` (e.g., ambulance_station, fire_hydrant)
37+
- `historic` (e.g., monument, archaeological_site)
38+
- `natural` (e.g., peak, cave, waterfall)
39+
- `man_made` (e.g., tower, pier, windmill)
40+
- `place` (e.g., city, town, village, neighborhood)
41+
- `sport` (e.g., tennis, swimming, fitness)
42+
- `public_transport` (e.g., stop_position, station)
43+
- `railway` (stations only)
44+
- `aeroway` (e.g., aerodrome, helipad)
45+
- `building` (commercial, retail, industrial, office – but not residential or generic "yes")
46+
4647
Many common OSM features are explicitly excluded, such as:
47-
- Natural features like trees and grass
48-
- Man-made structures like electric-poles, trash cans
49-
- Amenities like benches, drinking water, and picnic tables
50-
- Swimming pools and fountains
51-
48+
- Natural features like trees and grass
49+
- Man-made structures like electric-poles, trash cans
50+
- Amenities like benches, drinking water, and picnic tables
51+
- Swimming pools and fountains
52+
5253
If you need comprehensive POI coverage including all OSM features, **Nominatim** would be a better fit for your use case. While it would be technically possible to import the complete unfiltered dataset, this was never the intended design and has not been tested.
5354

5455
## Features
@@ -124,7 +125,7 @@ The [OpenStreetMap website](https://www.openstreetmap.org/export/) allows you to
124125
The above benchmarks were performed on the following hardware:
125126

126127
- **CPU:** AMD Ryzen 7 5825U with Radeon Graphics (8 cores, 16 threads, 4.5 GHz max)
127-
- **Memory:** 31 GiB system RAM
128+
- **Memory:** 32 GiB system RAM
128129
- **Storage:** ZFS Pool on 4 HDD
129130

130131
**Import Command Used:**
@@ -134,11 +135,13 @@ docker run -ti -v ./:/data dedicatedcode/paikka:develop import --memory 16G --th
134135

135136
**Memory Considerations:**
136137

137-
The `--memory` flag (e.g., `--memory 16G`) controls the JVM heap size only. RocksDB requires additional memory beyond the heap for its block cache and internal structures. For optimal performance with large imports, ensure your system has significantly more RAM available than the heap size specified. As a guideline, a 16GB heap typically works well on systems with 24-32GB of RAM for medium-sized countries, while planet imports benefit from 32GB+ heap on systems with 64GB+ RAM.
138+
The `--memory` flag (e.g., `--memory 16G`) controls the JVM heap size only. RocksDB requires additional memory beyond the heap for its block cache and internal structures. For optimal performance with large imports, ensure your system has significantly more RAM available than
139+
the heap size specified. As a guideline, a 16GB heap typically works well on systems with 24-32GB of RAM for medium-sized countries, while planet imports benefit from 32GB+ heap on systems with 64GB+ RAM.
138140

139141
**Swap Space:**
140142

141-
Ensure adequate swap space is available. During import, memory usage can spike due to RocksDB's internal buffering and compaction operations. Without sufficient swap, the system may invoke the OOM killer to terminate processes when memory limits are exceeded. A good rule of thumb is to have swap space at least equal to or larger than the JVM heap size (e.g., 16GB heap with 16GB+ swap).
143+
Ensure adequate swap space is available. During import, memory usage can spike due to RocksDB's internal buffering and compaction operations. Without sufficient swap, the system may invoke the OOM killer to terminate processes when memory limits are exceeded. A good rule of
144+
thumb is to have swap space at least equal to or larger than the JVM heap size (e.g., 16GB heap with 16GB+ swap).
142145

143146
**Storage Considerations:**
144147

@@ -186,11 +189,17 @@ docker run -v /path/to/your/data:/data dedicatedcode/paikka prepare input.osm.pb
186189
Run the `import` script to import the filtered data into the data directory:
187190

188191
```bash
189-
docker run -ti -v /path/to/your/data:/data dedicatedcode/paikka:latest import filtered.osm.pbf
192+
docker run -ti \
193+
-v /path/to/your/data:/data \
194+
--memory 16g \
195+
dedicatedcode/paikka:latest \
196+
import filtered.osm.pbf --memory 16g --threads 10
190197
```
191198

192-
- `filtered.osm.pbf` is the filtered PBF file from the previous step
193-
- `/data` is the target directory inside the container (mounted from your local directory)
199+
Parameters:
200+
- `--memory`: JVM heap size (e.g., `16g`, `32g`)
201+
- `--threads`: Number of import threads (default: `10`)
202+
- `--data-dir`: Directory to store imported data (default: `/data` inside container)
194203

195204
After import completes, your data directory will contain the processed data files ready for the service.
196205

@@ -201,40 +210,46 @@ To run the PAIKKA service itself:
201210
```bash
202211
docker run -d \
203212
-v /path/to/your/data:/data \
213+
-v /path/to/stats:/stats \
204214
-p 8080:8080 \
205215
-e ADMIN_PASSWORD=your-secure-password \
206-
paikka
216+
dedicatedcode/paikka:latest
207217
```
208218

209-
The data directory is mounted at `/data` inside the container, and the service runs on port 8080.
219+
- `/data` directory contains the processed POI and geometry data
220+
- `/stats` directory contains the statistics database
221+
- The service runs on port 8080
222+
- Admin interface requires `ADMIN_PASSWORD` to be set
210223

211224
#### Docker Environment Variables
212225

213226
When running with Docker, you can configure the service using environment variables:
214227

215228
| Environment Variable | Purpose | Default Value |
216229
|---------------------|---------|---------------|
217-
| `DATA_DIR` | Directory where processed data is stored | `./data` |
230+
| `DATA_DIR` | Directory where processed data is stored | `/data` |
218231
| `MAX_IMPORT_THREADS` | Maximum number of threads for data import | `10` |
219232
| `MAX_RESULTS` | Maximum number of results returned by API | `500` |
220233
| `DEFAULT_RESULTS` | Default number of results when not specified | `10` |
221234
| `BASE_URL` | Base URL for the service (used in responses) | `http://localhost:8080` |
222-
| `STATS_DB_PATH` | Path to the statistics database | `./data/stats.db` |
223-
| `ADMIN_PASSWORD` | Password for admin interface access | _(empty)_ |
224-
| `APP_LOG_LEVEL` | Log level for the application | `INFO` |
235+
| `STATS_DB_PATH` | Path to the statistics database | `/stats/stats.db` |
236+
| `ADMIN_PASSWORD` | Password for admin interface access (required) | _(empty - admin interface disabled if not set)_ |
237+
| `APP_LOG_LEVEL` | Log level for the application (`DEBUG`, `INFO`, `WARN`, `ERROR`) | `INFO` |
238+
239+
**Note:** The admin interface is disabled if `ADMIN_PASSWORD` is not set. To enable admin features, you must provide a password.
225240

226241
Example with custom configuration:
227242

228243
```bash
229244
docker run -d \
230245
-v /path/to/your/data:/data \
246+
-v /path/to/stats:/stats \
231247
-p 8080:8080 \
232-
-e DATA_DIR=/data \
233248
-e MAX_RESULTS=1000 \
234249
-e DEFAULT_RESULTS=20 \
235250
-e ADMIN_PASSWORD=your-secure-password \
236251
-e APP_LOG_LEVEL=DEBUG \
237-
paikka
252+
dedicatedcode/paikka:latest
238253
```
239254

240255
### Examples
@@ -264,6 +279,7 @@ mvn spring-boot:run
264279
```bash
265280
java -Xmx8g -jar target/paikka-*.jar --data-dir=/path/to/data
266281
```
282+
267283
## Running with Docker Compose
268284

269285
Docker Compose provides an easy way to run PAIKKA with persistent volumes for data and statistics.
@@ -276,35 +292,62 @@ Docker Compose provides an easy way to run PAIKKA with persistent volumes for da
276292

277293
### Quick Start
278294

279-
1. Download the docker-compose.yml file:
280-
```bash
281-
curl -O https://raw.githubusercontent.com/dedicatedcode/paikka/main/docker-compose.yml
282-
```
295+
1. Create a `docker-compose.yml` file with the following content:
296+
297+
```yaml
298+
version: '3.8'
299+
300+
services:
301+
paikka:
302+
image: dedicatedcode/paikka:latest
303+
restart: unless-stopped
304+
env_file:
305+
- .env
306+
ports:
307+
- "8080:8080"
308+
environment:
309+
- ADMIN_PASSWORD=your-password-here
310+
- BASE_URL=http://localhost:8080
311+
volumes:
312+
- paikka-data:/data
313+
- paikka-stats:/stats
314+
healthcheck:
315+
test: ["CMD", "curl", "-f", "http://localhost:8080/api/v1/health"]
316+
interval: 30s
317+
timeout: 10s
318+
retries: 3
319+
start_period: 40s
320+
321+
volumes:
322+
paikka-data:
323+
paikka-stats:
324+
```
283325
284-
2. Configure PAIKKA using environment variables in `.env` file or the command line:
285-
```bash
286-
# Example .env file
287-
ADMIN_PASSWORD=your-secure-password
288-
BASE_URL=https://your-domain.com
289-
MAX_RESULTS=1000
290-
APP_LOG_LEVEL=DEBUG
291-
```
326+
2. Create a `.env` file in the same directory to configure your environment variables:
292327

293-
3. Create a data directory:
294-
```bash
295-
mkdir -p data
296-
mkdir -p stats
297-
```
298-
4. Start the service:
328+
```bash
329+
# Example .env file
330+
ADMIN_PASSWORD=your-secure-password
331+
BASE_URL=http://localhost:8080
332+
MAX_RESULTS=500
333+
DEFAULT_RESULTS=10
334+
MAX_IMPORT_THREADS=10
335+
APP_LOG_LEVEL=INFO
336+
```
337+
338+
3. Start the service:
299339
```bash
300340
docker compose up -d
301341
```
302342

303-
5. Verify the service is running:
343+
4. Verify the service is running:
304344
```bash
305345
curl 'http://localhost:8080/api/v1/health'
306346
```
307347

348+
### Important: Admin Password
349+
The admin interface requires a password to be set via the `ADMIN_PASSWORD` environment variable. If not set, the admin endpoints will be inaccessible. Set it in your `.env` file or docker-compose configuration.
350+
308351
### Volume Management
309352

310353
Docker Compose creates two persistent volumes:
@@ -344,66 +387,51 @@ docker compose up -d
344387

345388
### Configuration
346389

347-
Configure the service using environment variables or application properties:
390+
Configure the service using environment variables or application properties. The Docker version uses the following Spring profile properties:
348391

349392
```properties
350-
# Server configuration
351-
server.port=8080
352-
353-
# HTTP compression
354-
server.compression.enabled=true
355-
server.compression.min-response-size=1024
356-
server.compression.mime-types=text/plain,application/json
357-
358-
# Static resource caching
359-
spring.web.resources.cache.cachecontrol.max-age=31536000
360-
spring.web.resources.cache.cachecontrol.cache-public=true
361-
spring.web.resources.chain.strategy.content.enabled=true
362-
spring.web.resources.chain.strategy.content.paths=/css/**,/js/**,/img/**,/fonts/**
363-
364-
# Data directory
365-
paikka.data-dir=./data
393+
# Data directory (Docker default: /data)
394+
paikka.data-dir=${DATA_DIR:/data}
366395
367396
# Import configuration
368-
paikka.import.threads=16
369-
paikka.import.s2-level=14
397+
paikka.import.threads=${MAX_IMPORT_THREADS:10}
370398
paikka.import.chunk-size=100000
371399
372400
# Query configuration
373-
paikka.query.max-results=500
374-
paikka.query.default-results=10
375-
paikka.query.base-url=http://localhost:8080
401+
paikka.query.max-results=${MAX_RESULTS:500}
402+
paikka.query.default-results=${DEFAULT_RESULTS:10}
403+
paikka.query.base-url=${BASE_URL:http://localhost:8080}
376404
377-
# Statistics database path
378-
paikka.stats-db-path=./data/stats.db
405+
# Statistics database path (Docker default: /stats/stats.db)
406+
paikka.stats-db-path=${STATS_DB_PATH:/stats/stats.db}
379407
380-
# Admin password
381-
paikka.admin.password=your-secure-password
408+
# Admin password (required for admin interface)
409+
paikka.admin.password=${ADMIN_PASSWORD:}
382410
383411
# Logging
384-
logging.level.com.dedicatedcode.paikka=INFO
412+
logging.level.com.dedicatedcode.paikka=${APP_LOG_LEVEL:INFO}
385413
logging.level.root=WARN
386414
```
387415

388-
| Property | Description | Default Value |
389-
|----------|-------------|---------------|
416+
| Property | Description | Default Value (Docker) |
417+
|----------|-------------|------------------------|
390418
| `server.port` | HTTP server port | `8080` |
391419
| `server.compression.enabled` | Enable HTTP response compression | `true` |
392420
| `server.compression.min-response-size` | Minimum response size to trigger compression (bytes) | `1024` |
393421
| `server.compression.mime-types` | MIME types to compress | `text/plain,application/json` |
394422
| `spring.web.resources.cache.cachecontrol.max-age` | Static resource cache max age (seconds) | `31536000` |
395-
| `paikka.data-dir` | Directory where processed data is stored | `./data` |
396-
| `paikka.import.threads` | Number of threads for data import | `16` |
397-
| `paikka.import.s2-level` | S2 spatial indexing level (10-15) | `14` |
423+
| `paikka.data-dir` | Directory where processed data is stored | `/data` |
424+
| `paikka.import.threads` | Number of threads for data import | `10` |
398425
| `paikka.import.chunk-size` | Number of elements to process per chunk | `100000` |
399426
| `paikka.query.max-results` | Maximum number of results returned by API | `500` |
400427
| `paikka.query.default-results` | Default number of results when not specified | `10` |
401428
| `paikka.query.base-url` | Base URL for the service (used in responses) | `http://localhost:8080` |
402-
| `paikka.stats-db-path` | Path to the statistics database | `./data/stats.db` |
403-
| `paikka.admin.password` | Password for admin interface access | _(empty)_ |
429+
| `paikka.stats-db-path` | Path to the statistics database | `/stats/stats.db` |
430+
| `paikka.admin.password` | Password for admin interface access | _(empty - admin interface disabled)_ |
404431
| `logging.level.com.dedicatedcode.paikka` | Application log level | `INFO` |
405432
| `logging.level.root` | Root log level | `WARN` |
406433

434+
407435
### Sample Requests
408436

409437
```bash
@@ -423,7 +451,7 @@ curl 'http://localhost:8080/api/v1/geometry/12345'
423451
### Web Interface
424452

425453
- Visit `http://localhost:8080/` for the about page
426-
- Visit `http://localhost:8080/admin/stats` to access the admin dashboard (login required)
454+
- Visit `http://localhost:8080/login` to access the admin dashboard (requires `ADMIN_PASSWORD` to be set)
427455

428456
## Integration with Reitti
429457

@@ -433,13 +461,13 @@ TBA
433461

434462
There are multiple ways of getting support:
435463

436-
- Create a [new issue](https://github.com/dedicatedcode/paikka/issues/new/choose) in the repository
464+
- Create a (https://github.com/dedicatedcode/paikka/issues/new/choose) in the repository
437465
- Tag me on [Lemmy](https://discuss.tchncs.de/u/danielgraf)
438-
- Join **#reitti** on [irc.dedicatedcode.com](https://irc.dedicatedcode.com)
466+
- Join **#reitti** on (https://irc.dedicatedcode.com)
439467

440468
## Contributing
441469

442-
Contributions are welcome! Please feel free to submit a Pull Request to [repository](https://github.com/dedicatedcode/paikka).
470+
Contributions are welcome! Please feel free to submit a Pull Request to (https://github.com/dedicatedcode/paikka).
443471

444472
## Technology Stack
445473

@@ -457,4 +485,4 @@ This project is licensed under the GNU Affero General Public License v3 (AGPLv3)
457485

458486
## About
459487

460-
PAIKKA is developed as part of the Reitti ecosystem by [dedicatedcode](https://github.com/dedicatedcode). It provides the geocoding infrastructure that powers location-based features in Reitti.
488+
PAIKKA is developed as part of the Reitti ecosystem by (https://github.com/dedicatedcode). It provides the geocoding infrastructure that powers location-based features in Reitti.

0 commit comments

Comments
 (0)