Skip to content

rso-project-2021/user-service

Repository files navigation

user-service

Build Deploy
Microservice used for working with user data.

Environment file

In root of your local repository add config.json file.

{
    "consul_address": "localhost:8500",
    "logit_address": "5571bfef-c40a-4d84-a5dc-6b5dd6453ac0-ls.logit.io:24240",
    "db_driver": "postgres",
    "db_source": "postgres://root:secret@localhost:5432/electric_station?sslmode=disable",
    "server_address": "0.0.0.0:8080",
    "gin_mode": "debug"
}

Setup database

  1. Run docker pull postgres:alpine to download postgres image.
  2. Run make postgres to run postgres image inside of container.
  3. Run make createdb to create postgres database.
  4. Run make migrateup to add "users" table.
  5. Run go mod tidy to clean golang package dependecies.
  6. Test project with command make test.
  7. Run service with go run ..
  8. Use PostMan to send query to http://localhost:8080/v1/users/.

Seed database

Populate database with some users. You can run this query in TablePlus.

INSERT INTO users("username", "password", "email")
VALUES 	('Mario', 'passgancipass', 'ganci@gmail.com'),
	('Johnny', 'john123', 'johnny@gmail.com'),
	('Donald Trump', 'trumpyboy', 'trump@hotmail.com'),
	('Obama', 'barackog44', 'obama@gmail.com');

Things to implement

  • CRUD operations
  • Database migrations
  • CRUD unit tests
  • Makefile
  • Health checks
  • Docker file
  • CI github actions
  • Dockerhub
  • AWS account
  • Kubernetes cluster in AWS
  • Metrics (Prometheus in Go)
  • CD github actions
  • Config server (dynamic configuration)
  • API unit tests

About

Microservice used for working with user data.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published