Skip to content

Latest commit

 

History

History
101 lines (71 loc) · 1.52 KB

README.md

File metadata and controls

101 lines (71 loc) · 1.52 KB

Log Service

A simple log service that allows to store and retrieve log events such as client ip, server ip, tags (key-value pairs) and message.

Getting Started

Prerequisite

Installing

Using Docker

  • Start docker-compose
$ docker-compose build
$ docker-compose up -d
  • Run DB migration
$ cd ./migrations
$ go run *.go [--dbaddr ...] [--dbuser ...] [--dbpasswd ...]
// Default values:
//   - dbaddr: 127.0.0.1:5432
//   - dbuser: postgres
//   - dbpasswd: mypostgrespw
  • Run the client
$ make client
  • Checkout the output.

  • Cleanup

$ docker-compose down

Development

  • Install packages
$ go get -u github.com/golang/protobuf/{proto,protoc-gen-go}
  • Start PostgresDB service (using docker)
$ docker run --name postgres-for-logsvc -p 5432:5432 -e POSTGRES_PASSWORD=mypostgrespw -d postgres
  • Run DB migration
$ cd ./migrations
$ go run *.go [--dbaddr ...] [--dbuser ...] [--dbpasswd ...]
// Default values:
//   - dbaddr: 127.0.0.1:5432
//   - dbuser: postgres
//   - dbpasswd: mypostgrespw
  • Start the server
$ go run cmd/server/main.go
  • Start the client (in new terminal)
$ go run cmd/client/main.go [--addr ...]
// Default value:
//   - addr: 127.0.0.1:8080
  • Checkout the output
  • Cleanup
$ docker rm -f postgres-for-logsvc

Testing

$ make test
// make test-unit
// make test-integration
// make bench