Skip to content
/ pgen Public

[GO] PGen is a microservice that generates random and unrepeatable protocols with easy readability.

License

Notifications You must be signed in to change notification settings

gbzarelli/pgen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Issues Forks Stars Release Version Codacy Badge

PGen (building... learning GO Lang...)

Unrepeatable Protocol generator API in GO.

The PGen is a microservice created to generate service protocols for any type of services. These protocols are readable so that people can easily record

The protocol number consists of 16 digits (by default), the first 8 (fixed) being the current date and the last (configurable) random:

Format: 'YYYYMMDD????????' sample: 2021120912345678

Technologies

Instructions to Run

Prepare

  • Clone de project:
    • git@github.com:gbzarelli/pgen.git
  • Go to pgen directory:
    • $cd pgen/
  • Build project
    • Prepare dependencies
      • $make dependencies
    • Build project
      • $make build

Run with Docker

  • Generate Dockerfile
    • $make build-docker
  • Run full stack:
    • $make run-docker-compose

Run in project

  • Run the dependencies (infra / redis):
    • $make run-docker-stack
  • Run project
    • $go run main.go

Envs

Custom the decimal places value to generate a new protocol (default 8):

  • PROTOCOL_DECIMAL_PLACES_AFTER_DATE
    • Default in Project and Dockerfile: 8

Custom Redis address:

  • REDIS_ADDRESS
    • Default in Project: localhost:6379
    • Default in Dockerfile: redis:6379

API

The project starts in localhost:5000 with a unique endpoint to generate a new protocol:

Endpoint: v1/protocol

Request:

curl --request POST --url http://localhost:5000/v1/protocol

Response:

201 {"protocol": "2021121204066844"}

Metrics by prometheus

View metrics by app

curl --request GET --url http://localhost:5000/metrics

Prometheus

If you run by docker just open prometheus in: http://localhost:9090/

About

[GO] PGen is a microservice that generates random and unrepeatable protocols with easy readability.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published