Skip to main content

Owner-scoped plan/apply/adopt controller for Nginx Proxy Manager resources.

Project description

npmctl

npmctl is the Python package and console script for owner-scoped Nginx Proxy Manager automation. It validates desired-state YAML, computes safe plans, applies clean changes, and adopts unmanaged resources only when explicitly requested.

Install

Use pipx for an isolated CLI install:

pipx install npmctl
npmctl --version

Use uv if you manage tools with uv:

uv tool install npmctl
npmctl --help

Use pip inside an existing virtual environment:

python -m venv .venv
. .venv/bin/activate
python -m pip install npmctl
npmctl --help

PowerShell activation:

python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install npmctl
npmctl --help

Configure NPM

Set Nginx Proxy Manager API credentials as environment variables:

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

Or pass them directly:

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

Desired State

Every managed resource needs npmctl ownership metadata:

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

References use resource_id values:

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

Commands

Validate files without calling the NPM API:

npmctl validate ./desired-state
npmctl --output json validate ./desired-state

Check or write desired-state schema migrations:

npmctl migrate ./desired-state --check
npmctl migrate ./desired-state --write

Check the target NPM API:

npmctl health
npmctl schema fetch --write npm-openapi.json
npmctl schema capabilities
npmctl schema check

Plan and apply by owner:

npmctl plan ./desired-state --owner workload-a
npmctl apply ./desired-state --owner workload-a

Preview apply without mutation:

npmctl apply ./desired-state --owner workload-a --dry-run

Prune owned resources absent from desired state:

npmctl apply ./desired-state --owner workload-a --prune-owned

Adopt unmanaged matching resources:

npmctl adopt ./desired-state --owner workload-a
npmctl adopt ./desired-state --owner workload-a --allow-field-drift

Exit Codes

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

More Documentation

The source repository includes detailed docs and examples:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

npmctl-0.3.1.tar.gz (30.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

npmctl-0.3.1-py3-none-any.whl (41.7 kB view details)

Uploaded Python 3

File details

Details for the file npmctl-0.3.1.tar.gz.

File metadata

  • Download URL: npmctl-0.3.1.tar.gz
  • Upload date:
  • Size: 30.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for npmctl-0.3.1.tar.gz
Algorithm Hash digest
SHA256 807410ced8324866816219f12787f93478d936bff4f6e02a0c824310cac42088
MD5 92241121dc94fa87e56f41a16302389b
BLAKE2b-256 0a01b819c17e17622811f682da10cd996321ebc329e144f1288b3b5b7aa851f3

See more details on using hashes here.

File details

Details for the file npmctl-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: npmctl-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 41.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for npmctl-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c1bba697d4b9bac8bc2e81d79647477d5d30258c2224f0eca08c2f991cf1f611
MD5 ffc93fc1765b44e6ea85149d9feedea2
BLAKE2b-256 e013daa77a425004fb04251adaacb8656b9a7c60bf1a9e2d920ef6a43ebdb24f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page