A command-line interface tool for managing HostSpace Cloud services
Project description
HostSpace CLI
A command-line interface tool for managing HostSpace Cloud services, including Kubernetes (HKE), Containers (HCS), and Database (HDS) services.
Overview
HostSpace CLI provides a unified interface to manage your cloud resources across multiple infrastructure providers. It simplifies the management of:
- HostSpace Kubernetes Engine (HKE)
- HostSpace Container Service (HCS)
- HostSpace Database Service (HDS)
Architecture
graph TD
CLI[HostSpace CLI] --> Auth[Authentication Module]
CLI --> Config[Configuration Manager]
Auth --> API[HostSpace API Client]
Config --> API
API --> HKE[HKE Service]
API --> HCS[HCS Service]
API --> HDS[HDS Service]
HKE --> Providers[Infrastructure Providers]
HCS --> Providers
HDS --> Providers
Providers --> Contabo[Contabo]
Providers --> Nobus[Nobus]
Providers --> DO[Digital Ocean]
Providers --> GCP[Google Cloud]
Providers --> AWS[AWS]
Providers --> Others[Other Providers]
Key Components
-
CLI Core
- Command parser and router
- Error handling and logging
- Output formatting (JSON, YAML, Table)
-
Authentication Module
- Token-based authentication
- API key management
- Session handling
-
Configuration Manager
- User preferences
- Provider configurations
- Environment management
-
Service Modules
- HKE module for Kubernetes operations
- HCS module for container management
- HDS module for database operations
Installation
Quick Installation (Recommended)
# Install from Git repository
pip install git+https://github.com/hostspace/hostspace-cli.git
Development Installation
# Clone the repository
git clone https://github.com/hostspace/hostspace-cli.git
cd hostspace-cli
# Install development dependencies
pip install -e ".[dev]"
After installation, verify that the CLI is working:
# Check available commands
hs --help
# Set up your environment (default is production)
hs env show
# Switch to development environment if needed
hs env set development
# Login with your API key
hs auth login
Environment Management
The CLI supports both production and development environments. You can switch between them using:
# Show current environment
hs env show
# Switch to development environment
hs env set development
# Switch to production environment
hs env set production
Environment Configuration
- Production: Uses
https://aether-api.hostspacecloud.com - Development: Uses
https://aether-api-dev.hostspacecloud.com
Basic Usage
# Authentication
hs auth login
hs auth logout
hs auth status
# Kubernetes (HKE) Operations
hs hke cluster list
hs hke cluster create
hs hke cluster delete <cluster-id>
hs hke node-pool add <cluster-id>
# Container Service (HCS) Operations
hs hcs app list
hs hcs app deploy
hs hcs app logs <app-id>
hs hcs app delete <app-id>
# Database Service (HDS) Operations
hs hds instance list
hs hds instance create
hs hds backup create <instance-id>
hs hds backup list <instance-id>
Configuration
The CLI uses a configuration file located at ~/.hostspace/config.yaml:
auth:
api_key: "your-api-key"
endpoint: "https://aether-api.hostspacecloud.com"
providers:
default: "contabo"
regions:
- name: "us-east"
provider: "digital-ocean"
- name: "eu-central"
provider: "contabo"
output:
format: "table" # or json, yaml
color: true
Development Guide
Project Structure
hostspace-cli/
├── README.md
├── setup.py
├── requirements/
│ ├── prod.txt # Production dependencies
│ └── dev.txt # Development dependencies
├── hostspace/
│ ├── __init__.py
│ ├── cli.py
│ ├── env_commands.py # Environment management
│ ├── auth/
│ │ ├── __init__.py
│ │ └── commands.py
│ ├── hke/
│ │ ├── __init__.py
│ │ └── commands.py
│ ├── hcs/
│ │ ├── __init__.py
│ │ └── commands.py
│ ├── hds/
│ │ ├── __init__.py
│ │ └── commands.py
│ └── utils/
│ ├── __init__.py
│ ├── config.py
│ └── api.py
└── tests/
└── ...
Getting Started with Development
- Clone the repository:
git clone https://github.com/hostspace/hostspace-cli.git
cd hostspace-cli
- Install development dependencies:
pip install -e ".[dev]"
- Run tests:
pytest
- Format code:
black .
isort .
Publishing to PyPI
Automated Publishing (Recommended)
When you create a new release on GitHub, the package will be automatically published to PyPI.
-
First-time setup:
- Go to repository Settings > Secrets and Variables > Actions
- Add
HOSTSPACE_API_KEYsecret with your API key for testing
-
To publish a new version:
- Update version in
pyproject.toml - Create a new release on GitHub:
- Tag:
v0.1.0(use semantic versioning) - Title: "Release v0.1.0"
- Description: Add release notes
- Tag:
- GitHub Actions will automatically:
- Build the package
- Run tests in both environments:
- Development:
https://aether-api-dev.hostspacecloud.com - Production:
https://aether-api.hostspacecloud.com
- Development:
- Publish to PyPI
- Update version in
Manual Publishing
For manual publishing (requires PyPI access):
# Install build tools
pip install build twine
# Build distribution
python -m build
# Upload to PyPI (you'll need a PyPI token)
export TWINE_USERNAME=__token__
export TWINE_PASSWORD=your-pypi-token
python -m twine upload dist/*
Note: Contact your team lead for:
- PyPI access token
- API endpoints:
- Production:
https://aether-api.hostspacecloud.com - Development:
https://aether-api-dev.hostspacecloud.com
- Production:
- Required API keys for testing
Version Management
When releasing a new version:
- Update the version in
pyproject.toml - Create and push a git tag:
git tag v0.1.0 # Use appropriate version
git push origin v0.1.0
- Build and publish:
python -m build
python -m twine upload dist/*
Contributing
We welcome contributions! Please see our Contributing Guide for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hostspace_cli-0.1.1.tar.gz.
File metadata
- Download URL: hostspace_cli-0.1.1.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c3edc56000ee2440aede5630722ec0c2f3cec3a461ed2682569e489be822404
|
|
| MD5 |
c348fbfab3bf1e0a2fefd7cf8e82fca7
|
|
| BLAKE2b-256 |
bd5260682127d578907734c0797a55c32023112823511741cb1901cd187d9e64
|
File details
Details for the file hostspace_cli-0.1.1-py3-none-any.whl.
File metadata
- Download URL: hostspace_cli-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b4156f68716bd36cfd7694ea80ec989472052647fa9eca487f7c5e89086a138
|
|
| MD5 |
a368e14378463d41107c70b5a7213bd4
|
|
| BLAKE2b-256 |
970fdce06967d8325bda811ee378404bd04555749256d24cf2b6e18dcab5b20a
|