game-library-auth
Introduction
game-library-auth is an authentication service for the game-library web application. It is responsible for user authentication and authorization.
This service is part of a game-library web application:
- game-library - main service for fetching, storing, and providing games data
- current service handles authentication and authorization
- game-library-ui - UI representation service
Table of Contents
Installation
Prerequisites: go
, Docker
, Make
. To set up the service, follow these steps:
-
Clone the repository:
git clone https://github.com/OutOfStack/game-library-auth.git
cd game-library-auth
-
Set up the database:
make drunpg # runs postgres server with 'auth' db in docker container
make migrate # applies all migrations to database
-
Generate key pair for local JWT signing:
make keygen # creates private/public key pair files
-
Create the app.env
file based on app.example.env and update it with your local configuration settings.
-
Get Google API Client ID for Google OAuth and set it in app.env:
https://developers.google.com/identity/gsi/web/guides/get-google-api-clientid
-
Build and run the service:
make build
make run
Refer to the List of Make Commands for a complete list of commands.
Usage
After installation, you can use the following Make commands to develop the service:
make test
: Runs tests for the whole project.
make generate
: Generates documentation for Swagger UI.
make lint
: Runs golangci-lint for code analysis.
Refer to the List of Make Commands for a complete list of commands.
Tech Stack
- Data storage with PostgreSQL.
- Tracing with Zipkin.
- Log management with Graylog.
- Code analysis with golangci-lint.
- CI/CD with GitHub Actions and deploy to Kubernetes (microk8s) cluster.
Configuration
Documentation
API documentation is available via Swagger UI. To generate the documentation, run:
make generate
List of Make Commands
Main Commands
build builds app
build-mng builds manage app
run runs app
test runs tests for the whole project
generate generates docs for Swagger UI
lint runs golangci-lint
cover outputs tests coverage
Database Commands
drunpg runs postgres server with 'auth' db in docker container
migrate applies all migrations to database (reads from config file)
rollback roll backs one last migration of database (reads from config file)
Key Management
keygen creates private/public key pair files
Docker Commands
dbuildauth builds auth app docker image
dbuildmng builds manage app docker image
drunauth runs auth app in docker container
License
MIT License