Skip to main content

host-prep-lib

Automation for preparing a host to run Couchbase software.

Note: This package is not officially supported by Couchbase.

Quick Start

Install the software bundle for Couchbase Server and all prerequisites:

bundlemgr -b CBS

swmgr

swmgr manages Couchbase Server clusters, Sync Gateway, and certificates. Run each command on the target host. Global options:

swmgr [--debug] [--verbose] COMMAND ...

Cluster

Cluster options are shared by all cluster subcommands:

swmgr cluster [OPTIONS] COMMAND

Options:
  -n, --name                 Cluster name (default: cbserver)
  -l, --ip-address           Node IP address (default: auto-detected)
  -r, --rally-ip-address     Rally node IP address (default: node IP)
  -e, --external-ip-address  External IP address for alternate addressing
  -s, --services             Comma-separated services (default: data,index,query)
  -u, --username             Cluster username (default: Administrator)
  -p, --password             Cluster password (default: password)
  -i, --index-mem            Index memory option: default or memopt (default: default)
  -g, --server-group         Server group name (default: group-1)
  -D, --data-path            Couchbase data path
  -C, --community            Community edition
  -K, --private-key          Private key path
  -o, --options              Comma-separated extra options (e.g. memopt)
      --ca-cert              PEM-formatted cluster CA certificate
      --ca-cert-key          PEM-formatted cluster CA private key

Commands:

Command Description
create Initialize a new cluster on this node
add Add this node to an existing cluster
update Set or update the external IP on this node (requires -e)
rebalance Rebalance the cluster
ca_cert Load the cluster certificate authority
node_cert Generate and load the node certificate
cert_auth Enable certificate-based client authentication
wait Wait for the cluster to become available

Create a three-node cluster (run on each node with the appropriate IP and rally address):

# Node 1 (rally node)
swmgr cluster -n cbdb -l 192.168.1.5 create

# Node 2
swmgr cluster -n cbdb -l 192.168.1.6 -r 192.168.1.5 add

# Node 3
swmgr cluster -n cbdb -l 192.168.1.7 -r 192.168.1.5 add

# Rebalance from the rally node
swmgr cluster -r 192.168.1.5 rebalance

Custom certificates during cluster setup

Custom certificates require a CA certificate and matching private key. Provide them via CLI options or place files on the node:

  • ca.key — CA private key
  • ca.pem or ca.crt — CA certificate

Files are searched in the Couchbase inbox, home directory, and data path.

On cluster create, if CA materials are present, the cluster CA is loaded and the node certificate is updated after cluster initialization. On cluster add, if a CA private key is present, the node certificate is updated using the matching trusted root CA from the cluster. If no materials are provided, Couchbase default certificates are used and an informational message is logged.

Create a cluster with a custom CA:

swmgr cluster -n cbdb -l 192.168.1.5 \
  --ca-cert "$(cat ca.pem)" \
  --ca-cert-key "$(cat ca.key)" \
  create

Add a node with an external IP and custom node certificate:

swmgr cluster -l 192.168.1.6 -r 192.168.1.5 -e 1.2.3.4 \
  --ca-cert-key "$(cat ca.key)" \
  add

Update the external IP on an existing node:

swmgr cluster -u user -p password -e 1.2.3.4 update

Certificate

Certificate options are shared by all cert subcommands:

swmgr cert [OPTIONS] COMMAND

Options:
  -u, --username             Cluster username (default: Administrator)
  -p, --password             Cluster password (default: password)
  -l, --ip-address           Node IP address (default: auto-detected)
  -e, --external-ip-address  External IP address
  -D, --data-path            Output directory for CA files
  -f, --filename             Output file name
  -d, --domain               Certificate domain name
  -A, --alt-names            Certificate alternate names
  -H, --host-cert            Create hostname certificate
  -k, --key-file             Private key file
  -c, --cert-file            Certificate file
  --base64                   Output CA as base64
      --ca-cert              PEM-formatted cluster CA certificate
      --ca-cert-key          PEM-formatted cluster CA private key

Commands:

Command Description
key Generate a private key
create Generate a certificate
user Generate a client certificate (PKCS12)
ca Generate a certificate authority
cluster-ca Load a custom cluster CA into the trust store
node-cert Regenerate and reload the node certificate

Generate a CA for use with the cluster:

swmgr cert ca -D /root

Load a custom cluster CA (requires CA certificate and private key):

swmgr cert -u user -p password cluster-ca

Or provide PEM content directly:

swmgr cert -u user -p password \
  --ca-cert "$(cat ca.pem)" \
  --ca-cert-key "$(cat ca.key)" \
  cluster-ca

Update the node certificate on the local node. The trusted root CA is fetched from GET /pools/default/trustedCAs and must match the provided CA private key. The new certificate includes the internal IP and external IP (if configured) as subject alternative names:

swmgr cert -u user -p password --ca-cert-key "$(cat ca.key)" node-cert

If CA materials are not available when running an explicit cert command, an error is logged with instructions on how to provide them.

Gateway

swmgr gateway [OPTIONS] COMMAND

Options:
  -l, --ip-list   Comma-separated Couchbase Server IP list (default: 127.0.0.1)
  -u, --username  Cluster username (default: Administrator)
  -p, --password  Cluster password (default: password)
  -b, --bucket    Bucket name (default: default)
  -S, --sgw-path  Sync Gateway root path (default: /home/sync_gateway)
  -T, --tls       Use TLS
  -f, --filename  Destination config file

Commands:

Command Description
configure Configure Sync Gateway on this host
wait Wait for Sync Gateway to become available

Example:

swmgr gateway -l 192.168.1.5,192.168.1.6,192.168.1.7 configure

Metadata

Release files for pyhostprep 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyhostprep 2.0.0
File Size Uploaded Provenance Actions
pyhostprep-2.0.0.tar.gz 13.7 kB Without provenance Details for pyhostprep-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyhostprep 2.0.0
File Interpreter ABI Platform Actions
pyhostprep-2.0.0-py3-none-any.whl Python 3 none any Details for pyhostprep-2.0.0-py3-none-any.whl

Total release size: 75.3 kB

Release files / pyhostprep-2.0.0.tar.gz

Download URL pyhostprep-2.0.0.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4548c7e0a8e9df1488d582dc8093b288c4426cfae8a72e0d013cc66edacb9c1c
BLAKE2b-256 checksum
How to use checksums
f0c529fe32cee563dd301b546087dc8db33c02e27a6a8b796ca1df7eabfc0038
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.17.0 {"ci":null,"cpu":"arm64","distro":{"name":"macOS","version":"27.0.1"},"implementation":{"name":"CPython","version":"3.12.10"},"installer":{"name":"hatch","version":"1.17.0"},"openssl_version":"OpenSSL 3.0.16 11 Feb 2025","python":"3.12.10","system":{"name":"Darwin","release":"27.0.0"}} HTTPX2/2.3.0

Release files / pyhostprep-2.0.0-py3-none-any.whl

Download URL pyhostprep-2.0.0-py3-none-any.whl
Size 61.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c2b6e08a07ee1cadbefa4a8c10b300f5f20e94d041c8fdc1d85eaadda961f822
BLAKE2b-256 checksum
How to use checksums
5cc80a21ce69201de984d70dab163126533ddf7782cbba7e66c722ed3d82da01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.17.0 {"ci":null,"cpu":"arm64","distro":{"name":"macOS","version":"27.0.1"},"implementation":{"name":"CPython","version":"3.12.10"},"installer":{"name":"hatch","version":"1.17.0"},"openssl_version":"OpenSSL 3.0.16 11 Feb 2025","python":"3.12.10","system":{"name":"Darwin","release":"27.0.0"}} HTTPX2/2.3.0

Security for pyhostprep 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page