Files
praxis/scripts/proxmox/lxc-start.sh
T
Praxis CI bb17615f41 feat(P01): SLICE-03+04 — PVE API layer (8 scripts) + health-check
SLICE-03 (devops-engineer): ported from coreci/scripts/proxmox/:
  api.sh (verbatim), ct-exists.sh, lxc-clone.sh (4GB/16GB, hostname=praxis),
  lxc-config.sh (praxis env vars, praxis-firstboot.sh snippet), lxc-start.sh,
  stage-snippet.sh (G-101 FIX: bakes GITEA_TOKEN into snippet via sed),
  timing.sh (verbatim), rollback.sh (proxy code removed)
SLICE-04 (devops-engineer): health-check.sh adapted for /health:8789
  (G-104 FIX: timeout bumped 300s→600s for Docker build margin)

REQ-DEPLOY-03, 04, 05, 07, 08 covered.

---ci---
project: praxis
phase: 1
milestone: v0.2
status: execute
slice: 03-04
wave: 2
---/ci---
2026-08-01 14:18:23 +00:00

32 lines
796 B
Bash
Executable File

#!/bin/sh
# Praxis — Start a Proxmox LXC container and poll the async task.
#
# Env: PROXMOX_API_URL, PROXMOX_API_TOKEN, PROXMOX_NODE
# Args: $1 = VMID
# Exit: 0 on success, 1 on failure
set -eu
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
# shellcheck source=api.sh disable=SC1091
. "${SCRIPT_DIR}/api.sh"
pve_env PROXMOX_API_URL PROXMOX_API_TOKEN PROXMOX_NODE
vmid="${1:?usage: lxc-start.sh <vmid>}"
node="${PROXMOX_NODE}"
start_path="/nodes/${node}/lxc/${vmid}/status/start"
echo "lxc-start: starting VMID ${vmid}" >&2
upid=$(pve_curl POST "$start_path")
if [ -z "$upid" ] || [ "$upid" = "null" ]; then
echo "lxc-start: failed to start (empty UPID)" >&2
exit 1
fi
echo "lxc-start: polling start task ${upid}" >&2
pve_poll "$upid"
echo "lxc-start: VMID ${vmid} is running" >&2