AI Decision System
Replayable, offline-verifiable records for AI-assisted go/no-go decisions: experiment promotions, typed model answers and human-approved actions.
翻譯準備中
正在確認登入狀態。
統一的指令列介面,支援 Proxmox、LXC 與 Docker。
AI 翻譯
Unified command line interface for Proxmox, LXC and Docker.
取自儲存庫 README
正在載入完整 README。 以下為已儲存的摘錄。
Complete documentation is published on GitHub Pages.
LWS is a command-line interface (CLI) tool for managing LXC containers on Proxmox VE hosts. It performs common tasks - creating, starting, stopping, terminating, and managing LXC instances, as well as interacting with Proxmox hosts themselves - from a single command.
• Modular core: config/SSH/Proxmox/utility functions are extracted into lws_core/; the CLI command layer (lws.py) and the REST API (api.py) remain monolithic - see Architecture for the exact boundary
• REST API: programmatic access to LWS functiona檢視完整 README ↗Features • Installation • Documentation • Contributing
Complete documentation is published on GitHub Pages.
LWS is a command-line interface (CLI) tool for managing LXC containers on Proxmox VE hosts. It performs common tasks - creating, starting, stopping, terminating, and managing LXC instances, as well as interacting with Proxmox hosts themselves - from a single command.
Recent changes:
lws_core/; the CLI command layer (lws.py) and the REST API (api.py) remain monolithic - see Architecture for the exact boundaryapi.py)ui.html) for interacting with the API/api/v1/docslws (Linux Web Services) is an open-source CLI tool for managing Proxmox hosts, LXC containers, and Docker services within those containers, through a single command set executed locally or over SSH.
requires-python in pyproject.toml, and the CI matrix and the Docker image are checked against it. The published image ships 3.14.git clone https://github.com/fabriziosalmi/lws.git
cd lws
pip install -r requirements.txt
config.yaml with your Proxmox server details:regions:
eu-south-1:
availability_zones:
az1:
host: proxmox1.example.com
user: root
ssh_password: your_password
az2:
host: proxmox2.example.com
user: root
ssh_password: your_password
instance_sizes:
small:
memory: 512
cpulimit: 1
storage: local:8
medium:
memory: 1024
cpulimit: 2
storage: local:16
large:
memory: 2048
cpulimit: 4
storage: local:32
default_storage: local
default_network: vmbr0
use_local_only: false
chmod +x lws.py && alias lws='python3 /path/to/lws.py'
lws --version
lws px list
lws px status --region eu-south-1 --az az1
lws px clusters --region eu-south-1 --az az1
lws px backup /path/to/backup/directory --region eu-south-1 --az az1
lws px cluster-start --region eu-south-1 --az az1
lws px cluster-stop --region eu-south-1 --az az1
lws px cluster-restart --region eu-south-1 --az az1
lws px exec "free -m" --region eu-south-1 --az az1
lws px upload ./ubuntu-20.04-template.tar.gz ubuntu-20.04 --region eu-south-1 --az az1
lws lxc run --image-id local:vztmpl/ubuntu-20.04-standard_20.04-1_amd64.tar.gz --size small --count 3 --hostname web-server
lws lxc start 100 101 102
lws lxc stop 100 101 102
lws lxc reboot 100
lws lxc show 100
lws lxc show
lws lxc scale 100 --memory 2048 --cpulimit 2 --storage-size 32G
lws lxc status 100
lws lxc exec 100 "apt-get update"
lws lxc exec 100 "sh -c 'apt-get update && apt-get -y upgrade'"
The command runs in the container without a shell. For &&, | or
redirections, wrap it in sh -c '...' as in the second line.
lws lxc snapshot-add 100 snap1
lws lxc snapshots 100
lws lxc snapshot-rm 100 snap1
lws lxc net 100 tcp 80
lws lxc show-info 100
lws lxc show-public-ip 100
lws lxc clone 100 101 --full
lws lxc scale-check 100
lws lxc service status nginx 100
lws lxc service restart nginx 100
lws lxc health-check 100 --fix
lws lxc resources 100 --interval 5 --count 10
lws lxc report 100 --output json --file container_report.json
lws lxc backup-create 100 --download
lws lxc backup-restore 100 --backup-file /var/lib/vz/dump/vzdump-lxc-100-2026_10_10-02_00_00.tar.zst
lws app setup 100
lws app run 100 -- -d -p 80:80 nginx
lws app deploy install 100 --compose-file docker-compose.yml --auto-start
lws app update 100 docker-compose.yml
lws app logs 100 nginx --tail 100
lws app list 100
lws app remove 100 --purge
lws sec scan 100 --scan-type full
lws sec discovery 100
lws lxc scale-check <id> reads the scaling section of config.yaml and
prints suggested CPU core, memory and disk values for a container. It compares
what the container is allocated (pct config) with the host's total cores and
memory. Nothing runs automatically: apply a suggestion with lws lxc scale.
scaling:
lxc_cpu:
min_threshold: 0.30 # suggest more cores below 30% of the host's cores
max_threshold: 0.80 # suggest fewer above 80%
step: 1
scale_up_multiplier: 1.5
scale_down_multiplier: 0.5
lxc_memory:
min_threshold: 0.40
max_threshold: 0.70
step_mb: 256
scale_up_multiplier: 1.25
scale_down_multiplier: 0.75
limits:
min_cpu_cores: 1
max_cpu_cores: 4
min_memory_mb: 512
max_memory_mb: 8192
min_storage_gb: 10
max_storage_gb: 500
Thresholds are fractions between 0 and 1. The full description of the keys is in the configuration reference.
The API server provides HTTP access to LWS functions.
Set a real api_key in config.yaml. The server refuses to start while it's empty or still the placeholder — generate one with python3 -c 'import secrets; print(secrets.token_urlsafe(32))'.
Run the API server:
python3 api.py
By default it listens on 127.0.0.1:8080 (loopback only). Change api.host/api.port in config.yaml if you need it reachable elsewhere — see the Security Considerations below before binding to anything but loopback.
Interact with the API: Use tools like curl, Postman, or the provided Web UI. Remember to include the API key in the X-API-Key header for protected endpoints.
# Example: Health Check (no API key needed)
curl http://localhost:8080/api/v1/health
# Example: List LXC Instances (requires API key)
curl -H "X-API-Key: your-secure-api-key" http://localhost:8080/api/v1/lxc/instances
A simple web interface is provided to interact with the API.
api.py) is running.http://localhost:8080/). The API server serves ui.html directly.ui.html from disk (file:///.../ui.html) does not work: the page calls the API at a relative address.Interactive API documentation is available via Swagger UI.
api.py) is running./api/v1/docs relative to the API server's URL (e.g., http://localhost:8080/api/v1/docs).Secure Storage of Credentials:
sshpass) — there is no SSH key-based auth, and no environment-variable or vault indirection for ssh_password. Both are read as plain values straight out of config.yamlconfig.yaml as a credentials file: keep it out of version control (it is .gitignored — see config.yaml.example for the committed template) and don't reuse the passwords it holds elsewhereconfig.yaml (600 or 640)Network Security:
API Security:
Container Security:
lws sec scan regularly on your containers to detect security issuesInput Validation:
lxc run's free-text container-creation options (hostname, password, network config, DNS, lock) are validated against an allow-list, parsed as a real IP/CIDR, or shell-quoted for the remote command before being used - this closes the command-injection surface in the affected commands rather than attempting to escape it after the facthost/user/ssh_password come from config.yaml, which you control, and aren't user-supplied CLI input - see Secure Storage of Credentials above for how to protect that file insteadFile Security:
shlex.quote) on every CLI value known to reach a remote shell/sed/grep command, instead of escaping output after constructionhmac.compare_digest (timing-safe); the server refuses to start with an empty or placeholder keySSHPASS environment variable, never in argv, ps, or logsStrictHostKeyChecking=accept-new): a changed key for an already-known host is rejectedapi.py runs behind a production WSGI server (waitress) unless debug: true is explicitly set, and never enables Werkzeug's interactive debugger regardless of that settingui.html) renders API responses and error messages through textContent, not innerHTML, so a value reflected in a response cannot execute as markup in the viewer's browserlws lxc scale-check to get recommendations on optimal resource allocation.lws lxc backup-create to prevent data loss.lws lxc resources to monitor resource usage patterns.lws lxc health-check periodically to detect and fix issues.lws lxc report for documentation and auditing purposes.lws is an open-source, single-maintainer project. Issues, feature requests, and pull requests are welcome.
git checkout -b feature-branch
[!TIP] Include clear commit messages and documentation with your pull requests to make the review process smoother.
Unscheduled, not committed to a release:
MIT License. See LICENSE.