Skip to content

Latest commit

 

History

History
90 lines (59 loc) · 1.54 KB

README.md

File metadata and controls

90 lines (59 loc) · 1.54 KB

Example of Bootstrapping OPA Enabled Service

Prerequisites

  • Golang 1.20+
  • GNU Makefile
  • Docker for Mac
  • $GOBIN & $GOROOT are correctly set
  • GO111MODULE is "on"
  • OPA Commandline

Install OPA CLI

Option 1: Homebrew

brew install opa

Option 2: Manual Install

See Download OPA

Step-by-Step Bootstrapping

1. Bootstrap the service via lanai-cli codegen

See Instructions in skeleton-service

2. Write Policies

After code generation, OPA policy stubs are generated in ./policies folder.

Follow the instruction documented in generated ./policies/README.md to compose and upload polices into Policy Service.

3. Run Service

The generated service requires a OPA policy bundle server and Auth Service to run at localhost

Appendix 1: Useful Admin Endpoints

GET /context-path/admin/info

Show application information.

GET /context-path/admin/health

Show health status.

GET /context-path/admin/env

Show all properties applied to the running service and their sources.

GET/POST /context-path/admin/loggers

Show and Modify log levels

Appendix 1: Common CLI Commands

Build

make build

Test

make test

Code Lint

make lint

Force Makefile/Dockerfile

make init FORCE=true

Init with different lanai-cli Version

make init CLI_TAG="<github-branch>"

e.g.

make init CLI_TAG="develop"