dev_forum-auth

module
v0.0.0-...-7974e50 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2024 License: MIT

README

Status

🚧 Under Development 🚧

This repository is a part of an ongoing project and is currently under active development. I'm continuously working on adding features, fixing bugs, and improving documentation. Although this is a one-man project, contributions are welcome. Please feel free to open issues or submit pull requests.

dev_forum-auth

GoDoc Go Report Card GitHub License

The authorization and authentication service that dev_forum relies on to provide user identities and authorization mechanisms.

It's dependent on:

Set up

Rename .env.example to .env and fill in missing values.

Locally

You need a working Go environment.

To build the executable simply download dependencies with and compile using the Go command.

go mod tidy
go mod vendor
go build cmd/main.go 
On Docker

You need a working Docker environment.

You can use the Dockerfile located in deployment/ to build and run the service on a docker container.

make build-image version=<version>
docker run -p 50051:50051 -p 2223:2223 krixlion/dev_forum-auth:<version>

You need a working Kubernetes environment with kustomize.

Kubernetes resources are defined in deployment/k8s and deployed using Kustomize. Currently there are stage, dev and test overlays available and include any needed resources and configs.

Use make to apply manifests for dev_forum-auth and needed DBs for either dev or stage environment. Every make rule that depends on k8s accepts an overlay param which indicates the namespace for the rule.

make k8s-run overlay=<dev/stage/...>
# To delete
make k8s-stop overlay=<dev/stage/...>

Testing

All tests are written as Go tests.

Run unit and integration tests using Go command.

# Include `-short` flag to skip integration tests.
go test ./... -race

Generate coverage report using go tool cover.

go test -coverprofile  cover.out ./...
go tool cover -html cover.out -o cover.html

If the service is deployed on kubernetes you can use make.

make k8s-integration-test overlay=<dev/stage/...>

or

make k8s-unit-test overlay=<dev/stage/...>

Documentation

For in-detail documentation refer to the Wiki.

API

Service is exposing a gRPC API.

Regenerate pb packages after making changes to any of the .proto files located in api/. You can use go-grpc-gen, a containerized tool for generating gRPC bindings, with make grpc-gen.

Directories

Path Synopsis
internal
pkg
tokens/manager
Opaque Tokens are generated from a random string with appended 8 digit crc32 hex checksum and encoded in base64 with a prefix depending on their type.
Opaque Tokens are generated from a random string with appended 8 digit crc32 hex checksum and encoded in base64 with a prefix depending on their type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL