Skip to content

Deploy Baremetal

Deploy Bare Metal — mvp.deploy_baremetal

Cluster: Core Infrastructure | Type: component | MCP Tools: 13

Overview

SSH-based bare-metal deployment provider that transfers container images and manages services on physical or virtual hosts without a cloud orchestrator. Copies images over SSH, generates systemd unit files for automatic restart, and optionally delegates container runtime to Docker or Podman on the remote host. Follows the shared InfraTarget protocol so it integrates seamlessly with the cicd pipeline.

MVP bare-metal scope

deploy_baremetal is useful for the launch-plan target of a single VPS or bare-metal host managed over SSH with Docker, systemd, and passwordless non-interactive sudo already configured for the deployment user. It does not provide multi-host orchestration, database migration rollback, blue-green traffic switching, automatic DNS/TLS setup, backups, or a managed monitoring stack. Before using it with customers, run a clean-host smoke test from image transfer through systemctl is-active and verify your .env, database, Redis, Stripe, SMTP, DNS, TLS, backup, and observability setup separately.

Remote capability discovery

Use the MCP remote_preflight operation before deploy to surface the target host's required capabilities (sudo -n, Docker/Podman, systemd, disk headroom, port availability, install directory writability, env-file presence when configured, architecture, and runtime version). A blocked remote preflight means the host is not constraint-complete enough for deployment; fix the reported capability gaps before transferring an image or installing a unit.

When to use:

  • Deploying a G6 base to an on-premise server or edge device over SSH
  • Generating a systemd service unit for reliable container restart on bare metal
  • Automating environment-file injection into a remote server without a cloud secret manager

Example:

from mvp.deploy_baremetal import BareMetalBlock, BareMetalInput, BareMetalConfig
from mvp.deploy_core.schema import ImageSpec, DeployTarget

block = BareMetalBlock(name="baremetal")
result = block.infer(BareMetalInput(
    op="deploy",
    image=ImageSpec(name="g6-rest", tag="latest"),
    target=DeployTarget(provider="baremetal", host="192.168.1.100"),
    config=BareMetalConfig(user="deploy", ssh_key="/home/ci/.ssh/id_ed25519"),
))
# result.ok → True; result.value.stage → "deploy"

Works well with: deploy_core, deploy_docker, cicd

Public API

BareMetalBlock(AIBlock[BareMetalInput, DeployResult, None])

Field Type Default
name str 'baremetal'

Methods:

infer(data: BareMetalInput) -> Result[DeployResult]

BareMetalConfig

SSH deployment configuration.

Field Type Default
user str 'deploy'
ssh_key str ''
ssh_port int 22
install_dir str '/opt/g6'
restart_policy str 'on-failure'
remote_docker_socket str ''
env_file_remote_path str ''
insecure_ssh bool False
known_hosts_path str ''

BareMetalInput

Input for BareMetalBlock.infer().

Field Type Default
op str required
image ImageSpec field(default_factory=lambda: ImageSpec(name=''))
target DeployTarget field(default_factory=lambda: DeployTarget(provider='baremetal'))
runtime str 'docker'
config BareMetalConfig field(default_factory=BareMetalConfig)
run_mode str 'beta'
reviewer_signature str ''

BareMetalTarget

Constructor:

Parameter Type Default
dry_run bool False

Methods:

push_image(image: ImageSpec, target: DeployTarget | None = None, config: BareMetalConfig | None = None) -> DeployResult

push_image is a no-op — image transfer happens in deploy() which has target.host.

deploy(image: ImageSpec, target: DeployTarget, config: BareMetalConfig | None = None) -> DeployResult

Full bare-metal deploy: transfer image → scp unit file → enable service → wait_healthy.

wait_healthy(image: ImageSpec, target: DeployTarget, config: BareMetalConfig | None = None) -> DeployResult

Poll systemctl is-active until active or timeout.

status(target: DeployTarget, image: ImageSpec | None = None, config: BareMetalConfig | None = None) -> DeployResult

Check systemctl status for a specific service or all g6 services.

teardown(target: DeployTarget, image: ImageSpec | None = None, config: BareMetalConfig | None = None) -> DeployResult

Stop and disable a specific systemd service (or all g6 services as fallback).

Functions

generate_systemd_unit(image: ImageSpec, target: DeployTarget, runtime: str = 'docker', restart_policy: str = 'on-failure') -> str

generate_unit(image: ImageSpec, target: DeployTarget, config: 'BareMetalConfig | None' = None, runtime: str = 'docker') -> str

Generate a systemd unit file with named container + secrets injection.

MCP Tools

Operation Source
ops deploy_baremetal_mcp
help deploy_baremetal_mcp
push_image deploy_baremetal_mcp
deploy deploy_baremetal_mcp
status deploy_baremetal_mcp
teardown deploy_baremetal_mcp
preflight deploy_baremetal_mcp
remote_preflight deploy_baremetal_mcp
list_strategies deploy_baremetal_mcp
assess_preflight_readiness deploy_baremetal_mcp
explain_ssh_policy deploy_baremetal_mcp
explain_target_scope deploy_baremetal_mcp
list_patterns deploy_baremetal_mcp