Skip to content
groupsumPublic

About

Portwyrm CLI helper and provider foundation

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

wyrmctl-workspace

Wyrmctl architecture diagram

wyrmctl-workspace

Workspace root for wyrmctl, an owner-scoped Nginx Proxy Manager controller.

pypi: wyrmctl-workspace unpublished Source version: 0.4.10 Python: >=3.10 Layer: workspace Lifecycle: active License: Apache-2.0 Notice: not required

pypi downloads: wyrmctl-workspace: unpublished README hits: wyrmctl-workspace

README standards: CI gate Tests: repository CI Certification: not certified Governance: repository policy Evidence: test suite

Overview · Installation · Quick Start · Usage · API · Contributing · Governance · License


Overview

Summary

The source workspace builds the Wyrmctl CLI and five independently installable DNS providers. It also contains the desired-state contracts, Nginx Proxy Manager test stack, and release workflows.

Why This Package

Review owner-scoped changes from version-controlled YAML before applying them to a shared Nginx Proxy Manager instance.

When to Use

Use Wyrmctl from a local shell or CI when you need repeatable plan and apply workflows against Nginx Proxy Manager. The Wyrmctl CLI is part of the Portwyrm project, which provides the service and control plane.

Features

Validate and migrate desired state offline, inspect API capabilities, export immutable plan artifacts, and load optional DNS providers. Review adoption, transfer, and prune operations through their explicit workflows.

wyrmctl 0.4 adds independently versioned contracts, DesiredState v3, canonical semantic digests, repository manifests, lockfiles, immutable plan artifacts, transactional migration manifests, provider capability negotiation, and stable machine-readable command results.

wyrmctl contract list
wyrmctl repo validate .wyrmctl/repository.yaml
wyrmctl plan .wyrmctl/production --artifact-out .wyrmctl/artifacts/plan.yaml \
  --repository groupsum/example --environment production --commit "$GITHUB_SHA"
wyrmctl apply --artifact .wyrmctl/artifacts/plan.yaml \
  --repository groupsum/example --environment production --commit "$GITHUB_SHA"

Ordinary plan artifacts may create, update, or verify resources. Adoption, transfer, prune, and delete require an explicit reviewed migration artifact.

Non-Goals

Run the reverse proxy separately through Nginx Proxy Manager or Portwyrm. The CLI invokes an existing API and scopes reconciliation to explicitly managed resources.


Getting Started

Prerequisites

  • Python 3.10, 3.11, 3.12, 3.13, or 3.14
  • Access to a Nginx Proxy Manager API, usually http://host:81/api
  • NPM admin credentials or an account with permissions for the resources you want to manage
  • Optional for local development: Docker and Docker Compose

Installation

Install the system-facing CLI in an isolated tool environment with pipx install wyrmctl or uv tool install wyrmctl. To use the checkout, run uv sync --all-packages.

uv

This is a source-only workspace or test harness, not an installable distribution. From its checkout, synchronize the declared environment:

uv sync

pip

This is a source-only workspace or test harness, not an installable distribution. Use the uv checkout workflow above; this installer does not install the harness itself.

Poetry

This is a source-only workspace or test harness, not an installable distribution. Use the uv checkout workflow above; this installer does not install the harness itself.

Quick Start

Example

Source: examples/readme/quick_start.py.

from wyrmctl.cli import main

raise SystemExit(main(["--help"]))

Expected Result

The command prints Wyrmctl’s help and exits successfully without opening an API connection.


Usage

Common Workflows

Source: examples/readme/usage.py.

from wyrmctl.cli import main

raise SystemExit(main(["--output", "json", "contract", "list"]))

The example lists the contracts known to the installed CLI in JSON. Validate YAML before connecting to the live API.

Validate desired state without calling NPM:

wyrmctl validate examples/desired-state
wyrmctl --output json validate examples/desired-state

Check whether files need schema migration:

wyrmctl migrate examples/desired-state --check
wyrmctl migrate examples/desired-state --write

Fetch the live NPM OpenAPI schema:

wyrmctl schema fetch --write schemas/npm/live-openapi.json

Inspect endpoint capabilities from a schema file or from the live API:

wyrmctl schema capabilities --schema schemas/npm/2.10.4/openapi.json
wyrmctl schema capabilities
wyrmctl schema check

Plan owner-scoped changes:

wyrmctl plan examples/desired-state --owner workload-a
wyrmctl --output json plan examples/desired-state --owner workload-a

Apply a clean plan:

wyrmctl apply examples/desired-state --owner workload-a

Preview the apply path without mutation:

wyrmctl apply examples/desired-state --owner workload-a --dry-run

Delete owned resources that are no longer present in desired state:

wyrmctl apply examples/desired-state --owner workload-a --prune-owned

Adopt unmanaged matching resources by writing wyrmctl metadata:

wyrmctl adopt examples/desired-state --owner workload-a

Strict adoption requires the unmanaged resource fields to match desired state. To allow field drift while attaching metadata:

wyrmctl adopt examples/desired-state --owner workload-a --allow-field-drift

Desired state

A minimal proxy host:

apiVersion: wyrmctl.com/v1
schemaVersion: 2
proxy_hosts:
  - domain_names: [app.example.com]
    forward_scheme: http
    forward_host: app
    forward_port: 3000
    meta:
      managed_by: wyrmctl
      owner: workload-a
      resource_id: proxy.app

A proxy host with certificate and access-list references:

apiVersion: wyrmctl.com/v1
schemaVersion: 2
certificates:
  - name: wildcard-example
    domain_names: ["*.example.com", example.com]
    certificate_type: letsencrypt
    api_payload:
      provider: letsencrypt
    meta:
      managed_by: wyrmctl
      owner: workload-a
      resource_id: cert.wildcard-example
access_lists:
  - name: private-admins
    api_payload:
      satisfy_any: 0
      items: []
      clients: []
    meta:
      managed_by: wyrmctl
      owner: workload-a
      resource_id: acl.private-admins
proxy_hosts:
  - domain_names: [app.example.com]
    forward_scheme: http
    forward_host: app
    forward_port: 3000
    certificate_ref: cert.wildcard-example
    access_list_ref: acl.private-admins
    ssl_forced: 1
    http2_support: 1
    allow_websocket_upgrade: 1
    caching_enabled: 1
    block_exploits: 1
    meta:
      managed_by: wyrmctl
      owner: workload-a
      resource_id: proxy.app

More examples are in examples/desired-state.

Configuration

You can pass API credentials on every command:

wyrmctl --base-url http://127.0.0.1:81/api --identity admin@example.com --secret changeme health

For regular use, set environment variables:

export NPM_BASE_URL=http://127.0.0.1:81/api
export NPM_IDENTITY=admin@example.com
export NPM_SECRET=changeme
export NPM_TIMEOUT_S=15

PowerShell:

$env:NPM_BASE_URL = "http://127.0.0.1:81/api"
$env:NPM_IDENTITY = "admin@example.com"
$env:NPM_SECRET = "changeme"
$env:NPM_TIMEOUT_S = "15"

Then verify connectivity:

wyrmctl health

Error Handling

  • 0: success
  • 1: plan conflict
  • 2: usage, validation, or migration error
  • 3: API error
  • 4: endpoint capability error

Best Practices

  1. Author YAML with explicit meta.owner and meta.resource_id.
  2. Run wyrmctl validate.
  3. Run wyrmctl schema check against the target NPM instance.
  4. Run wyrmctl plan --owner <owner>.
  5. Review creates, updates, deletes, adopts, noops, and conflicts.
  6. Run wyrmctl apply --owner <owner> only when the plan is clean.
  7. Use --prune-owned only when absent owned resources should be deleted.

Package Boundary

What It Owns

The Wyrmctl workspace owns the desired-state definitions and operator workflow for Wyrmctl-managed resources. Nginx Proxy Manager maintains live proxy and access configuration.

Public API and Import Surfaces

Automation can use the wyrmctl console script, the versioned artifact formats, and structured output. Python callers can invoke wyrmctl.cli.main with an explicit argument list.

Entry Points

This package declares no command-line, GUI, or plugin entry points in its manifest.

Injected Dependencies

The CLI uses the configured Nginx Proxy Manager API and its OpenAPI capabilities. DNS operations load installed providers through Python package entry points.

Protocol Consumers

CI pipelines consume JSON command results and plan artifacts. The CLI consumes Nginx Proxy Manager HTTP endpoints and the Wyrmctl DNS provider protocol.

Extensions

DNS packages register providers under wyrmctl.dns_providers. See the provider contracts and capabilities.


Operations and Readiness

Operational Requirements

The repo includes a SQLite-backed NPM stack for local testing:

docker compose -f deploy/npm/docker-compose.yml up -d
export NPM_BASE_URL=http://127.0.0.1:81/api
export NPM_IDENTITY=admin@example.com
export NPM_SECRET=changeme
wyrmctl health

For details, see deploy/npm/README.md.

Health and Observability

Run wyrmctl health to check API access, wyrmctl schema check to verify endpoint coverage, and wyrmctl dns doctor --provider NAME to troubleshoot provider configuration.

Security and Resource Limits

  • Every managed resource must carry meta.managed_by: wyrmctl, meta.owner, and meta.resource_id.
  • --owner limits planning and mutation to one owner scope.
  • Foreign-owned resources are immutable to the current owner.
  • Unmanaged resources are not changed by plan or apply; use adopt to attach wyrmctl metadata.
  • Deletes are opt-in with --prune-owned.
  • API operations are gated by the NPM OpenAPI schema and fail closed when a required endpoint is unavailable.

Compatibility

The CLI and provider releases support Python 3.10 through 3.14. Use Python 3.11 or later for the README Standards development gate.

The native wyrmctl profile uses wyrmctl.* contracts. Existing Nginx Proxy Manager workflows may continue to use the compatibility profile documented in the CLI guide.


Verification

Tests

Run uv run pytest from the repository checkout. See the test workflow for the hosted checks.

Certification Status

The repository runs GitHub Actions quality and live Nginx Proxy Manager gates. It does not claim independent certification.

Evidence

The versioned CLI tests cover contract commands, repository validation, and plan artifact behavior.


FAQ

Why

Why review a plan first?

It shows the proposed owner-scoped operations and exposes collisions before apply.

How

How are existing manual resources adopted?

Run wyrmctl adopt explicitly for a compatible resource and the intended owner. Later plans use the resulting ownership metadata.

When

When does Wyrmctl issue a certificate?

It issues missing desired certificates when the configured provider and API support issuance. Renewal follows the certificate reconcile policy.


Documentation and Related Packages

More Documentation

Related Packages

Install wyrmctl for the CLI. See the DNS provider comparison to choose a provider and configure its credentials.

Project Links


Contributing

How to Contribute

Open an issue or pull request in the Wyrmctl repository. Include a reproducible desired-state example for reconciliation changes and the checks you ran.

Development Setup

Run the normal local checks:

uv sync
uv run ruff check .
uv run ruff format --check .
uv run pytest
uv build --package wyrmctl

Run the live Wyrmctl suite against the pinned Portwyrm image:

export COMPOSE_FILE=deploy/portwyrm/compose.ci.yml
export COMPOSE_PROJECT_NAME=wyrmctl-portwyrm-local
docker compose up -d
export NPMCTL_REAL_NPM=1
export NPM_BASE_URL="http://$(docker compose port portwyrm 81)/api"
export NPM_IDENTITY=admin@example.test
export NPM_SECRET=wyrmctl-test-password
uv run pytest --no-cov -m npm packages/wyrmctl/tests/e2e
docker compose down --volumes

Notes for Maintainers

Run uv run readme-standards render --all --write after changing a manifest or an example. Run uv run readme-standards check --all before release.


Governance

Ownership and Decision Making

The GroupSum Wyrmctl repository maintainers review changes to reconciliation behavior, release metadata, and supported provider contracts.

Standards and Policies

Follow the repository’s contributor guidance and the versioned desired-state and artifact contracts.

Lifecycle and Migration

Wyrmctl is maintained as a beta CLI. Use wyrmctl migrate PATH --check before changing desired-state versions and review the migration guide.


License and Attribution

License

Licensed under Apache-2.0. See LICENSE.

Notices

No separate NOTICE file is declared. Review the license and bundled third-party attributions.

About

Portwyrm CLI helper and provider foundation

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages