complete overhaul
Some checks failed
build-and-push / docker (push) Failing after 10m36s

This commit is contained in:
2025-09-18 00:23:21 +02:00
parent 6afcfaa5b3
commit a2743dd7fb
11 changed files with 1201 additions and 271 deletions

112
README.md
View File

@@ -1,12 +1,30 @@
# FreeMoto Web
A web-based motorcycle route planner built with Go, Leaflet, Bootstrap, and Valhalla routing, ready for containerized deployment.
A modern, mobilefirst motorcycle route planner. Backend in Go (proxy + static), frontend with Bootstrap + Leaflet, and Valhalla as the routing engine. Containerready with dockercompose and CI for multiarch images.
## Features
- Interactive map with OpenStreetMap tiles
- Route planning with options (avoid highways, tolls, ferries, unpaved, shortest route)
- Docker-ready and configurable via `.env`
- Modern, mobilefriendly UI (single tap on mobile, doubleclick on desktop)
- Multiwaypoint routing with draggable markers and reorder/remove list
- Round Trip planner
- Distance target (km) and option to avoid repeated segments
- Respects all routing options
- Rider controls
- Twistiness slider (prefer curvy roads)
- Highways preference slider (prefer faster highways)
- Avoid: freeways, tolls, ferries, unpaved; Shortest route toggle
- Directions
- Directions bottom sheet (collapsible, drag-to-resize)
- Nextmaneuver banner; optional voice prompt
- Export GPX
- Track (`<trk>/<trkseg>/<trkpt>`) and/or Route (`<rte>/<rtept>`)
- OSMAndfriendly
- Theming and UX
- Draculastyle dark mode toggle with persistence
- Summary pill (distance/time), floating actions, clean layout
- Performance
- Gzip compression and strong caching for static assets
- Small Alpine runtime image
## Getting Started
@@ -42,6 +60,32 @@ go run main.go
Visit [http://localhost:8080](http://localhost:8080) in your browser.
### Quick Start (docker-compose)
Build and run the web app alongside a Valhalla routing container with a single command. A `docker-compose.yml` is provided at the repository root.
1. Copy the example environment file and adjust values if needed:
```bash
cp .env.example .env
```
2. Start the stack:
```bash
docker compose up -d --build
```
3. Open the app:
```
http://localhost:8080
```
Notes:
- The web app will proxy `/route` to the `valhalla` service at `http://valhalla:8002/route`.
- You may mount `custom_files/` into the Valhalla container (see `docker-compose.yml`) for tiles and custom configurations.
### Docker
Build and run the container:
@@ -79,6 +123,8 @@ services:
- tile_urls=https://download.geofabrik.de/europe/germany-latest.osm.pbf
```
Alternatively, use the provided root-level `docker-compose.yml` for a local build of the web app and a Valhalla companion service, then run `docker compose up -d --build`.
### 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/)`.
@@ -90,12 +136,60 @@ services:
- 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
## UI Overview
- **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`
- Start/End fields with autocomplete and reverse geocoding
- Tap/doubleclick to add waypoints; drag markers to adjust
- Waypoint list for reorder/remove
- Route Options include twistiness, highways, and avoid toggles
- Directions sheet (collapsible, draggable) + Nextmaneuver banner and optional voice
- Export GPX: Track/Route/Both
## Performance
- Static assets are served with gzip (when supported) and strong caching
- `Cache-Control: public, max-age=31536000, immutable` for `/static`
- Short caching for `index.html`
## Multiarch build and Registry
Build and push multiarch (amd64 + arm64) with Buildx:
```bash
# Login first (example)
docker login git.ztsw.de -u <user>
export IMAGE=git.ztsw.de/pedan/freemoto/freemoto-web
export TAG=latest
export TAG2=$(date +%Y%m%d-%H%M)
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t $IMAGE:$TAG \
-t $IMAGE:$TAG2 \
--push \
.
```
## CI: Gitea Actions
A workflow at `.gitea/workflows/build-and-push.yml` builds and pushes multiarch images on pushes and tags.
Configure repository secrets:
- `CR_USERNAME` registry username
- `CR_PASSWORD` registry token/password
Adjust `env.IMAGE`/`env.REGISTRY` in the workflow if you move the image.
## Customization & Development
- Frontend
- `app/web/static/index.html` layout and controls
- `app/web/static/main.js` map init, theme, global controls
- `app/web/static/route.js` routing, waypoints, round trips, GPX
- Backend
- `app/web/main.go` static serving (gzip + caching), proxies `/route`, `/geocode`, `/reverse`
## License