Metadata-Version: 2.4
Name: privatecloud
Version: 0.8.0
Summary: PrivateCloud: one-command installer for a Kubernetes-based private cloud (k3s + monitoring + ingress + storage).
Author: Kubenew
License: MIT
Project-URL: Homepage, https://github.com/Kubenew/PrivateCloud
Project-URL: Repository, https://github.com/Kubenew/PrivateCloud
Keywords: private-cloud,kubernetes,k3s,installer,terraform,ansible,helm
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Topic :: System :: Systems Administration
Classifier: Topic :: Internet :: WWW/HTTP
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typer>=0.12.0
Requires-Dist: rich>=13.0.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pyyaml>=6.0.0
Requires-Dist: jinja2>=3.1.0
Requires-Dist: requests>=2.31.0
Requires-Dist: flask>=2.2.0
Requires-Dist: packaging>=23.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: build>=1.0.0; extra == "dev"
Requires-Dist: twine>=4.0.0; extra == "dev"
Dynamic: license-file

# PrivateCloud

[![PyPI Version](https://img.shields.io/pypi/v/privatecloud)](https://pypi.org/project/privatecloud/)
[![Python Versions](https://img.shields.io/pypi/pyversions/privatecloud)](https://pypi.org/project/privatecloud/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Tests](https://github.com/Kubenew/privatecloud/actions/workflows/ci.yml/badge.svg)](https://github.com/Kubenew/privatecloud/actions/workflows/ci.yml)
[![Downloads](https://pepy.tech/badge/privatecloud)](https://pepy.tech/project/privatecloud)
[![Docker Pulls](https://img.shields.io/docker/pulls/privatecloud/cli)](https://hub.docker.com/r/privatecloud/cli)

**PrivateCloud** is a Python CLI installer that provisions a Kubernetes-based private cloud stack.

It focuses on **fast deployment**, **repeatable infrastructure**, and **production-ready defaults**.

---

## Features Overview (v0.8.0)

### Deployment
- **Provider abstraction** — bare-metal SSH, Proxmox VE, or HPE Morpheus VM Essentials via Terraform
- **Terraform runner** — generates, applies, and destroys infrastructure automatically
- **Config auto-write** — Terraform outputs (node IPs) written back to `privatecloud.yaml`
- **Helm-based service installation** — all services deployed via Helm charts

### Cluster Management
- **Cluster upgrade** — `privatecloud upgrade v1.30.0+k3s1`
- **Multi-cluster** — manage multiple clusters with `cluster list/add/switch/remove`
- **HA setup** — high availability with multiple masters
- **Add-on marketplace** — one-command install of common tools

### Backup & Restore
- **Local backups** — full cluster state to `backups/` directory
- **Encrypted backups** — age encryption with `--encrypt`
- **Cloud storage** — S3, GCS, Azure Blob integration
- **Scheduled backups** — cron/systemd timers with `backup schedule`
- **etcd snapshots** — `backup create --etcd-snapshot`
- **Longhorn PITR** — snapshots and point-in-time restore

### Security
- **GUI authentication** — `--auth` flag with env var credentials
- **Secret masking** — tokens/passwords masked in logs
- **Environment variables** — `${VAR}` syntax for secrets
- **Auto .gitignore** — prevents accidental secret commits

### GUI Dashboard
- **Web UI** — `privatecloud gui --port 8080`
- **Cluster metrics** — nodes, pods, health status
- **One-click actions** — backup, restore, destroy

### Operations
- **Diagnostics** — `privatecloud doctor --diagnostics`
- **Configuration linting** — `privatecloud lint`
- **Release notes** — `privatecloud release-notes`

---

## Requirements

| Tool | Required |
|------|----------|
| Python 3.9+ | ✅ |
| ssh / scp | ✅ |
| curl | ✅ |
| terraform | ✅ |
| helm | ✅ |
| kubectl | optional |
| flask | for GUI |
| age | for backup encryption |

---

## Install

```bash
pip install privatecloud
```

---

## Quickstart

```bash
# Initialize
privatecloud init                      # generate privatecloud.yaml
privatecloud doctor --diagnostics      # check dependencies and cluster health
privatecloud lint                      # validate config

# Deploy
privatecloud plan                      # preview the install plan
privatecloud install-cluster           # deploy everything
privatecloud install-cluster --dry-run # preview without changes

# Manage
privatecloud gui --port 8080           # start web dashboard
privatecloud upgrade v1.30.0+k3s1     # upgrade cluster
privatecloud cluster list              # list managed clusters

# Backup & Restore
privatecloud backup create                         # create backup
privatecloud backup create --encrypt              # encrypted backup
privatecloud backup create --s3 my-bucket        # upload to S3
privatecloud backup create --etcd-snapshot       # include etcd
privatecloud backup schedule daily --keep 7       # schedule backups
privatecloud backup list                          # list backups
privatecloud backup restore <name>               # restore backup
privatecloud backup restore <name> --force       # force restore

# Snapshots & PITR
privatecloud snapshot my-volume                   # create snapshot
privatecloud snapshots-list                      # list all snapshots
privatecloud restore my-volume snap-123          # restore from snapshot

# Add-ons
privatecloud addon list                           # list available add-ons
privatecloud addon install monitoring-stack       # install add-on
privatecloud addon search logging                 # search add-ons

# Destroy
privatecloud destroy                             # with backup prompt
privatecloud destroy --yes                        # skip confirmation
```

---

## Configuration

```yaml
cluster_name: my-private-cloud
provider: bare-metal          # or "proxmox" or "morpheus"
k3s_version: v1.29.0+k3s1

nodes:
  - host: 192.168.1.10
    user: root
    role: master
  - host: 192.168.1.11
    user: root
    role: worker

proxmox:
  url: https://192.168.1.100:8006/api2/json
  token_id: root@pam!mytoken
  token_secret: "${PROXMOX_TOKEN}"  # Use env var for secrets
  node: pve
  template: ubuntu-2204-template
  master_count: 1
  worker_count: 2

# morpheus:
#   url: https://morpheus.example.com
#   username: admin
#   password: ${MORPHEUS_PASSWORD}
#   group_name: My Group
#   cloud_name: My Cloud
#   instance_type_name: Ubuntu
#   layout_name: VMware VM
#   plan_name: 1 CPU, 2GB Memory
#   master_count: 1
#   worker_count: 2
#   cloud_type: vmware

services:
  metallb: true
  ingress_nginx: true
  cert_manager: true
  monitoring: true
  longhorn: true
```

---

## Provider Modules Roadmap

| Provider | Status | Description |
|----------|--------|-------------|
| Bare-metal | ✅ Stable | Direct SSH installation |
| Proxmox | ✅ v0.2.0 | Proxmox VE via Terraform |
| HPE Morpheus | ✅ v0.8.0 | HPE Morpheus VM Essentials via Terraform |
| Hetzner | 🔜 v0.7.0 | Hetzner Cloud API |
| LibVirt | 🔜 v0.7.0 | Local KVM/libvirt VMs |
| vSphere | 📋 Backlog | VMware vSphere integration |
| OpenStack | 📋 Backlog | OpenStack integration |

---

## Roadmap

### v0.7.0
- [ ] Hetzner Cloud provider
- [ ] LibVirt/KVM provider  
- [ ] Cluster backup verification
- [ ] Rollback from failed upgrade

### v1.0 (Production Ready)
- [ ] High-availability k3s with external DB
- [ ] Rolling cluster upgrades
- [ ] Multi-cluster management UI
- [ ] Add-on marketplace with 20+ tools
- [ ] Cloud storage backup with lifecycle policies

---

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) for development guidelines.

## License

MIT
