### Start the UI dev server Source: https://github.com/alvarorg14/openlicensd/blob/main/QUICKSTART.md Starts the UI dev server for local development. Run this in another terminal. After starting, open http://localhost:3000 and sign in with Email: `admin@example.com` and Password: `admin`. ```bash make dev-ui ``` -------------------------------- ### Start the API server Source: https://github.com/alvarorg14/openlicensd/blob/main/QUICKSTART.md Starts the API server for local development. Run this in one terminal. ```bash make dev-server ``` -------------------------------- ### Install Go SDK with go get Source: https://github.com/alvarorg14/openlicensd/blob/main/CONTRIBUTING.md Use this command to install the Go SDK at a specific version, for example v1.0.0. The SDK is versioned independently from the server and uses tags like sdk/go/vX.Y.Z. ```bash go get github.com/alvarorg14/openlicensd/sdk/go@v1.0.0 ``` -------------------------------- ### Install OpenLicensd via Helm from OCI registry Source: https://github.com/alvarorg14/openlicensd/blob/main/QUICKSTART.md Installs the OpenLicensd Helm chart from the published OCI registry. Replace X.Y.Z with the latest release version. Requires Helm 3, kubectl, and PostgreSQL 16+. Sets admin email, database connection, and password hash. ```bash helm install openlicensd oci://ghcr.io/alvarorg14/charts/openlicensd \ --version X.Y.Z \ --namespace openlicensd \ --create-namespace \ --set config.bootstrapAdmin.email=admin@example.com \ --set config.database.host=postgres.example.com \ --set config.database.port=5432 \ --set config.database.name=openlicensd \ --set config.database.user=openlicensd \ --set config.database.sslmode=require \ --set secret.data.databasePassword='change-me' \ --set secret.data.bootstrapAdminPasswordHash="$(make hash-password PASSWORD=yourpassword)" ``` -------------------------------- ### Start local PostgreSQL database Source: https://github.com/alvarorg14/openlicensd/blob/main/QUICKSTART.md Starts the local PostgreSQL database for development. If upgrading from a version without products/policies, reset the local database with `make dev-db-reset`. ```bash make dev-db ``` -------------------------------- ### Run OpenLicensd with environment variables Source: https://github.com/alvarorg14/openlicensd/blob/main/QUICKSTART.md Sets required database and bootstrap environment variables, then starts the server with `./bin/openlicensd`. The admin password hash is generated via `make hash-password`. After starting, open http://localhost:8080. ```bash export OPENLICENSD_DATABASE_HOST=localhost export OPENLICENSD_DATABASE_PORT=5432 export OPENLICENSD_DATABASE_USER=user export OPENLICENSD_DATABASE_PASSWORD=pass export OPENLICENSD_DATABASE_NAME=openlicensd export OPENLICENSD_DATABASE_SSLMODE=disable export OPENLICENSD_BOOTSTRAP_ADMIN_EMAIL=admin@example.com export OPENLICENSD_BOOTSTRAP_ADMIN_PASSWORD_HASH=$(make hash-password PASSWORD=your-secure-password) export OPENLICENSD_COOKIE_SECURE=false ./bin/openlicensd ``` -------------------------------- ### Install OpenLicensd via Helm from chart source Source: https://github.com/alvarorg14/openlicensd/blob/main/QUICKSTART.md Installs the OpenLicensd Helm chart from local source. Set image.tag to the desired release version because the git Chart.yaml uses a 0.0.0-dev placeholder. Requires Helm 3 and a Kubernetes cluster. ```bash helm install openlicensd ./charts/openlicensd \ --namespace openlicensd \ --create-namespace \ --set image.tag=X.Y.Z \ -f my-values.yaml ``` -------------------------------- ### Create a license Source: https://github.com/alvarorg14/openlicensd/blob/main/QUICKSTART.md Creates a license for the product and policy created earlier. The response contains a `key` that is shown only once, so save it immediately. ```bash curl -s -b cookies.txt -X POST http://localhost:8080/api/v1/licenses \ -H "Content-Type: application/json" \ -H "X-CSRF-Token: $CSRF" \ -d "{\"label\":\"Test License\",\"product_id\":\"$PRODUCT_ID\",\"policy_id\":\"$POLICY_ID\"}" | jq ``` -------------------------------- ### Local development setup Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/configuration.md Copy the environment template, edit .env (set OPENLICENSD_COOKIE_SECURE=false for HTTP dev), reset the dev database after schema changes, and start the dev server. Uses a local PostgreSQL instance started by make dev-db. ```bash cp .env.example .env # Edit .env — set OPENLICENSD_COOKIE_SECURE=false for HTTP dev make dev-db-reset # required after schema changes make dev-server ``` -------------------------------- ### Run binary with environment variables Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/quickstart.md Sets required database and bootstrap environment variables, generates the admin password hash, and starts the server. `OPENLICENSD_COOKIE_SECURE=false` is set for local HTTP; the server listens on http://localhost:8080. ```bash export OPENLICENSD_DATABASE_HOST=localhost export OPENLICENSD_DATABASE_PORT=5432 export OPENLICENSD_DATABASE_USER=user export OPENLICENSD_DATABASE_PASSWORD=pass export OPENLICENSD_DATABASE_NAME=openlicensd export OPENLICENSD_DATABASE_SSLMODE=disable export OPENLICENSD_BOOTSTRAP_ADMIN_EMAIL=admin@example.com export OPENLICENSD_BOOTSTRAP_ADMIN_PASSWORD_HASH=$(make hash-password PASSWORD=your-secure-password) export OPENLICENSD_COOKIE_SECURE=false ./bin/openlicensd ``` -------------------------------- ### Create a product and policy Source: https://github.com/alvarorg14/openlicensd/blob/main/QUICKSTART.md Creates a product and a policy using the CSRF token, storing their IDs in shell variables for later use. Requires the login step to have been completed. ```bash PRODUCT_ID=$(curl -s -b cookies.txt -X POST http://localhost:8080/api/v1/products \ -H "Content-Type: application/json" \ -H "X-CSRF-Token: $CSRF" \ -d '{"name":"Acme Widget","code":"acme-widget"}' | jq -r .id) POLICY_ID=$(curl -s -b cookies.txt -X POST http://localhost:8080/api/v1/policies \ -H "Content-Type: application/json" \ -H "X-CSRF-Token: $CSRF" \ -d "{\"product_id\":\"$PRODUCT_ID\",\"name\":\"Perpetual\"}" | jq -r .id) ``` -------------------------------- ### Start stack with Docker Compose (make stack-up) Source: https://github.com/alvarorg14/openlicensd/blob/main/QUICKSTART.md Runs PostgreSQL and OpenLicensd together from the published image. By default pulls ghcr.io/alvarorg14/openlicensd:latest for quick evaluation; pin a release with OPENLICENSD_IMAGE_TAG=X.Y.Z make stack-up. ```bash make stack-up ``` -------------------------------- ### Install openlicensd Helm chart from source for local development Source: https://github.com/alvarorg14/openlicensd/blob/main/charts/openlicensd/README.md Installs the chart from the local source directory for development, setting image.tag to override the 0.0.0-dev placeholder in Chart.yaml and using the CI test values file. ```bash helm install openlicensd ./charts/openlicensd \ --namespace openlicensd \ --create-namespace \ --set image.tag=X.Y.Z \ -f charts/openlicensd/ci/test-values.yaml ``` -------------------------------- ### Install openlicensd Helm chart using an existing Secret Source: https://github.com/alvarorg14/openlicensd/blob/main/charts/openlicensd/README.md Installs the chart while referencing a pre-created Kubernetes Secret named openlicensd-credentials via secret.mode=existing and secret.existingSecret. ```bash helm install openlicensd oci://ghcr.io/alvarorg14/charts/openlicensd \ --namespace openlicensd \ --create-namespace \ --set secret.mode=existing \ --set secret.existingSecret=openlicensd-credentials ``` -------------------------------- ### Copy environment variables Source: https://github.com/alvarorg14/openlicensd/blob/main/QUICKSTART.md Copies the example environment file to `.env`. If you regenerate `OPENLICENSD_BOOTSTRAP_ADMIN_PASSWORD_HASH`, wrap the bcrypt value in single quotes in `.env` (e.g. `'$2a$10$...'`) so Docker Compose does not misinterpret `$` characters. ```bash cp .env.example .env ``` -------------------------------- ### Set up local development environment Source: https://github.com/alvarorg14/openlicensd/blob/main/README.md Prepares the local development environment: starts the database, copies the environment template, then runs the server and UI in separate terminals. Sign in at http://localhost:3000 with admin/admin. ```bash make dev-db cp .env.example .env make dev-server # terminal 1 make dev-ui # terminal 2 ``` -------------------------------- ### Reset local database Source: https://github.com/alvarorg14/openlicensd/blob/main/QUICKSTART.md Resets the local database when upgrading from a version without products/policies. ```bash make dev-db-reset ``` -------------------------------- ### Validate a license Source: https://github.com/alvarorg14/openlicensd/blob/main/QUICKSTART.md Validates a license key against a product. Replace YOUR-KEY-HERE with the key obtained from the license creation response. ```bash curl -s -X POST http://localhost:8080/api/v1/validate \ -H "Content-Type: application/json" \ -d '{"key":"YOUR-KEY-HERE","product":"acme-widget"}' | jq ``` -------------------------------- ### Install openlicensd Helm chart with inline configuration Source: https://github.com/alvarorg14/openlicensd/blob/main/charts/openlicensd/README.md Installs the openlicensd chart from the GHCR OCI registry, requiring an external PostgreSQL 16+ database. Sets bootstrap admin email, database connection parameters, and secret values including a bcrypt password hash. ```bash helm install openlicensd oci://ghcr.io/alvarorg14/charts/openlicensd \ --version X.Y.Z \ --namespace openlicensd \ --create-namespace \ --set config.bootstrapAdmin.email=admin@example.com \ --set config.database.host=postgres.example.com \ --set config.database.port=5432 \ --set config.database.name=openlicensd \ --set config.database.user=openlicensd \ --set config.database.sslmode=require \ --set secret.data.databasePassword='change-me' \ --set secret.data.bootstrapAdminPasswordHash='$2a$10$...' ``` -------------------------------- ### Verify Docker Compose stack health endpoints Source: https://github.com/alvarorg14/openlicensd/blob/main/QUICKSTART.md Checks the health and readiness of the stack via curl. Run after starting the stack with make stack-up. ```bash curl -s localhost:8080/healthz curl -s localhost:8080/readyz ``` -------------------------------- ### Start Postgres + openlicensd from GHCR Source: https://github.com/alvarorg14/openlicensd/blob/main/AGENTS.md Starts the full stack (Postgres and openlicensd) using the docker-compose.stack.yml file. ```bash make stack-up # Start Postgres + openlicensd from GHCR (docker-compose.stack.yml) ``` -------------------------------- ### Build binary with make build Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/quickstart.md Builds the binary from source. `make build` runs `make ui` first so the binary embeds the full admin UI; a plain `go build` embeds a placeholder page instead. ```bash make build ``` -------------------------------- ### Start PostgreSQL via Docker Compose Source: https://github.com/alvarorg14/openlicensd/blob/main/AGENTS.md Starts PostgreSQL using Docker Compose with the docker-compose.yml file. ```bash make dev-db # Start PostgreSQL via Docker Compose (docker-compose.yml) ``` -------------------------------- ### Make targets for development workflow Source: https://github.com/alvarorg14/openlicensd/blob/main/CONTRIBUTING.md Lists all available make targets for development, including starting PostgreSQL, running the API server, building the UI, running tests, linting, and generating an admin password hash. Requires Go 1.27+, Node.js 24+, and a local PostgreSQL instance. ```bash # List all targets make help # Start PostgreSQL make dev-db # Run API server (loads .env) make dev-server # Run Nuxt dev server make dev-ui # Build UI static files make ui # Build binary make build # Run Go tests make test # Run Playwright UI smoke tests (requires Postgres, built binary, and Chromium) make dev-db make build cd ui && npm run test:e2e:install make test-ui # Lint (go vet + golangci-lint + ESLint) make lint # Generate admin password hash make hash-password PASSWORD=yourpassword ``` -------------------------------- ### Start Docker Compose stack with pinned image tag Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/deployment.md Starts the stack with a specific release image by setting OPENLICENSD_IMAGE_TAG to a semver version without the 'v' prefix. Use this for production-like runs instead of the default :latest tag. ```bash OPENLICENSD_IMAGE_TAG=X.Y.Z make stack-up ``` -------------------------------- ### Install openlicensd Helm chart with External Secrets Operator Source: https://github.com/alvarorg14/openlicensd/blob/main/charts/openlicensd/README.md Installs the chart using External Secrets Operator by setting secret.mode=externalSecrets and providing a SecretStore reference and remote refs for the database password and bootstrap admin password hash. ```bash helm install openlicensd oci://ghcr.io/alvarorg14/charts/openlicensd \ --namespace openlicensd \ --create-namespace \ --set secret.mode=externalSecrets \ --set secret.externalSecrets.secretStoreRef.name=my-secret-store \ --set-json 'secret.externalSecrets.remoteRefs=[{"secretKey":"OPENLICENSD_DATABASE_PASSWORD","remoteRef":{"key":"openlicensd/database","property":"password"}},{"secretKey":"OPENLICENSD_BOOTSTRAP_ADMIN_PASSWORD_HASH","remoteRef":{"key":"openlicensd/admin","property":"passwordHash"}}]' ``` -------------------------------- ### GET /readyz Source: https://github.com/alvarorg14/openlicensd/blob/main/COMPATIBILITY.md Readiness probe that checks if the service is ready to accept traffic. Returns 503 when PostgreSQL is unavailable. ```APIDOC ## GET /readyz ### Description Readiness probe that checks if the service is ready to accept traffic. Returns 503 when PostgreSQL is unavailable. ### Method GET ### Endpoint /readyz ### Response #### Error Response (503) Service unavailable when PostgreSQL is not reachable. ``` -------------------------------- ### Pull and run OpenLicensd Docker image Source: https://github.com/alvarorg14/openlicensd/blob/main/QUICKSTART.md Pulls a pinned release image (replace X.Y.Z with a semver release without v prefix) and runs it with required database and bootstrap environment variables. The :latest tag is not recommended for production. ```bash docker pull ghcr.io/alvarorg14/openlicensd:X.Y.Z docker run -d \ --name openlicensd \ -p 8080:8080 \ -e OPENLICENSD_DATABASE_HOST=host \ -e OPENLICENSD_DATABASE_PORT=5432 \ -e OPENLICENSD_DATABASE_USER=user \ -e OPENLICENSD_DATABASE_PASSWORD=pass \ -e OPENLICENSD_DATABASE_NAME=openlicensd \ -e OPENLICENSD_DATABASE_SSLMODE=disable \ -e OPENLICENSD_BOOTSTRAP_ADMIN_EMAIL=admin@example.com \ -e OPENLICENSD_BOOTSTRAP_ADMIN_PASSWORD_HASH='$2a$10$...' \ -e OPENLICENSD_COOKIE_SECURE=true \ ghcr.io/alvarorg14/openlicensd:X.Y.Z ``` -------------------------------- ### Verify OpenLicensd Helm deployment Source: https://github.com/alvarorg14/openlicensd/blob/main/QUICKSTART.md Checks the OpenLicensd pods, forwards port 8080, and tests health and readiness endpoints. After running, open http://localhost:8080 and sign in with the configured admin credentials. ```bash kubectl get pods -n openlicensd -l app.kubernetes.io/name=openlicensd kubectl port-forward -n openlicensd svc/openlicensd 8080:8080 curl -s localhost:8080/healthz curl -s localhost:8080/readyz ``` -------------------------------- ### Uninstall OpenLicensd via Helm Source: https://github.com/alvarorg14/openlicensd/blob/main/QUICKSTART.md Removes the OpenLicensd Helm release from the openlicensd namespace. ```bash helm uninstall openlicensd -n openlicensd ``` -------------------------------- ### Quick start: validate a license with OpenLicensd Go SDK Source: https://github.com/alvarorg14/openlicensd/blob/main/sdk/go/README.md Creates a client with New(baseURL, product) and calls Validate with a license key. On failure, logs a fatal error; if the license is invalid, logs the rejection reason. On success, prints the expiration date. ```go package main import ( "context" "fmt" "log" openlicensd "github.com/alvarorg14/openlicensd/sdk/go" ) func main() { client, err := openlicensd.New("https://licenses.example.com", "acme-widget") if err != nil { log.Fatal(err) } result, err := client.Validate(context.Background(), "X4F9K-7QP2M-3RH8N-BW6TG-YZ2CD") if err != nil { log.Fatal(err) // transport or server error } if !result.Valid { log.Fatalf("license rejected: %s", result.Reason) } fmt.Println("licensed until", result.ExpiresAt) } ``` -------------------------------- ### GET /readyz Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/api.md Readiness probe that performs a PostgreSQL ping. This endpoint does not require authentication. ```APIDOC ## GET /readyz ### Description Readiness probe (PostgreSQL ping). ### Method GET ### Endpoint /readyz ### Authentication None ``` -------------------------------- ### Background guard with NewGuard Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/sdk/go.md Starts a background guard for continuous license enforcement with offline tolerance. NewGuard runs the first ValidateProduct synchronously; if it returns a non-nil error (e.g., server unreachable), construction fails and the background loop never starts. Offline grace applies only to later transport failures after a successful start. Stop() is safe to call more than once. ```go guard, err := openlicensd.NewGuard(ctx, client, key, openlicensd.WithInterval(time.Hour), openlicensd.WithOfflineGrace(24*time.Hour), ) defer guard.Stop() ``` -------------------------------- ### Stop Docker Compose stack (make stack-down) Source: https://github.com/alvarorg14/openlicensd/blob/main/QUICKSTART.md Stops the stack. Use make stack-down ARGS=-v to also remove the database volume. ```bash make stack-down ``` -------------------------------- ### Login and capture CSRF token Source: https://github.com/alvarorg14/openlicensd/blob/main/QUICKSTART.md Authenticates as admin and extracts the CSRF token from the cookie jar for subsequent API calls. Requires the server running at localhost:8080. ```bash curl -s -c cookies.txt -X POST http://localhost:8080/api/v1/auth/login \ -H "Content-Type: application/json" \ -d '{"email":"admin@example.com","password":"admin"}' CSRF=$(grep openlicensd_csrf cookies.txt | awk '{print $7}') ``` -------------------------------- ### GET /api/v1/products Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/architecture.md Lists products with pagination. ```APIDOC ## GET /api/v1/products ### Description Lists products with pagination. ### Method GET ### Endpoint /api/v1/products ### Authentication Session ``` -------------------------------- ### Background guard with NewGuard and options Source: https://github.com/alvarorg14/openlicensd/blob/main/sdk/go/README.md Creates a guard that revalidates on an interval and tolerates transient outages. NewGuard runs the first ValidateProduct synchronously; if it returns a non-nil error, construction fails and the background loop never starts. Offline grace applies only to later transport failures after a successful start. An invalid license (Valid: false with nil error) still constructs the guard. ```go guard, err := openlicensd.NewGuard(ctx, client, key, openlicensd.WithInterval(time.Hour), openlicensd.WithOfflineGrace(24*time.Hour), ) if err != nil { log.Fatal(err) } defer guard.Stop() if !guard.Valid() { log.Fatal("license invalid") } ``` -------------------------------- ### NewGuard Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/sdk/go.md Creates a background guard for continuous license enforcement with offline tolerance. Runs the first ValidateProduct synchronously; if it returns a non-nil error, construction fails and the background loop never starts. ```APIDOC ## NewGuard ### Description Creates a background guard for continuous license enforcement with offline tolerance. Runs the first ValidateProduct synchronously; if it returns a non-nil error, construction fails and the background loop never starts. ### Method NewGuard ### Endpoint openlicensd.NewGuard(ctx, client, key, options...) ### Parameters #### Arguments - **ctx** (context.Context) - Context for the guard. - **client** - The client used for validation. - **key** (string) - License key. - **options** (Option) - Optional configuration options. ### Options - **WithInterval(interval)** - Sets the revalidation interval. - **WithOfflineGrace(grace)** - Sets the offline grace period. - **WithProduct(product)** - Sets the product for revalidation. ### Response Returns a guard and an error. ### Request Example ```go guard, err := openlicensd.NewGuard(ctx, client, key, openlicensd.WithInterval(time.Hour), openlicensd.WithOfflineGrace(24*time.Hour), ) defer guard.Stop() ``` ``` -------------------------------- ### Go SDK: Validate a license with fingerprint Source: https://github.com/alvarorg14/openlicensd/blob/main/README.md Use the official Go client to validate a license key. It creates a device fingerprint from a client identifier, connects to the license server with the product ID, and calls Validate with the license key. The example omits error handling; ctx must be provided by the caller. ```go import openlicensd "github.com/alvarorg14/openlicensd/sdk/go" fp, _ := openlicensd.Fingerprint("my-cli") client, _ := openlicensd.New( "https://licenses.example.com", "acme-widget", openlicensd.WithFingerprint(fp), ) result, _ := client.Validate(ctx, licenseKey) ``` -------------------------------- ### Create a license Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/api.md Creates a license for a product and policy using the IDs from the previous example. The response includes the raw key field once; store it securely because it cannot be retrieved later. Optionally override expiration with expires_at and activation limit with max_activations (null = unlimited, subject to a 1000-machine ceiling). Both values are snapshotted at creation and not updated when the policy changes. ```bash curl -s -b cookies.txt -X POST http://localhost:8080/api/v1/licenses \ -H "Content-Type: application/json" \ -H "X-CSRF-Token: $CSRF" \ -d "{\"label\":\"Acme Corp\",\"product_id\":\"$PRODUCT_ID\",\"policy_id\":\"$POLICY_ID\"}" | jq ``` -------------------------------- ### Build UI and server Source: https://github.com/alvarorg14/openlicensd/blob/main/AGENTS.md Builds both the UI and the server. ```bash make build # ui + server ``` -------------------------------- ### List available make targets for development Source: https://github.com/alvarorg14/openlicensd/blob/main/README.md Run `make help` to list all available development targets. Requires Go 1.27+, Node.js 24+, and Docker for local PostgreSQL. ```bash make help ``` -------------------------------- ### Redocly CLI Lint and Preview Commands Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/api.md Use these commands to lint and preview the OpenAPI specification. The lint command uses the Redocly configuration file, and the preview command starts a local server for viewing the docs. ```bash npx @redocly/cli lint docs/openapi.yaml --config docs/redocly.yaml npx @redocly/cli preview-docs docs/openapi.yaml ``` -------------------------------- ### Run make lint-server Source: https://github.com/alvarorg14/openlicensd/blob/main/AGENTS.md Lints the server using go vet and golangci-lint. ```bash make lint-server ``` -------------------------------- ### GET /api/v1/products Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/api.md Retrieves a list of products. Accessible by users with viewer, operator, or admin roles. ```APIDOC ## GET /api/v1/products ### Description Retrieves a list of products. ### Method GET ### Endpoint /api/v1/products ### Required Role viewer, operator, or admin ``` -------------------------------- ### Run make lint-sdk Source: https://github.com/alvarorg14/openlicensd/blob/main/AGENTS.md Lints the SDK using go vet and golangci-lint on sdk/go. ```bash make lint-sdk ``` -------------------------------- ### Create a GitHub release with gh release create Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/deployment.md Triggers the release workflow on the 'release: published' event, which builds Linux amd64/arm64 binaries, Docker images, and Helm chart packaging. Replace vX.Y.Z with the version tag (e.g., v0.5.0). ```bash gh release create vX.Y.Z --generate-notes ``` -------------------------------- ### Enable Ingress and TLS for OpenLicensd Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/deployment.md Values configuration to enable Ingress with TLS for the OpenLicensd Helm chart. ```yaml ingress: enabled: true className: nginx hosts: - host: licenses.example.com paths: - path: / pathType: Prefix tls: - secretName: openlicensd-tls hosts: - licenses.example.com ``` -------------------------------- ### Build binary from source at release tag Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/upgrade.md Fetches tags, checks out the release tag, and builds the binary. Replace vX.Y.Z with the target release tag. ```bash git fetch --tags git checkout vX.Y.Z make build ``` -------------------------------- ### Restore in Docker Compose stack Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/backup-restore.md Stops the app, restores the dump into the Postgres container, then starts the app. Uses docker compose with project name openlicensd-stack and file docker-compose.stack.yml. ```bash # Stop the app, keep Postgres running docker compose -p openlicensd-stack -f docker-compose.stack.yml stop openlicensd docker compose -p openlicensd-stack -f docker-compose.stack.yml exec -T postgres \ pg_restore -U openlicensd -d openlicensd --clean --if-exists --no-owner --no-acl \ < openlicensd-stack-20260101-120000.dump docker compose -p openlicensd-stack -f docker-compose.stack.yml start openlicensd ``` -------------------------------- ### Run make docs-build Source: https://github.com/alvarorg14/openlicensd/blob/main/AGENTS.md Builds documentation when documentation content or site config changes. ```bash make docs-build ``` -------------------------------- ### GET /api/v1/auth/oidc/login Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/api.md Starts OIDC login when enabled. This endpoint does not require authentication. ```APIDOC ## GET /api/v1/auth/oidc/login ### Description Start OIDC login (when enabled). ### Method GET ### Endpoint /api/v1/auth/oidc/login ### Authentication None ``` -------------------------------- ### Enable Harbor registry credentials Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/deployment.md Values configuration to enable Harbor registry credentials for the OpenLicensd Helm chart. ```yaml config: harbor: enabled: true url: https://harbor.example.com projects: myproject,another-project robotDurationDays: 1 secret: data: harborAdminUsername: admin harborAdminPassword: your-harbor-admin-password ``` -------------------------------- ### Validation response: valid Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/api.md Example response for a valid license, including product, policy, and activation count. ```json { "valid": true, "product": "acme-widget", "policy": "30-day trial", "activation_count": 1, "max_activations": 2 } ``` -------------------------------- ### Run SDK lint Source: https://github.com/alvarorg14/openlicensd/blob/main/AGENTS.md Runs go vet and golangci-lint on sdk/go. ```bash make lint-sdk # go vet + golangci-lint on sdk/go ``` -------------------------------- ### Backup local dev database with docker compose (make dev-db) Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/backup-restore.md Runs pg_dump inside the postgres container of the Compose project named openlicensd, writing a custom-format dump to the host. Use this for the local development database started by make dev-db. ```bash docker compose -p openlicensd exec -T postgres \ pg_dump -U openlicensd -d openlicensd \ --format=custom \ --no-owner \ --no-acl \ > "openlicensd-dev-$(date +%Y%m%d-%H%M%S).dump" ``` -------------------------------- ### Build binary Source: https://github.com/alvarorg14/openlicensd/blob/main/AGENTS.md Builds the binary to bin/openlicensd. ```bash make server # Build binary to bin/openlicensd ``` -------------------------------- ### Configure PostgreSQL rate limit backend for multiple replicas Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/deployment.md Set config.rateLimit.backend to postgres so replicas share per-IP rate limits via PostgreSQL instead of in-process memory. Adds a database write on each rate-limited request. ```yaml config: rateLimit: backend: postgres ``` -------------------------------- ### Docs site commands Source: https://github.com/alvarorg14/openlicensd/blob/main/CONTRIBUTING.md Commands to run the VitePress documentation dev server with hot reload and to build the static site for CI. Changes to docs/*.md appear immediately in the dev server. ```bash # Run the docs dev server (hot reload) make docs-dev # Build the static site (same check as CI) make docs-build ``` -------------------------------- ### Run lint (same as CI) Source: https://github.com/alvarorg14/openlicensd/blob/main/AGENTS.md Runs go vet, golangci-lint, and ESLint, matching CI. ```bash make lint # go vet + golangci-lint + ESLint (same as CI) ``` -------------------------------- ### Run single container with environment variables Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/deployment.md Runs the OpenLicensd container with required database and bootstrap environment variables. The production image is built from a multi-stage Dockerfile (Node 24 UI build → Go 1.27 compile → distroless non-root). ```bash docker run -d \ --name openlicensd \ -p 8080:8080 \ -e OPENLICENSD_DATABASE_HOST=host \ -e OPENLICENSD_DATABASE_PORT=5432 \ -e OPENLICENSD_DATABASE_USER=user \ -e OPENLICENSD_DATABASE_PASSWORD=pass \ -e OPENLICENSD_DATABASE_NAME=openlicensd \ -e OPENLICENSD_DATABASE_SSLMODE=disable \ -e OPENLICENSD_BOOTSTRAP_ADMIN_EMAIL=admin@example.com \ -e OPENLICENSD_BOOTSTRAP_ADMIN_PASSWORD_HASH='$2a$10$...' \ -e OPENLICENSD_COOKIE_SECURE=true \ ghcr.io/alvarorg14/openlicensd:X.Y.Z ``` -------------------------------- ### Stop Docker Compose stack and remove database volume Source: https://github.com/alvarorg14/openlicensd/blob/main/QUICKSTART.md Stops the stack and removes its database volume by passing ARGS=-v to make stack-down. ```bash make stack-down ARGS=-v ``` -------------------------------- ### Run server lint Source: https://github.com/alvarorg14/openlicensd/blob/main/AGENTS.md Runs go vet and golangci-lint on the server. ```bash make lint-server # go vet + golangci-lint ``` -------------------------------- ### Kubernetes: View OpenLicensd logs and pod details Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/troubleshooting.md Use these kubectl commands to collect logs and describe the pod when OpenLicensd fails to start or probes fail. The log command fetches the last 200 lines from the deployment in the openlicensd namespace; the describe command shows pod events and status. ```bash kubectl logs -n openlicensd deploy/openlicensd --tail=200 ``` ```bash kubectl describe pod -n openlicensd -l app.kubernetes.io/name=openlicensd ``` -------------------------------- ### Make targets for local development and build Source: https://github.com/alvarorg14/openlicensd/blob/main/README.md These make targets manage the local development environment: start/reset PostgreSQL, run the API server and Nuxt dev server, start/stop the full stack, build UI and binary, run tests, and run linting. A plain `go build` embeds a placeholder admin page; use `make build` or `make ui` for the full admin UI. ```bash make dev-db # Start PostgreSQL make dev-db-reset # Reset dev PostgreSQL volume make dev-server # Run API server (loads .env) make dev-ui # Run Nuxt dev server make stack-up # Start Postgres + openlicensd from GHCR image make stack-down # Stop full stack (ARGS=-v to drop data) make stack-logs # Tail full stack logs make build # Build UI + binary make test # Run Go tests make lint # go vet + golangci-lint + ESLint (same as CI) ``` -------------------------------- ### Build static UI Source: https://github.com/alvarorg14/openlicensd/blob/main/AGENTS.md Builds the static UI into server/internal/static/dist. ```bash make ui # Build static UI into server/internal/static/dist ``` -------------------------------- ### Run Go API server Source: https://github.com/alvarorg14/openlicensd/blob/main/AGENTS.md Runs the Go API server, loading the .env file. ```bash make dev-server # Run Go API server (loads .env) ``` -------------------------------- ### Prometheus scrape configuration for OpenLicensd Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/metrics.md Example scrape config targeting the OpenLicensd metrics endpoint on port 9090. Adjust the host/port for your deployment. The metrics listener is separate from the API/UI server and serves GET /metrics in Prometheus text format. ```yaml scrape_configs: - job_name: openlicensd static_configs: - targets: ["openlicensd:9090"] metrics_path: /metrics ``` -------------------------------- ### Verify restore with readiness endpoint Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/backup-restore.md Checks the /readyz endpoint and expects HTTP 200. Confirms the restored database is serving requests. ```bash curl -s -o /dev/null -w "%{http_code}\n" https://licenses.example.com/readyz # Expect 200 ``` -------------------------------- ### GET /api/v1/auth/me Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/api.md Gets the current user profile (session) or token identity (Bearer). Requires a session or Bearer token. ```APIDOC ## GET /api/v1/auth/me ### Description Get current user profile (session) or token identity (Bearer). ### Method GET ### Endpoint /api/v1/auth/me ### Authentication Session or Bearer token ``` -------------------------------- ### Ready(ctx) Source: https://github.com/alvarorg14/openlicensd/blob/main/sdk/go/README.md Readiness probe to check if the service is ready to handle requests. ```APIDOC ## Ready(ctx) ### Description Readiness probe to check if the service is ready to handle requests. ### Method GET ### Endpoint /readyz ### Parameters #### Path Parameters None #### Query Parameters None ### Response #### Success Response (200) No response body documented. ``` -------------------------------- ### Get current user with curl Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/api.md Retrieve the currently authenticated user profile using the session cookie or Bearer token via GET /api/v1/auth/me. ```bash # Get the currently authenticated user (session cookie or Bearer token) curl -s -b cookies.txt http://localhost:8080/api/v1/auth/me ``` -------------------------------- ### Run SDK tests and linting Source: https://github.com/alvarorg14/openlicensd/blob/main/sdk/go/README.md Use these Make targets to run the SDK test suite and linter during development. ```bash make test-sdk make lint-sdk ``` -------------------------------- ### Run make lint-ui Source: https://github.com/alvarorg14/openlicensd/blob/main/AGENTS.md Lints the UI using ESLint. ```bash make lint-ui ``` -------------------------------- ### GET /healthz Source: https://github.com/alvarorg14/openlicensd/blob/main/README.md Health check endpoint for liveness. No authentication required. ```APIDOC ## [GET] /healthz ### Description Health check endpoint for liveness. No authentication required. ### Method GET ### Endpoint /healthz ### Authentication None ``` -------------------------------- ### Upgrade binary by replacing executable Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/upgrade.md Stops the running process, backs up the current binary, replaces it with the new release binary, and runs it. Use the same environment variables as the previous container. ```bash # Stop the running process (systemd, supervisor, etc.) cp bin/openlicensd bin/openlicensd.bak # Replace bin/openlicensd with the new release binary ./bin/openlicensd ``` -------------------------------- ### Authenticated requests with CSRF token Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/api.md Extract the CSRF token from cookies.txt and make authenticated GET requests to list licenses, filter with query parameters, get stats, and fetch a single license by ID. The CSRF token is required for unsafe methods. ```bash CSRF=$(grep openlicensd_csrf cookies.txt | awk '{print $7}') curl -s -b cookies.txt http://localhost:8080/api/v1/licenses # Paginated list with search, filters, and sorting curl -s -b cookies.txt "http://localhost:8080/api/v1/licenses?page=1&page_size=25&status=active&sort=created_at&order=desc" # License status counts (unfiltered) curl -s -b cookies.txt http://localhost:8080/api/v1/licenses/stats # Single license by ID curl -s -b cookies.txt http://localhost:8080/api/v1/licenses/{id} ``` -------------------------------- ### GET /api/v1/policies Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/architecture.md Lists policies with pagination and optional product_id filter. ```APIDOC ## GET /api/v1/policies ### Description Lists policies with pagination and optional product_id filter. ### Method GET ### Endpoint /api/v1/policies ### Query Parameters - **product_id** (string) - Optional - Filter policies by product ID ### Authentication Session ``` -------------------------------- ### GET /healthz Source: https://github.com/alvarorg14/openlicensd/blob/main/COMPATIBILITY.md Liveness probe that checks if the service is running. Does not perform dependency checks. ```APIDOC ## GET /healthz ### Description Liveness probe that checks if the service is running. Does not perform dependency checks. ### Method GET ### Endpoint /healthz ``` -------------------------------- ### Build VitePress docs site Source: https://github.com/alvarorg14/openlicensd/blob/main/AGENTS.md Builds the VitePress documentation site. ```bash make docs-build # Build VitePress docs site ``` -------------------------------- ### GET /api/v1/auth/oidc/callback Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/api.md OIDC callback when enabled. This endpoint does not require authentication. ```APIDOC ## GET /api/v1/auth/oidc/callback ### Description OIDC callback (when enabled). ### Method GET ### Endpoint /api/v1/auth/oidc/callback ### Authentication None ``` -------------------------------- ### GET /api/v1/audit-events Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/api.md Retrieves audit events. Accessible only by admin users. ```APIDOC ## GET /api/v1/audit-events ### Description Retrieves audit events. ### Method GET ### Endpoint /api/v1/audit-events ### Required Role admin ``` -------------------------------- ### New(baseURL, product string, opts ...Option) (*Client, error) Source: https://github.com/alvarorg14/openlicensd/blob/main/sdk/go/README.md Creates a new OpenLicensd client with the given base URL and product code. The base URL must be an absolute http or https URL, and the product code is required to scope validation requests. ```APIDOC ## New(baseURL, product string, opts ...Option) (*Client, error) ### Description Creates a new OpenLicensd client with the given base URL and product code. The base URL must be an absolute http or https URL, and the product code is required to scope validation requests. ### Parameters - **baseURL** (string) - Required - Absolute http or https URL of your OpenLicensd server. Trailing slashes are stripped. Path prefixes are supported. - **product** (string) - Required - Product code sent on every validation request. - **opts** (Option) - Optional - Configuration options. ### Options - **WithTimeout(d)** - HTTP client timeout (default 10s) - **WithUserAgent(ua)** - Custom User-Agent header - **WithHTTPClient(c)** - Custom *http.Client - **WithRetry(n, delay)** - Retry Validate on 429/5xx/network errors (default 2 attempts) - **WithAnyProduct()** - Disable product scoping - **WithFingerprint(fp)** - Machine fingerprint sent on validation requests (required when the server enforces max_activations) - **WithHostname(hostname)** - Send this hostname instead of os.Hostname() - **WithoutHostname()** - Do not send a hostname on validation requests ### Example ```go client, err := openlicensd.New("https://licenses.example.com", "acme-widget") if err != nil { log.Fatal(err) } ``` ``` -------------------------------- ### GET /api/v1/users Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/api.md Retrieves a list of users. Accessible only by admin users. ```APIDOC ## GET /api/v1/users ### Description Retrieves a list of users. ### Method GET ### Endpoint /api/v1/users ### Required Role admin ``` -------------------------------- ### GET /healthz Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/api.md Liveness probe with no dependency checks. This endpoint does not require authentication. ```APIDOC ## GET /healthz ### Description Liveness probe (no dependency checks). ### Method GET ### Endpoint /healthz ### Authentication None ``` -------------------------------- ### GET /api/v1/auth/providers Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/api.md Lists enabled login methods. This endpoint does not require authentication. ```APIDOC ## GET /api/v1/auth/providers ### Description List enabled login methods. ### Method GET ### Endpoint /api/v1/auth/providers ### Authentication None ``` -------------------------------- ### Run Go tests Source: https://github.com/alvarorg14/openlicensd/blob/main/AGENTS.md Runs Go tests, loading .env if present. ```bash make test # Go tests (loads .env if present) ``` -------------------------------- ### NewFromEnv() (*Client, error) Source: https://github.com/alvarorg14/openlicensd/blob/main/sdk/go/README.md Creates a new OpenLicensd client using environment variables OPENLICENSD_URL and OPENLICENSD_PRODUCT. Intended for self-hosted deployments where the operator controls the server. ```APIDOC ## NewFromEnv() (*Client, error) ### Description Creates a new OpenLicensd client using environment variables OPENLICENSD_URL and OPENLICENSD_PRODUCT. Intended for self-hosted deployments where the operator controls the server. ### Environment Variables - **OPENLICENSD_URL** - Required - Base URL of the OpenLicensd server. - **OPENLICENSD_PRODUCT** - Required - Product code for validation requests. ### Example ```go client, err := openlicensd.NewFromEnv() if err != nil { log.Fatal(err) } ``` ``` -------------------------------- ### Run Go SDK tests Source: https://github.com/alvarorg14/openlicensd/blob/main/AGENTS.md Runs Go SDK tests. ```bash make test-sdk # Go SDK tests ``` -------------------------------- ### GET /api/v1/users/{id} Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/api.md Retrieves a specific user by ID. Accessible only by admin users. ```APIDOC ## GET /api/v1/users/{id} ### Description Retrieves a specific user by ID. ### Method GET ### Endpoint /api/v1/users/{id} ### Path Parameters - **id** (string) - Required - The unique identifier of the user. ### Required Role admin ``` -------------------------------- ### GET /api/v1/auth/me Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/api.md Retrieves information about the currently authenticated user. Accessible by any authenticated user. ```APIDOC ## GET /api/v1/auth/me ### Description Retrieves information about the currently authenticated user. ### Method GET ### Endpoint /api/v1/auth/me ### Required Role any authenticated user ``` -------------------------------- ### Restore into a new database with pg_restore Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/backup-restore.md Creates an empty database and restores a dump into it. Use --no-owner and --no-acl to avoid ownership and ACL issues. Requires PostgreSQL 16+ and pgcrypto availability. ```bash # Create an empty database (as a superuser or role with CREATEDB) createdb -h host -U admin openlicensd_restored pg_restore \ --dbname="postgres://user:pass@host:5432/openlicensd_restored?sslmode=require" \ --no-owner \ --no-acl \ --verbose \ openlicensd-20260101-120000.dump ``` -------------------------------- ### GET /api/v1/licenses Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/api.md Lists licenses. Can be authenticated with a Bearer API token without CSRF. ```APIDOC ## GET /api/v1/licenses ### Description Lists licenses. Can be authenticated with a Bearer API token without CSRF. ### Method GET ### Endpoint /api/v1/licenses ### Request Example ```bash curl -s http://localhost:8080/api/v1/licenses \ -H "Authorization: Bearer olsd_..." ``` ``` -------------------------------- ### GET /api/v1/api-tokens Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/api.md Retrieves a list of API tokens. Accessible only by admin users via session. ```APIDOC ## GET /api/v1/api-tokens ### Description Retrieves a list of API tokens. ### Method GET ### Endpoint /api/v1/api-tokens ### Required Role admin (session only) ``` -------------------------------- ### GET /api/v1/policies Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/api.md Retrieves a list of policies. Accessible by users with viewer, operator, or admin roles. ```APIDOC ## GET /api/v1/policies ### Description Retrieves a list of policies. ### Method GET ### Endpoint /api/v1/policies ### Required Role viewer, operator, or admin ``` -------------------------------- ### GET /api/v1/licenses Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/api.md Retrieves a list of licenses. Accessible by users with viewer, operator, or admin roles. ```APIDOC ## GET /api/v1/licenses ### Description Retrieves a list of licenses. ### Method GET ### Endpoint /api/v1/licenses ### Required Role viewer, operator, or admin ``` -------------------------------- ### Run VitePress docs dev server Source: https://github.com/alvarorg14/openlicensd/blob/main/AGENTS.md Runs the VitePress documentation development server. ```bash make docs-dev # Run VitePress docs dev server ``` -------------------------------- ### List all make targets Source: https://github.com/alvarorg14/openlicensd/blob/main/AGENTS.md Lists all available make targets for the development workflow. ```bash make help # List all targets ``` -------------------------------- ### GET /api/v1/licenses/stats Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/api.md Retrieves statistics about licenses. Accessible by users with viewer, operator, or admin roles. ```APIDOC ## GET /api/v1/licenses/stats ### Description Retrieves statistics about licenses. ### Method GET ### Endpoint /api/v1/licenses/stats ### Required Role viewer, operator, or admin ``` -------------------------------- ### Run make build Source: https://github.com/alvarorg14/openlicensd/blob/main/AGENTS.md Mandatory build command that must succeed before completion. ```bash make build ``` -------------------------------- ### Enable ServiceMonitor for Prometheus metrics Source: https://github.com/alvarorg14/openlicensd/blob/main/docs/deployment.md Values configuration to enable the optional ServiceMonitor for Prometheus metrics collection. ```yaml serviceMonitor: enabled: true # Optional: labels for your Prometheus serviceMonitorSelector labels: release: kube-prometheus-stack ``` -------------------------------- ### Run UI lint Source: https://github.com/alvarorg14/openlicensd/blob/main/AGENTS.md Runs ESLint for the UI. ```bash make lint-ui # ESLint ```