89 lines
No EOL
2.3 KiB
Markdown
89 lines
No EOL
2.3 KiB
Markdown
# Photon geocoder and reverse
|
|
|
|
[oring git](https://github.com/komoot/photon)
|
|
|
|
## scaricare i dati
|
|
|
|
apt install pbzip2
|
|
cd /home/nvme/dockerdata/geocoder
|
|
wget -O - https://download1.graphhopper.com/public/photon-db-latest.tar.bz2 | pbzip2 -cd | tar x
|
|
|
|
## Installare
|
|
|
|
./build.sh
|
|
|
|
## Start
|
|
|
|
./start.sh
|
|
|
|
oppure
|
|
|
|
services:
|
|
photon:
|
|
container_name: photon
|
|
ports:
|
|
- 2322:2322
|
|
volumes:
|
|
- /home/nvme/dockerdata/geocoder:/data
|
|
image: photon
|
|
|
|
## Installazione da immagine remota
|
|
|
|
si può utilizzare il docker-compose
|
|
il sito è (https://github.com/rtuszik/photon-docker)
|
|
attenzione che scarica più di 200GB e ci mette molto a unzippare tutto
|
|
|
|
```bash
|
|
services:
|
|
photon:
|
|
image: rtuszik/photon-docker:latest
|
|
container_name: photon1
|
|
environment:
|
|
- UPDATE_STRATEGY=PARALLEL
|
|
- UPDATE_INTERVAL=720h # Check for updates every 30 days
|
|
# - REGION=andorra # Optional: specific region (continent, country, or planet)
|
|
# - APPRISE_URLS=pover://user@token # Optional: notifications
|
|
volumes:
|
|
- /home/nvme/dockerdata/geocoder1:/photon/data
|
|
restart: unless-stopped
|
|
ports:
|
|
- "2322:2322"
|
|
```
|
|
## Utilizzo con Nginx per un corretto funzionamento
|
|
|
|
inserire nel file di configurazione
|
|
|
|
```bash
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
server_name photon.patachina.it;
|
|
|
|
ssl_certificate ssl/live/patachina.it/fullchain.pem;
|
|
ssl_certificate_key ssl/live/patachina.it/privkey.pem;
|
|
|
|
|
|
location / {
|
|
proxy_pass http://192.168.1.4:2322;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
# CORS headers
|
|
add_header 'Access-Control-Allow-Origin' '*' always;
|
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
|
|
add_header 'Access-Control-Allow-Headers' 'Content-Type' always;
|
|
|
|
if ($request_method = OPTIONS) {
|
|
add_header 'Access-Control-Max-Age' 1728000;
|
|
add_header 'Content-Type' 'text/plain charset=UTF-8';
|
|
add_header 'Content-Length' 0;
|
|
return 204;
|
|
}
|
|
}
|
|
}
|
|
``` |