102 lines
2.9 KiB
Markdown
102 lines
2.9 KiB
Markdown
# FreeMoto Web
|
|
|
|
A web-based motorcycle route planner built with Go, Leaflet, Bootstrap, and Valhalla routing, ready for containerized deployment.
|
|
|
|
## Features
|
|
|
|
- Interactive map with OpenStreetMap tiles
|
|
- Route planning with options (avoid highways, tolls, ferries, unpaved, shortest route)
|
|
- Docker-ready and configurable via `.env`
|
|
|
|
## Getting Started
|
|
|
|
### Prerequisites
|
|
|
|
- [Go](https://golang.org/) (1.22+ recommended)
|
|
- [Docker](https://www.docker.com/) (for container builds)
|
|
- [Valhalla](https://github.com/valhalla/valhalla) routing backend
|
|
- [Gitea](https://gitea.io/) (optional, for CI/CD and registry)
|
|
|
|
### Configuration
|
|
|
|
Create a `.env` file in the project root:
|
|
|
|
```
|
|
VALHALLA_URL=http://valhalla:8002/route
|
|
PORT=8080
|
|
# Optional: Nominatim base URL (defaults to https://nominatim.openstreetmap.org)
|
|
NOMINATIM_URL=https://nominatim.openstreetmap.org
|
|
# Recommended: configure a descriptive User-Agent per Nominatim usage policy
|
|
# Example format: "AppName/Version (+contact-url-or-email)"
|
|
NOMINATIM_USER_AGENT=FreeMoto/1.0 (+https://fm.ztsw.de/)
|
|
# Optional: log level (debug, info, warn, error). Default: info
|
|
LOG_LEVEL=info
|
|
```
|
|
|
|
### Local Development
|
|
|
|
```bash
|
|
cd app/web
|
|
go run main.go
|
|
```
|
|
|
|
Visit [http://localhost:8080](http://localhost:8080) in your browser.
|
|
|
|
### Docker
|
|
|
|
Build and run the container:
|
|
|
|
```bash
|
|
docker build -t freemoto-web .
|
|
docker run --env-file .env -p 8080:8080 freemoto-web
|
|
```
|
|
|
|
### Docker Compose
|
|
|
|
Example `docker-compose.yml`:
|
|
|
|
```yaml
|
|
services:
|
|
freemoto-web:
|
|
image: git.ztsw.de/pedan/freemoto/freemoto-web:latest
|
|
ports:
|
|
- "8080:8080"
|
|
env_file:
|
|
- .env
|
|
#environment:
|
|
# - VALHALLA_URL=http://10.200.0.15:8002/route
|
|
# - PORT=8080
|
|
# - NOMINATIM_URL=https://nominatim.openstreetmap.org
|
|
# - NOMINATIM_USER_AGENT=FreeMoto/1.0 (+https://fm.ztsw.de/)
|
|
# - LOG_LEVEL=debug
|
|
valhalla-scripted:
|
|
image: ghcr.io/valhalla/valhalla-scripted:latest
|
|
ports:
|
|
- 8002:8002
|
|
volumes:
|
|
- $PWD/custom_files:/custom_files
|
|
environment:
|
|
- tile_urls=https://download.geofabrik.de/europe/germany-latest.osm.pbf
|
|
```
|
|
|
|
### Notes on Nominatim
|
|
|
|
- Please follow the official usage policy for Nominatim. Provide a meaningful `NOMINATIM_USER_AGENT` that includes a contact URL or email. The default is `FreeMoto/1.0 (+https://fm.ztsw.de/)`.
|
|
- You can point `NOMINATIM_URL` to your own Nominatim instance or keep the default public endpoint.
|
|
|
|
### Logging
|
|
|
|
- Configure verbosity with `LOG_LEVEL`.
|
|
- Supported values: `debug`, `info` (default), `warn`, `error`.
|
|
- Incoming requests are logged at `info` level. Upstream success traces (Valhalla/Nominatim) are at `debug`. Errors are at `error`.
|
|
|
|
## Customization
|
|
|
|
- **Map UI:** Edit `static/index.html` and `static/main.js`
|
|
- **Routing logic:** Edit `static/route.js`
|
|
- **Geolocation/autocomplete:** Edit `static/geolocate.js`
|
|
- **Backend proxy:** Edit `main.go`
|
|
|
|
## License
|
|
|
|
MIT |