storctl

command module
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2025 License: MIT Imports: 2 Imported by: 0

README

storctl - AIStor Environment Manager

storctl is a command-line tool for managing demo and lab environments in cloud infrastructure or on the local host using virtual machines. The main focus of this tool is on MinIO AIStor testing, training, and demonstration.

Features

  • Create and manage lab environments with multiple servers and volumes
  • Manage DNS records with Cloudflare
  • Use Lima virtual machines on macOS or Hetzner Cloud infrastructure (currently)
  • Manage SSH keys to access cloud VMs
  • Manage cloud resource lifecycle with TTL (Time To Live)
  • Use YAML-based configuration and resource definitions similar to Kubernetes

Installation

Prerequisites
  • Go 1.23 or later
  • If using Lima:
    • Lima installed on your macOS (via Homebrew)
    • 16 GB RAM min, 32 GB preferred
  • If using cloud:
    • A Hetzner Cloud account and API token
    • A Cloudflare account and API token (for DNS management)
Using released binaries

Download binaries for your OS/arch from the Releases page.

Building from source
git clone https://github.com/pavelanni/storctl
cd storctl
go build .

Configuration

  1. Initialize the configuration:
storctl init

This creates a default configuration directory at ~/.storctl with the following structure:

  • config.yaml -- Main configuration file
  • templates/ -- Lab environment templates
  • keys/ -- SSH key storage
  • ansible/ -- for Ansible playbooks and inventory files
  • lima/ -- for Lima configs
  1. Edit the configuration file at ~/.storctl/config.yaml:
providers:
  - name: "hetzner"
    token: "your-hetzner-token"
    location: "nbg1" # EU locations: nbd1, fsn1, hel1; US locations: ash, hil; APAC locations: sin
  - name: "lima"

dns:
  provider: "cloudflare"
  token: "your-cloudflare-token"
  zone_id: "your-zone-id"
  domain: "aistorlabs.com" # feel free to use your own domain

email: "your-email@example.com"
organization: "your-organization"
owner: "your-name"

Usage

Basic Commands
# View current configuration
storctl config view

# Create a new lab environment
storctl create lab mylab --template lab-edge.yaml

# List all labs
storctl get lab

# Get details about a specific lab
storctl get lab mylab

# Delete a lab
storctl delete lab mylab

# Create a new SSH key
storctl create key mykey

# Create a new server
storctl create server myserver

# Create a new volume
storctl create volume myvolume
Using resource YAML files

You can also create resources using YAML definition files:

storctl create -f lab.yaml
storctl create -f server.yaml
storctl create -f volume.yaml
Resource templates

Example lab template:

apiVersion: v1
kind: Lab
metadata:
  name: aistor-lab
  labels:
    project: aistor
spec:
  ttl: 24h
  provider: hetzner
  location: nbg1
  servers:
  - name: cp
    serverType: cx22
    image: ubuntu-24.04
  - name: node-01
    serverType: cx22
    image: ubuntu-24.04
volumes:
  - name: volume-01
    server: node-01
    size: 100
    automount: false
    format: xfs

Resource management

All resources support:

  • Labels for organization and filtering
  • TTL (Time To Live) for automatic cleanup
  • Provider-specific configurations
  • YAML/JSON manifest files

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package assets contains the assets that are embedded in the storctl tool.
Package assets contains the assets that are embedded in the storctl tool.
Package cmd contains all commands for the storctl tool.
Package cmd contains all commands for the storctl tool.
internal
config
Package config contains the configuration for the storctl tool.
Package config contains the configuration for the storctl tool.
dns
Package dns contains the DNS provider for the storctl tool.
Package dns contains the DNS provider for the storctl tool.
lab
Package lab contains the lab manager for the storctl tool.
Package lab contains the lab manager for the storctl tool.
logger
Package logger contains the logger for the storctl tool.
Package logger contains the logger for the storctl tool.
provider
Package provider contains the factory for the cloud and local providers.
Package provider contains the factory for the cloud and local providers.
provider/hetzner
Package hetzner contains the Hetzner implementation of the provider interface for the storctl tool.
Package hetzner contains the Hetzner implementation of the provider interface for the storctl tool.
provider/lima
Package lima contains the Lima implementation of the provider interface for the storctl tool.
Package lima contains the Lima implementation of the provider interface for the storctl tool.
provider/mock
Package mock contains the mock implementation of the provider interface for the storctl tool.
Package mock contains the mock implementation of the provider interface for the storctl tool.
provider/options
Package options contains the options for the provider.
Package options contains the options for the provider.
ssh
Package ssh provides functions to manage local SSH keys.
Package ssh provides functions to manage local SSH keys.
types
Package types contains the types for the storctl tool.
Package types contains the types for the storctl tool.
util/labelutil
Package labelutil contains the functions to sanitize and merge labels.
Package labelutil contains the functions to sanitize and merge labels.
util/output
Package output contains the functions to format and write data to the console.
Package output contains the functions to format and write data to the console.
util/serverchecker
Package serverchecker contains the functions to check if a cloud server is ready.
Package serverchecker contains the functions to check if a cloud server is ready.
util/timeutil
Package timeutil contains the functions to parse and format time.
Package timeutil contains the functions to parse and format time.
version
Package version contains version information for the application.
Package version contains version information for the application.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL