Skip to main content

Molnett CLI (molnctl)

The Molnett Command Line Interface (molnctl) is your primary tool for interacting with the Molnett platform from your terminal. It allows you to manage your tenants, projects, environments, services, secrets, and more.

Installation

  • Recommended: Download pre-compiled binaries for macOS (Apple Silicon & Intel) and Linux from the Molnctl GitHub Releases page. Extract molnctl and place it in a directory included in your system's PATH.
  • Alternative (Compile from Source): If you have a Rust development environment, you can clone the repository and run cargo build --release. Copy the resulting binary from target/release/molnctl to your PATH.

Verify Installation:

molnctl version

Global Options

These options can be used with most molnctl commands:

  • --config <FILE_PATH>: Path to a custom config file. (Env: MOLNETT_CONFIG)
    • Default: $HOME/.config/molnett/config.json
  • --url <API_URL>: Specify the Molnett API URL. (Env: MOLNETT_API_URL)
    • Default: https://api.se-ume.molnett.app
  • --tenant <TENANT_NAME_OR_ID>: Override the default tenant from the config. (Env: MOLNETT_TENANT)
  • --project <PROJECT_NAME_OR_ID>: Override the default project from the config. (Env: MOLNETT_PROJECT)
  • --env <ENVIRONMENT_NAME>: Specify the environment for the command. (Env: MOLNETT_ENVIRONMENT)
    • Note: Many commands require an environment context (e.g., deploy, services list/delete, secrets list/create/delete, logs). This can be set via this flag if not already configured as a default (mechanism for setting default environment TBC).
  • -q, --quiet: Suppress non-essential output, like the new version check.
  • -h, --help: Show help for any command or subcommand.

Command Structure

molnctl uses a molnctl <NOUN> <VERB> structure (e.g., molnctl tenants list, molnctl projects create). Some direct action commands like molnctl deploy also exist.

Authentication (molnctl auth ...)

  • molnctl auth login
    • Initiates a browser-based login to your Molnett account.
  • molnctl auth docker
    • Logs your Docker client into Molnett's container registry (oci.se-ume.mltt.art).
    • Uses your active Molnett session token for authentication (username is x, password is the token).

Tenant Management (molnctl tenants ...)

Tenants are your primary account or organization space.

  • molnctl tenants list
    • Lists all tenants you have access to.
  • molnctl tenants switch [TENANT_NAME_OR_ID]
    • Switches your default tenant context for subsequent commands.
    • If TENANT_NAME_OR_ID is omitted, an interactive selection prompt is shown.
    • Updates your molnctl configuration file with the new default tenant.

Project Management (molnctl projects ..., alias: proj)

Projects organize your services and environments within a tenant.

  • molnctl projects list
    • Lists all projects within your currently selected tenant.
    • Project ID for Registry: The output of this command should include the Project ID, which is required for tagging Docker images for Molnett's registry (e.g., oci.se-ume.mltt.art/YOUR_PROJECT_ID/image:tag).
  • molnctl projects create <project-name>
    • Creates a new project within the current tenant.
    • Sets the newly created project as the default in your molnctl configuration.
  • molnctl projects switch [PROJECT_NAME_OR_ID]
    • Switches your default project context.
    • If PROJECT_NAME_OR_ID is omitted, an interactive prompt is shown.
    • Updates your molnctl configuration file.
  • molnctl projects delete <project-name-or-id> [--no-confirm]
    • Deletes a project after confirmation (unless --no-confirm is used).
  • (Placeholder: Is there a molnctl projects get <name-or-id> to view details of a specific project, if the ID isn't clear from list?)

Environment Management (molnctl environments ..., alias: envs)

Environments (e.g., development, production) isolate service instances within a project.

  • molnctl environments list
    • Lists all environments within your currently selected project.
  • molnctl environments create <environment-name> [--copy-from <EXISTING_ENV_NAME>]
    • Creates a new environment within the current project.
    • --copy-from: Clones an existing environment (details TBC).
  • molnctl environments delete <environment-name> [--no-confirm]
    • Deletes an environment after confirmation.
  • Selecting Environments for Commands: There isn't a direct environments switch command. Specify the target environment for commands like deploy or services list using the global --env <ENV_NAME> flag or the MOLNETT_ENVIRONMENT shell variable.

Service Deployment & Management

Top-Level Commands

  • molnctl deploy [--env <ENV_NAME>] [MANIFEST_PATH]
    • Deploys services defined in the manifest file to the specified environment.
    • --env <ENV_NAME>: (Required) Specifies the target environment.
    • [MANIFEST_PATH]: Path to your service definition file (e.g., molnett.yaml). Defaults to ./molnett.yaml.
    • Shows a diff and asks for confirmation unless --no-confirm is used.
  • molnctl logs --environment <ENV_NAME> [MANIFEST_PATH]
    • Streams logs for the first service defined in the specified/default molnett.yaml from the given environment.
    • --environment <ENV_NAME>: (Required) Specifies the environment.
    • [MANIFEST_PATH]: Defaults to ./molnett.yaml.
    • (Placeholder: Can a service name be specified directly if not using a manifest, or to target a specific service in a multi-service manifest?)
  • molnctl initialize [-s, --manifest <PATH>] (also available as molnctl services initialize)
    • Interactively helps generate a Dockerfile (TBC) and a Molnett service manifest (molnett.yaml).
    • --manifest <PATH>: Specifies the output path for the manifest, defaults to ./molnett.yaml.

Service Subcommands (molnctl services ..., alias: svcs)

  • molnctl services list --env <ENV_NAME>
    • Lists all services within the specified environment of the current project.
  • molnctl services delete <service-name> --env <ENV_NAME> [--no-confirm]
    • Deletes a specific service from the environment after confirmation.
  • molnctl services image-name ...
    • Helps in constructing or updating image names in manifests for the Molnett registry. Contains further sub-options like --service, --container, --tag, --update-manifest, --image-name. (Primarily for manifest updates or specific image name generation for a service).
  • (Placeholder: How to get details/status of a specific deployed service? e.g., molnctl services get <name> --env <name>?)

Secrets Management (molnctl secrets ...)

Securely manage sensitive data like API keys and passwords for your environments.

  • molnctl secrets list --env <ENV_NAME>
    • Lists secret names in the specified environment of the current project.
    • Requires --env <ENV_NAME>.
  • molnctl secrets create <secret-name> --env <ENV_NAME> [--stdin]
    • Creates a new secret in the specified environment.
    • Requires --env <ENV_NAME>.
    • Prompts for the secret value unless --stdin is used to pipe it.
  • molnctl secrets delete <secret-name> --env <ENV_NAME> [--no-confirm]
    • Deletes a secret from the specified environment after confirmation.
    • Requires --env <ENV_NAME>.

Configuration File

molnctl stores its configuration (including login tokens and defaults for tenant/project) in $HOME/.config/molnett/config.json by default. This path can be overridden with the global --config option or the MOLNETT_CONFIG environment variable.