Metadata-Version: 2.4
Name: smax-scripts
Version: 1.0.0
Summary: End-to-end deployment automation for OpenText SMAX/OBM/BVD on Proxmox, vSphere, and bare-metal
License: MIT
Project-URL: Homepage, https://github.com/mostafa-fawzy91/SMAX-Scripts
Project-URL: Documentation, https://mostafa-fawzy91.github.io/SMAX-Scripts
Project-URL: Repository, https://github.com/mostafa-fawzy91/SMAX-Scripts
Project-URL: Issues, https://github.com/mostafa-fawzy91/SMAX-Scripts/issues
Keywords: opentext,smax,itom,deployment,automation,proxmox,kubernetes,omt
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: System :: Systems Administration
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: proxmoxer>=2.0.1
Requires-Dist: requests>=2.31.0
Requires-Dist: paramiko>=3.4.0
Requires-Dist: kubernetes>=29.0.0
Requires-Dist: jinja2>=3.1.4
Requires-Dist: pyyaml>=6.0.1
Requires-Dist: urllib3>=2.2.0
Requires-Dist: pyVmomi>=8.0.2
Provides-Extra: server
Requires-Dist: fastapi>=0.111.0; extra == "server"
Requires-Dist: uvicorn[standard]>=0.30.0; extra == "server"
Requires-Dist: aiofiles>=23.2.1; extra == "server"
Requires-Dist: websockets>=12.0; extra == "server"

# SMAX-Scripts

End-to-end deployment automation for OpenText ITOM suites (SMAX, OBM, BVD) on on-premise infrastructure — Proxmox VE, VMware vSphere, and bare-metal.

> **Demo GIF** — record `docs/assets/demo.gif` (Phase 3 OMT → Phase 6 Suite, 30 seconds, OBS/Kap) and embed it here.

---

## Install

```bash
# CLI reconciler (headless — run against an existing deployment.yaml)
pip install smax-scripts
smax-scripts --help
```

```bash
# Wizard UI + WebSocket cockpit (Docker — full server mode)
docker run -p 8080:8080 \
  -v $(pwd)/deployment.yaml:/app/deployment.yaml \
  -v $(pwd)/deployment.state.json:/app/deployment.state.json \
  --env-file .secrets.env \
  ghcr.io/mostafa-fawzy91/smax-scripts:latest
# open http://localhost:8080/
```

> **Linux:** Container runs as UID 1000. Add `--user $(id -u):$(id -g)` if host files are a different UID.

---

## What it does

OpenText provides cloud deployment toolkits for AWS/Azure/GCP. Nothing exists for on-premise. This fills that gap.

A 6-phase wizard generates a `deployment.yaml` manifest. An idempotent Python reconciler reads the manifest and executes each phase in sequence — surviving reboots, partial failures, and air-gapped environments.

```
deployment.yaml  →  reconciler.py  →  running SMAX cluster
  (manifest)         (executor)
```

| Phase | What it does |
|-------|-------------|
| 1 — VM Provisioning | Creates VMs on Proxmox / vSphere with correct CPU/RAM/storage per sizing matrix |
| 2 — OS Preparation | Configures RHEL 9 nodes via SSH: sysctl, swap, packages, firewall |
| 3 — OMT Bootstrap | Generates `install.properties`, validates DNS, bootstraps OMT/Kubernetes, HAProxy + Keepalived |
| 4 — Image Mirroring | Mirrors suite images to local Harbor — online pull or offline tar bundle |
| 5 — Storage (PV/PVC) | Creates PersistentVolumes and PVCs via the Kubernetes SDK |
| 6 — Suite Deployment | `cdfctl runlevel UP`, monitors pods to Running, validates HTTPS endpoint |

---

## Supported configurations

**Suites:** SMAX · ESM · BVD · OBM  
**Deployment sizes:** Evaluation · Small · Medium · Large  
**Virtualization:** Proxmox VE (full) · VMware vSphere · Bare-metal  
**OS:** RHEL 9.x · Rocky Linux 9.x  
**Storage:** NFS (full) · NetApp · Ceph  

---

## Quick start

```bash
# 1. Install
pip install smax-scripts

# 2. Create deployment.yaml (wizard generates this — or copy the example)
cp deployment.yaml.example deployment.yaml
# edit deployment.yaml

# 3. Load credentials
cp .secrets.env.example .secrets.env
# edit .secrets.env
source .secrets.env

# 4. Run all phases
smax-scripts --manifest deployment.yaml

# Run a single phase
smax-scripts --manifest deployment.yaml --phase phase3_omt

# Check state
smax-scripts --manifest deployment.yaml --status

# Reset a failed phase and retry
smax-scripts --manifest deployment.yaml --reset phase3_omt
smax-scripts --manifest deployment.yaml --phase phase3_omt
```

**Credentials are NEVER stored in the manifest** — they are read from environment variables (see `.secrets.env.example`). The manifest is safe to commit to git.

---

## Deployment manifest

```yaml
version: "1.0"

target:
  provider: proxmox        # proxmox | vsphere | bare_metal
  suite: smax              # smax | esm | bvd | obm
  suite_version: "24.4"
  deployment_size: small   # evaluation | small | medium | large

infrastructure:
  master_nodes:
    - hostname: "master1.example.com"
      ip: "10.0.0.11"
  worker_nodes:
    - hostname: "worker1.example.com"
      ip: "10.0.0.21"
  virtual_ip: "10.0.0.100"
  lb_type: internal        # internal = HAProxy + Keepalived provisioned automatically

os:
  type: rhel9
  local_repo_url: "http://10.0.0.50/repo"   # omit for internet-connected nodes

registry:
  local_url: "harbor.internal:5000"
  offline_bundle_path: ""   # set for fully air-gapped environments

storage:
  type: nfs
  server: "10.0.0.60"
  export_path: "/exports/smax"
  uid: 1999
  gid: 1999
```

---

## Rollback

Every phase implements `rollback()`. Use `--rollback` to undo provisioned resources and reset state:

```bash
smax-scripts --manifest deployment.yaml --rollback phase3_omt
```

| Phase | Rollback behaviour |
|-------|--------------------|
| `phase1_vm` | Deletes VMs on Proxmox or vSphere; no-op for bare-metal |
| `phase2_os` | Re-enables swap; restores backed-up `.repo` files |
| `phase3_omt` | Runs OMT `uninstall.sh` on primary master |
| `phase4_images` | Deletes pushed images from Harbor via API |
| `phase5_storage` | Deletes PVs and PVCs from the cluster |
| `phase6_suite` | Brings runlevel DOWN; removes suite ConfigMap |

---

## Air-gapped deployments

Set `os.local_repo_url` in the manifest for offline OS packages. For container images:

```bash
# On a connected machine — export suite images to a tar bundle
python reconciler/phases/phase4_images.py --export \
  --manifest deployment.yaml --output smax-24.4-images.tar

# Transfer bundle, then in deployment.yaml:
#   registry.offline_bundle_path: "/path/to/smax-24.4-images.tar"
```

See [Air-Gapped Deployments](https://mostafa-fawzy91.github.io/SMAX-Scripts/air-gap/) for the full workflow.

---

## Development

```bash
git clone https://github.com/mostafa-fawzy91/SMAX-Scripts.git
cd SMAX-Scripts
pip install -r requirements.txt

# Run tests
pytest tests/ -q

# Server mode
python run_server.py
# open http://localhost:8080/
```

---

## Docs

Full documentation: **https://mostafa-fawzy91.github.io/SMAX-Scripts**

---

## Roadmap

- [x] Phase 1 — Static wizard + idempotent reconciler
- [x] Phase 2 — FastAPI server + WebSocket live cockpit
- [x] Phase 2 — vSphere `phase1_vm.py` full implementation (pyVmomi, template clone)
- [x] Phase 2 — Per-phase rollback (`--rollback`)
- [x] Phase 2 — Sub-step granularity in state file (`_steps` in `deployment.state.json`)
- [x] Phase 2 — Cluster discovery / import (`/api/discover`)
- [x] Phase 3 — PyPI package (`pip install smax-scripts`)
- [x] Phase 3 — Docker image (`ghcr.io/mostafa-fawzy91/smax-scripts`)
- [x] Phase 3 — GitHub Pages docs site
- [x] Phase 4 — NetApp / Ceph storage backends (dynamic PVC via Trident CSI / Rook CSI)
- [x] Phase 4 — RKE2 / OpenShift OMT deployment mode (`--existing-k8s` / `--openshift` flags)
- [x] Phase 4 — Suite upgrade workflow (`smax-scripts --upgrade TARGET_VERSION`) (current → next version)
