Backend services for caching and displaying geospatial data
These instructions will get you a copy of the project up and running on your system. This is intended to run on an ubuntu machine but can be run anywhere you have docker installed.
- make
- unzip (to unzip terraform)
- docker
Make is most likely already installed on your system. To install docker follow the instructions here or use the install script:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
There are a couple of steps to run the services.
-
Clone the repository to your machine.
git clone https://github.com/chronark/charon.git cd charon
-
Build all necessary docker images if you don't have them alrady.
make build
-
Get and initialize Terraform, a infrastructure management and provisioning tool.
make init
-
Create a terraform plan
make plan
-
Apply the plan
make apply
Visit http://localhost
to see the map.
Discovery name: charon.srv.filecache
Filecache is a basic cache that writes or reads bytes to and from the disk.
The cache is mounted on the host as ./volumes/filecache
and can be backed up or modified by removing or adding files on the host machine.
The HTTP API gateway to interact with all microservices. Exposes various routes to fetch data. Listens on port 52000 Routes:
/geocoding/forward?query=XYZ
calls the geocoding service./geocoding/reverse?lat=1.0&lon=1.0
calls the geocoding service./tile?x=0&y=0&z=0
calls the tiles service.
Discovery name: charon.srv.geocoding.nominatim
or charon.srv.geocoding.mapbox
Geocoding has two handlers: Nominatim and Mapbox
They both receive a forward or reverse geocoding search and search the cache. In case of a miss they will query their respective 3rd party APIs, write to cache and return the result.
The cache is mounted on the host as ./volumes/geocoding
and can be backed up or modified by removing or adding files on the host machine.
Discovery name: charon.srv.tiles.osm
or charon.srv.geocoding.mapbox
Tiles has two handlers: osm and Mapbox They both receive a tile request and search the cache. In case of a miss they will query their respective 3rd party APIs, write to cache and return the result.
- go
- docker
- gRPC - Internal communication
- terraform - Infrastructure management
- go-micro - Microservice framework
To get up and running as fast as possible you can use Vagrant to start and provision a local ubuntu:18.04 machine
vagrant up
Charon makes use of protobuf for the internal communication. In order to compile the protobuf definition you need to install:
go get google.golang.org/grpc
go get github.com/golang/protobuf/protoc-gen-go
go get github.com/micro/protoc-gen-micro
Then run make proto
to compile all protobuf definitions at once.