项目作者: adaptant-labs

项目描述 :
A simple VIN decoding microservice wrapped around the vin_decoder package written in Dart.
高级语言: Dart
项目地址: git://github.com/adaptant-labs/vin-decoder-service.git
创建时间: 2019-06-25T17:43:21Z
项目社区:https://github.com/adaptant-labs/vin-decoder-service

开源协议:Apache License 2.0

下载


vin-decoder-service

Build Status

A simple VIN decoding microservice wrapped around the vin_decoder package written in Dart.

Installation

The application can be activated from pub directly:

  1. $ pub global activate --source path <path to repository>
  2. Package vin_decoder_service is currently active at path "...".
  3. Installed executable vindecoder-service.
  4. Activated vin_decoder_service 0.0.4 at path "...".

Usage

The vindecoder-service can run standalone, or can register itself with a Consul Agent to ease with service discovery.
By default, an attempt to register with Consul will be made.

To run standalone on the server side and inhibit Consul registration, the --no-use-consul flag may be specified:

  1. $ vindecoder-service --no-use-consul
  2. VIN Decoder Service Registered on 0.0.0.0:8080/vin
  3. ...

otherwise, the default behaviour applies, and service registration will be attempted with the defined (or default)
agent:

  1. $ vindecoder-service
  2. Registering VIN Decoder Service with Consul Agent @ localhost:8500
  3. VIN Decoder Service Registered on 0.0.0.0:8080/vin
  4. ...

An overview of supported commands and flags is provided below:

  1. $ vindecoder-service --help
  2. usage: vindecoder-service [-pcu]
  3. -p, --port Port to bind to
  4. (defaults to "8080")
  5. -c, --consul-agent Consul Agent to register service with
  6. (defaults to "localhost:8500")
  7. -u, --[no-]use-consul Use Consul for service registration
  8. (defaults to on)
  9. -h, --help Show usage info

From the client side, decoding may be tested by sending a JSON-encoded VIN string:

  1. $ curl -X POST -H "Content-Type: application/json" -d '{ "vin": "WP0ZZZ99ZTS392124" }' http://localhost:8080/vin

with the decoded VIN returned in the POST response body:

  1. {"wmi":"WP0","vds":"ZZZ99Z","vis":"TS392124","year":"1996","region":"EU","manufacturer":"Porsche","assembly_plant":"S","serial_number":"92124","make":"Porsche","model":"911","vehicle_type":"Passenger Car"}

Health Checking

A /health endpoint is provided and registered with Consul by default - in practice, this simply checks continued
connectivity to the Consul Agent from the service side. In the cases where Consul isn’t used, it simply denotes the
continued accessibility of the service itself.

Prometheus Metrics

Prometheus metrics are also provided and can be scraped from the /metrics endpoint as expected.

Deployment

Docker images are provided under adaptant/vin-decoder-service and can be run without any special
configuration:

  1. $ docker run -d -p 8080:8080 adaptant/vin-decoder-service

Features and bugs

Please file feature requests and bugs at the issue tracker.

License

Licensed under the terms of the Apache 2.0 license, the full version of which can be found in the
LICENSE
file included in the distribution.