Skip to content

beezy-dev/traveler-crud-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

traveler-processed-service

The traveler-processed-service is an API server to record processed travelers for a period of 48-hour window to speed up next hop processing. Once the 48-hour window is over, the record will be offloaded to a separate data backend for archive and compliance purposes.

requirements

The requirements are the followings:

  • a CRUD API service providing a JSON formatted output when queried
  • a decoupled backend database service to connect to
  • backend databases to support at v1
    • MariaDB
    • Postgres
    • sqlite
  • the service should be recovering for a partioning from its backend database
  • the data structure should include the followings:
    • an UUID
    • first name
    • last name
    • multi hop travel
    • was previously processed
    • when previously processed
    • should be reprocessed
  • after the 48-hour window the record should be offloaded to a historical database
  • concurrent writing to database and in-memory caching using sqlite to leverage gorm

service sequence

  1. starting service
  2. validating backend support
  3. validating backend connectivity
  4. validating if database exists
  5. if not create it
  6. reconnecting with backend targeting the database
  7. migrating schema in database (including potential update)

contributing

Clone the repository:

git clone https://github.com/beezy-dev/traveler-crud-service.git 

Get either postgres or mariadb running with Podman (or docker):

for postgres

podman run --detach --name postgres -e POSTGRES_USER=user -e POSTGRES_PASSWORD=password -p 5432:5432

for mariadb

podman run --detach --name mariadb -e MYSQL_ROOT_PASSWORD=user -e MYSQL_USER=password -p 3306:3306 -p 8082:8080 mariadb

NOTE: as-is, the data is not persistent! Use a volume to achieve data persistency like:

podman run --detach --name postgres -e POSTGRES_USER=user -e POSTGRES_PASSWORD=password -p 5432:5432 -v postgres:/var/lib/data postgres

Run CompileDaemon to catch any code changes to trigger a rebuild and start of your binary:

~/go/bin/CompileDaemon -build="go build -o traveler-processed-service.out" -command="./traveler-processed-service.out" -color -graceful-kill -graceful-timeout 5

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages