Location search and geocoding API. To be used in concert with OGC APIs.
This application offers location search and geocoding.
docker build -t pdok/gomagpie .
NAME:
Gomagpie - Location search and geocoding API
USAGE:
Gomagpie [global options] command [command options]
COMMANDS:
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--host value bind host (default: "0.0.0.0") [$HOST]
--port value bind port (default: 8080) [$PORT]
--debug-port value bind port for debug server (disabled by default), do not expose this port publicly (default: -1) [$DEBUG_PORT]
--shutdown-delay value delay (in seconds) before initiating graceful shutdown (e.g. useful in k8s to allow ingress controller to update their endpoints list) (default: 0) [$SHUTDOWN_DELAY]
--config-file value reference to YAML configuration file [$CONFIG_FILE]
--enable-trailing-slash allow API calls to URLs with a trailing slash. (default: false) [$ALLOW_TRAILING_SLASH]
--enable-cors enable Cross-Origin Resource Sharing (CORS) as required by OGC API specs. Disable if you handle CORS elsewhere. (default: false) [$ENABLE_CORS]
--help, -h show help
Example (config-file is mandatory):
docker run -v `pwd`/examples:/examples -p 8080:8080 -it pdok/gomagpie --config-file /examples/config.yaml
Now open http://localhost:8080. See examples for more details.
Health endpoint is available on /health
.
Besides the main server, Gomagpie can also start a debug server. This server
binds to localhost and a different port which you must specify using the
--debug-port
flag. You shouldn't expose this port publicly but only access it
through a tunnel/port-forward. The debug server exposes /debug
for use by
pprof. For example with --debug-port 9001
:
- Create a tunnel to the debug server e.g. in k8s:
kubectl port-forward gomagpie-75f59d57f4-4nd6q 9001:9001
- Create CPU profile:
go tool pprof http://localhost:9001/debug/pprof/profile?seconds=20
- Start pprof visualization
go tool pprof -http=":8000" pprofbin <path to pb.gz file>
- Open http://localhost:8000 to explore CPU flamegraphs and such.
A similar flow can be used to profile memory issues.
go build -o gomagpie cmd/main.go
./gomagpie
To troubleshoot, review the Dockerfile since compilation also happens there.
Install golangci-lint and run golangci-lint run
from the root.
- Install the Go Template plugin
- Open
Preferences
>Editor
>File Types
selectGo Template files
and add the following file patterns:"*.go.html"
"*.go.json"
"*.go.tilejson"
"*.go.xml"
- Now add template language support by running the setup-jetbrains-gotemplates.sh script.
- Reopen the project (or restart IDE). Now you'll have full IDE support in the gomagpie templates.
Also:
- Set import order in
Preferences
>Editor
>Code Style
>Go
>Imports
togoimports
to align with VSCode and goimports usage in golangci-lint.
- Install the Go Template extension
- Open Extension Settings and add the following file patterns:
"*.go.html"
"*.go.json"
"*.go.tilejson"
"*.go.xml"
- Also add
html
,json
andxml
to the list of Go template languages. - Now you'll have IDE support in the gomagpie templates.
Gomagpie started as a fork of GoKoala.
Make a pull request...
Contacting the maintainers can be done through the issue tracker.