Documentation
¶
Overview ¶
Package studio provides one-click AI development environment management across various container and VM platforms (WSL, Colima, AppleContainer, K8S, Docker).
Index ¶
- Constants
- func BuildContainerArgs(result *ContainerSetupResult) []string
- func FindActualLibraryFiles(cachePath string, vendor GPUVendor) []string
- func FormatContainerCommand(command []string) []string
- func GenerateBatchScript(config *GPUEnvConfig, paths *platform.Paths) (string, error)
- func GenerateContainerName(name string) string
- func GenerateEnvScript(config *GPUEnvConfig, paths *platform.Paths) (string, error)
- func GeneratePowerShellScript(config *GPUEnvConfig, paths *platform.Paths) (string, error)
- func GetLibraryNames(vendor GPUVendor) []string
- func GetWindowsLibraryNames(vendor GPUVendor) []string
- func IsDarwin() bool
- func IsLinux() bool
- func MergeEnvVars(setupEnvs, userEnvs map[string]string) map[string]string
- func NormalizeArch(arch string) string
- func SSHAuthorizedKeysPath(paths *platform.Paths, studioName string) string
- type AppleContainerBackend
- func (b *AppleContainerBackend) Create(ctx context.Context, opts *CreateOptions) (*Environment, error)
- func (b *AppleContainerBackend) Exec(ctx context.Context, envID string, cmd []string) ([]byte, error)
- func (b *AppleContainerBackend) Get(ctx context.Context, idOrName string) (*Environment, error)
- func (b *AppleContainerBackend) IsAvailable(ctx context.Context) bool
- func (b *AppleContainerBackend) List(ctx context.Context) ([]*Environment, error)
- func (b *AppleContainerBackend) Logs(ctx context.Context, envID string, follow bool) (<-chan string, error)
- func (b *AppleContainerBackend) Mode() Mode
- func (b *AppleContainerBackend) Name() string
- func (b *AppleContainerBackend) Remove(ctx context.Context, envID string) error
- func (b *AppleContainerBackend) Start(ctx context.Context, envID string) error
- func (b *AppleContainerBackend) Stop(ctx context.Context, envID string) error
- type Architecture
- type AutoStartableBackend
- type Backend
- type ColimaBackend
- func (b *ColimaBackend) Create(ctx context.Context, opts *CreateOptions) (*Environment, error)
- func (b *ColimaBackend) EnsureRunning(ctx context.Context) error
- func (b *ColimaBackend) Exec(ctx context.Context, envID string, cmd []string) ([]byte, error)
- func (b *ColimaBackend) Get(ctx context.Context, idOrName string) (*Environment, error)
- func (b *ColimaBackend) GetColimaIP(ctx context.Context) (string, error)
- func (b *ColimaBackend) GetProfile() string
- func (b *ColimaBackend) GetVMArch(ctx context.Context) string
- func (b *ColimaBackend) IsAvailable(ctx context.Context) bool
- func (b *ColimaBackend) IsInstalled(ctx context.Context) bool
- func (b *ColimaBackend) List(ctx context.Context) ([]*Environment, error)
- func (b *ColimaBackend) Logs(ctx context.Context, envID string, follow bool) (<-chan string, error)
- func (b *ColimaBackend) Mode() Mode
- func (b *ColimaBackend) Name() string
- func (b *ColimaBackend) Remove(ctx context.Context, envID string) error
- func (b *ColimaBackend) SetDockerHost(dockerHost string)
- func (b *ColimaBackend) Start(ctx context.Context, envID string) error
- func (b *ColimaBackend) Stop(ctx context.Context, envID string) error
- type ContainerSetupConfig
- type ContainerSetupResult
- type CreateOptions
- type DockerBackend
- func (b *DockerBackend) Create(ctx context.Context, opts *CreateOptions) (*Environment, error)
- func (b *DockerBackend) Exec(ctx context.Context, envID string, cmd []string) ([]byte, error)
- func (b *DockerBackend) Get(ctx context.Context, idOrName string) (*Environment, error)
- func (b *DockerBackend) GetHostArch(ctx context.Context) string
- func (b *DockerBackend) IsAvailable(ctx context.Context) bool
- func (b *DockerBackend) List(ctx context.Context) ([]*Environment, error)
- func (b *DockerBackend) Logs(ctx context.Context, envID string, follow bool) (<-chan string, error)
- func (b *DockerBackend) Mode() Mode
- func (b *DockerBackend) Name() string
- func (b *DockerBackend) Remove(ctx context.Context, envID string) error
- func (b *DockerBackend) Start(ctx context.Context, envID string) error
- func (b *DockerBackend) Stop(ctx context.Context, envID string) error
- type Environment
- type EnvironmentStatus
- type GPUEnvConfig
- type GPUEnvResult
- type GPUVendor
- type LibraryDownloader
- func (d *LibraryDownloader) Download(lib LibraryInfo) (string, error)
- func (d *LibraryDownloader) DownloadDefaultLibraries() ([]string, error)
- func (d *LibraryDownloader) DownloadURL(lib LibraryInfo) string
- func (d *LibraryDownloader) GetCacheDir() string
- func (d *LibraryDownloader) SetCacheDir(dir string)
- type LibraryInfo
- type Manager
- func (m *Manager) AddSSHConfig(env *Environment) error
- func (m *Manager) Create(ctx context.Context, opts *CreateOptions) (*Environment, error)
- func (m *Manager) Get(ctx context.Context, idOrName string) (*Environment, error)
- func (m *Manager) GetBackend(mode Mode) (Backend, error)
- func (m *Manager) List(ctx context.Context) ([]*Environment, error)
- func (m *Manager) ListAvailableBackends(ctx context.Context) []Backend
- func (m *Manager) RegisterBackend(backend Backend)
- func (m *Manager) Remove(ctx context.Context, idOrName string) error
- func (m *Manager) RemoveSSHConfig(envName string) error
- func (m *Manager) Start(ctx context.Context, idOrName string) error
- func (m *Manager) Stop(ctx context.Context, idOrName string) error
- type Mode
- type PortMapping
- type ResourceSpec
- type SSHConfig
- type StudioImage
- type VolumeMount
- type WSLBackend
- func (b *WSLBackend) Create(ctx context.Context, opts *CreateOptions) (*Environment, error)
- func (b *WSLBackend) EnsureSSHServer(ctx context.Context, envID string) error
- func (b *WSLBackend) Exec(ctx context.Context, envID string, cmd []string) ([]byte, error)
- func (b *WSLBackend) Get(ctx context.Context, idOrName string) (*Environment, error)
- func (b *WSLBackend) GetDistro(ctx context.Context) (string, error)
- func (b *WSLBackend) GetWSLIP(ctx context.Context) (string, error)
- func (b *WSLBackend) GetWSLStatus(ctx context.Context) *WSLStatus
- func (b *WSLBackend) IsAvailable(ctx context.Context) bool
- func (b *WSLBackend) List(ctx context.Context) ([]*Environment, error)
- func (b *WSLBackend) Logs(ctx context.Context, envID string, follow bool) (<-chan string, error)
- func (b *WSLBackend) Mode() Mode
- func (b *WSLBackend) Name() string
- func (b *WSLBackend) Remove(ctx context.Context, envID string) error
- func (b *WSLBackend) SetDistro(distro string)
- func (b *WSLBackend) Start(ctx context.Context, envID string) error
- func (b *WSLBackend) Stop(ctx context.Context, envID string) error
- type WSLStatus
Constants ¶
const ( SSHPortRangeMin = 12000 SSHPortRangeMax = 18000 )
SSH port range constants
const ( // CDN base URL for TensorFusion libraries DefaultCDNURL = "https://cdn.tensor-fusion.ai" // Library version - this would normally come from config DefaultLibVersion = "v1.0.0" )
const ( OSDarwin = "darwin" OSLinux = "linux" OSWindows = "windows" )
Platform constants for runtime.GOOS comparisons
const ( ArchX86_64 = "x86_64" ArchAarch64 = "aarch64" ArchAmd64 = "amd64" ArchArm64 = "arm64" )
Architecture constants for CPU architecture detection
const ( DefaultProtocolTCP = "tcp" MountOptionReadOnly = ":ro" DefaultImageStudioTorch = "tensorfusion/studio-torch:latest" DockerStateRunning = "running" DockerStateExited = "exited" DockerStateCreated = "created" DefaultHostLocalhost = "localhost" )
Docker-related constants
Variables ¶
This section is empty.
Functions ¶
func BuildContainerArgs ¶ added in v1.1.17
func BuildContainerArgs(result *ContainerSetupResult) []string
BuildContainerArgs builds common Docker/container run arguments from setup result This is a helper for backends that use docker-style CLI
func FindActualLibraryFiles ¶ added in v1.1.17
FindActualLibraryFiles scans the cache directory for actual GPU library files that should be preloaded. This handles cases where downloaded files have different names than the canonical library names.
func FormatContainerCommand ¶ added in v1.1.17
FormatContainerCommand formats the command slice for docker/container execution. If a single command string is passed that looks like a shell command (contains spaces or shell metacharacters), it wraps with "sh -c" to ensure proper shell interpretation. This handles cases like: -c "sh -c 'sleep 1d'" or -c "sleep 1d && echo done"
func GenerateBatchScript ¶ added in v1.1.7
func GenerateBatchScript(config *GPUEnvConfig, paths *platform.Paths) (string, error)
GenerateBatchScript generates a CMD batch script to set up the GPU environment
func GenerateContainerName ¶ added in v1.1.17
GenerateContainerName generates a unique container name with random suffix
func GenerateEnvScript ¶ added in v1.1.7
func GenerateEnvScript(config *GPUEnvConfig, paths *platform.Paths) (string, error)
GenerateEnvScript generates a shell script to set up the GPU environment
func GeneratePowerShellScript ¶ added in v1.1.7
func GeneratePowerShellScript(config *GPUEnvConfig, paths *platform.Paths) (string, error)
GeneratePowerShellScript generates a PowerShell script to set up the GPU environment
func GetLibraryNames ¶ added in v1.1.7
GetLibraryNames returns the library names to preload for a vendor (Linux/macOS) Note: These are the expected canonical names. Use FindActualLibraryFiles to discover actual downloaded files which may have different names.
func GetWindowsLibraryNames ¶ added in v1.1.7
GetWindowsLibraryNames returns the DLL names for a vendor (Windows)
func MergeEnvVars ¶ added in v1.1.17
MergeEnvVars merges user-provided env vars with setup result env vars User-provided vars take precedence
func NormalizeArch ¶ added in v1.1.18
NormalizeArch normalizes architecture names to Docker/OCI format (amd64, arm64)
Types ¶
type AppleContainerBackend ¶
type AppleContainerBackend struct {
// contains filtered or unexported fields
}
AppleContainerBackend implements the Backend interface using Apple native containers This uses Docker CLI with the assumption that Docker Desktop or similar is running on macOS using Apple Virtualization Framework
func NewAppleContainerBackend ¶
func NewAppleContainerBackend() *AppleContainerBackend
NewAppleContainerBackend creates a new Apple container backend
func (*AppleContainerBackend) Create ¶
func (b *AppleContainerBackend) Create(ctx context.Context, opts *CreateOptions) (*Environment, error)
func (*AppleContainerBackend) Get ¶
func (b *AppleContainerBackend) Get(ctx context.Context, idOrName string) (*Environment, error)
func (*AppleContainerBackend) IsAvailable ¶
func (b *AppleContainerBackend) IsAvailable(ctx context.Context) bool
func (*AppleContainerBackend) List ¶
func (b *AppleContainerBackend) List(ctx context.Context) ([]*Environment, error)
func (*AppleContainerBackend) Mode ¶
func (b *AppleContainerBackend) Mode() Mode
func (*AppleContainerBackend) Name ¶
func (b *AppleContainerBackend) Name() string
func (*AppleContainerBackend) Remove ¶
func (b *AppleContainerBackend) Remove(ctx context.Context, envID string) error
type Architecture ¶
Architecture detection
func DetectArchitecture ¶
func DetectArchitecture() Architecture
DetectArchitecture detects the current system architecture
func (Architecture) String ¶
func (a Architecture) String() string
String returns the architecture string for CDN lookup
type AutoStartableBackend ¶ added in v1.1.10
type AutoStartableBackend interface {
Backend
// IsInstalled checks if the backend software is installed (but not necessarily running)
IsInstalled(ctx context.Context) bool
// EnsureRunning ensures the backend is running, starting it if necessary
EnsureRunning(ctx context.Context) error
}
AutoStartableBackend is an optional interface for backends that can be auto-started. Backends implementing this interface can be selected even if not currently running, as long as they are installed and can be started automatically.
type Backend ¶
type Backend interface {
// Name returns the backend name
Name() string
// Mode returns the mode this backend handles
Mode() Mode
// IsAvailable checks if this backend is available on the system
IsAvailable(ctx context.Context) bool
// Create creates a new environment
Create(ctx context.Context, opts *CreateOptions) (*Environment, error)
// Start starts a stopped environment
Start(ctx context.Context, envID string) error
// Stop stops a running environment
Stop(ctx context.Context, envID string) error
// Remove removes an environment
Remove(ctx context.Context, envID string) error
// List lists all environments
List(ctx context.Context) ([]*Environment, error)
// Get gets an environment by ID or name
Get(ctx context.Context, idOrName string) (*Environment, error)
// Exec executes a command in an environment
Exec(ctx context.Context, envID string, cmd []string) ([]byte, error)
// Logs returns logs from an environment
Logs(ctx context.Context, envID string, follow bool) (<-chan string, error)
}
Backend is the interface for container/VM runtime backends
type ColimaBackend ¶
type ColimaBackend struct {
// contains filtered or unexported fields
}
ColimaBackend implements the Backend interface using Colima (macOS/Linux)
func NewColimaBackend ¶
func NewColimaBackend() *ColimaBackend
NewColimaBackend creates a new Colima backend
func NewColimaBackendWithProfile ¶
func NewColimaBackendWithProfile(profile string) *ColimaBackend
NewColimaBackendWithProfile creates a new Colima backend with specific profile
func (*ColimaBackend) Create ¶
func (b *ColimaBackend) Create(ctx context.Context, opts *CreateOptions) (*Environment, error)
func (*ColimaBackend) EnsureRunning ¶
func (b *ColimaBackend) EnsureRunning(ctx context.Context) error
EnsureRunning ensures Colima is running
func (*ColimaBackend) Get ¶
func (b *ColimaBackend) Get(ctx context.Context, idOrName string) (*Environment, error)
func (*ColimaBackend) GetColimaIP ¶
func (b *ColimaBackend) GetColimaIP(ctx context.Context) (string, error)
GetColimaIP returns the IP address of the Colima VM
func (*ColimaBackend) GetProfile ¶
func (b *ColimaBackend) GetProfile() string
GetProfile returns the Colima profile name
func (*ColimaBackend) GetVMArch ¶ added in v1.1.18
func (b *ColimaBackend) GetVMArch(ctx context.Context) string
GetVMArch returns the architecture of the Colima VM Returns "amd64", "arm64", or empty string if detection fails
func (*ColimaBackend) IsAvailable ¶
func (b *ColimaBackend) IsAvailable(ctx context.Context) bool
func (*ColimaBackend) IsInstalled ¶ added in v1.1.10
func (b *ColimaBackend) IsInstalled(ctx context.Context) bool
IsInstalled checks if colima is installed (but not necessarily running)
func (*ColimaBackend) List ¶
func (b *ColimaBackend) List(ctx context.Context) ([]*Environment, error)
func (*ColimaBackend) Mode ¶
func (b *ColimaBackend) Mode() Mode
func (*ColimaBackend) Name ¶
func (b *ColimaBackend) Name() string
func (*ColimaBackend) Remove ¶
func (b *ColimaBackend) Remove(ctx context.Context, envID string) error
func (*ColimaBackend) SetDockerHost ¶
func (b *ColimaBackend) SetDockerHost(dockerHost string)
SetDockerHost sets a custom Docker socket path
type ContainerSetupConfig ¶ added in v1.1.17
type ContainerSetupConfig struct {
// StudioName is the name of the studio (used for config file paths)
StudioName string
// GPUWorkerURL is the connection URL to the GPU worker
GPUWorkerURL string
// HardwareVendor is the GPU vendor (nvidia, amd, hygon)
HardwareVendor string
// MountUserHome indicates whether to mount the user's home directory
MountUserHome bool
// UserHomeContainerPath is the path to mount user home in container (default: /home/user/host)
UserHomeContainerPath string
}
ContainerSetupConfig holds configuration for container GPU environment setup
type ContainerSetupResult ¶ added in v1.1.17
type ContainerSetupResult struct {
// EnvVars are environment variables to set in the container
EnvVars map[string]string
// VolumeMounts are volumes to mount in the container
VolumeMounts []VolumeMount
// LibrariesDownloaded indicates if libraries were downloaded during setup
LibrariesDownloaded bool
}
ContainerSetupResult holds the result of container setup
func SetupContainerGPUEnv ¶ added in v1.1.17
func SetupContainerGPUEnv(ctx context.Context, config *ContainerSetupConfig) (*ContainerSetupResult, error)
SetupContainerGPUEnv sets up the GPU environment for a container This performs the same setup as `ggo use` does for Linux: 1. Downloads GPU client libraries for Linux (using host CPU arch) 2. Sets up GPU environment (env vars, ld.so.preload, ld.so.conf.d) 3. Optionally mounts user home directory
type CreateOptions ¶
type CreateOptions struct {
Name string `json:"name"`
Mode Mode `json:"mode"`
Image string `json:"image"`
GPUWorkerURL string `json:"gpu_worker_url,omitempty"` // TENSOR_FUSION_OPERATOR_CONNECTION_INFO
HardwareVendor string `json:"hardware_vendor,omitempty"` // nvidia, amd, hygon
SSHPublicKey string `json:"ssh_public_key,omitempty"`
WorkDir string `json:"work_dir,omitempty"`
Ports []PortMapping `json:"ports,omitempty"`
Envs map[string]string `json:"envs,omitempty"`
Volumes []VolumeMount `json:"volumes,omitempty"`
Resources ResourceSpec `json:"resources,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
// NoUserVolume disables automatic mounting of user's home directory
NoUserVolume bool `json:"no_user_volume,omitempty"`
// Command specifies the container startup command or supplements ENTRYPOINT args
Command []string `json:"command,omitempty"`
// Endpoint overrides the GPU worker endpoint URL
Endpoint string `json:"endpoint,omitempty"`
// Platform specifies the container image platform (e.g., linux/amd64, linux/arm64)
// If empty, auto-detect from VM/host architecture
Platform string `json:"platform,omitempty"`
}
CreateOptions contains options for creating an environment
type DockerBackend ¶
type DockerBackend struct {
// contains filtered or unexported fields
}
DockerBackend implements the Backend interface using Docker
func NewDockerBackend ¶
func NewDockerBackend() *DockerBackend
NewDockerBackend creates a new Docker backend
func NewDockerBackendWithHost ¶
func NewDockerBackendWithHost(dockerHost string) *DockerBackend
NewDockerBackendWithHost creates a new Docker backend with custom host
func NewPodmanBackend ¶
func NewPodmanBackend() *DockerBackend
NewPodmanBackend creates a new Podman backend (uses Docker interface)
func (*DockerBackend) Create ¶
func (b *DockerBackend) Create(ctx context.Context, opts *CreateOptions) (*Environment, error)
func (*DockerBackend) Get ¶
func (b *DockerBackend) Get(ctx context.Context, idOrName string) (*Environment, error)
func (*DockerBackend) GetHostArch ¶ added in v1.1.18
func (b *DockerBackend) GetHostArch(ctx context.Context) string
GetHostArch returns the architecture of the Docker host Returns "amd64", "arm64", or empty string if detection fails
func (*DockerBackend) IsAvailable ¶
func (b *DockerBackend) IsAvailable(ctx context.Context) bool
func (*DockerBackend) List ¶
func (b *DockerBackend) List(ctx context.Context) ([]*Environment, error)
func (*DockerBackend) Mode ¶
func (b *DockerBackend) Mode() Mode
func (*DockerBackend) Name ¶
func (b *DockerBackend) Name() string
func (*DockerBackend) Remove ¶
func (b *DockerBackend) Remove(ctx context.Context, envID string) error
type Environment ¶
type Environment struct {
ID string `json:"id"`
Name string `json:"name"`
Mode Mode `json:"mode"`
Image string `json:"image"`
Status EnvironmentStatus `json:"status"`
ConnectionURL string `json:"connection_url,omitempty"`
SSHHost string `json:"ssh_host,omitempty"`
SSHPort int `json:"ssh_port,omitempty"`
SSHUser string `json:"ssh_user,omitempty"`
WorkDir string `json:"work_dir,omitempty"`
GPUWorkerURL string `json:"gpu_worker_url,omitempty"`
CreatedAt time.Time `json:"created_at"`
Labels map[string]string `json:"labels,omitempty"`
}
Environment represents a running studio environment
type EnvironmentStatus ¶
type EnvironmentStatus string
EnvironmentStatus represents the status of an environment
const ( StatusPending EnvironmentStatus = "pending" StatusPulling EnvironmentStatus = "pulling" StatusStarting EnvironmentStatus = "starting" StatusRunning EnvironmentStatus = "running" StatusStopped EnvironmentStatus = "stopped" StatusError EnvironmentStatus = "error" StatusTerminated EnvironmentStatus = "terminated" StatusDeleted EnvironmentStatus = "deleted" StatusUnknown EnvironmentStatus = "unknown" )
type GPUEnvConfig ¶ added in v1.1.7
type GPUEnvConfig struct {
Vendor GPUVendor
ConnectionURL string // TENSOR_FUSION_OPERATOR_CONNECTION_INFO value
CachePath string // Path to gpugo cache directory (for binaries like tensor-fusion-worker)
LibsPath string // Path to gpugo libs directory (for .so/.dll files, used in LD paths)
LogPath string // Path to logs directory
StudioName string // Name of the studio (for creating config files)
IsContainer bool // Whether this is for a container (affects paths)
}
GPUEnvConfig holds configuration for GPU environment setup
type GPUEnvResult ¶ added in v1.1.7
type GPUEnvResult struct {
EnvVars map[string]string
LDSoConfPath string // Host path to ld.so.conf file
LDSoPreloadPath string // Host path to ld.so.preload file
VolumeMounts []VolumeMount // Additional volume mounts needed
}
GPUEnvResult holds the result of GPU environment setup
func SetupGPUEnv ¶ added in v1.1.7
func SetupGPUEnv(paths *platform.Paths, config *GPUEnvConfig) (*GPUEnvResult, error)
SetupGPUEnv creates and configures GPU environment files
type GPUVendor ¶ added in v1.1.7
type GPUVendor string
GPUVendor represents supported GPU vendors
func ParseVendor ¶ added in v1.1.7
ParseVendor parses a vendor string to GPUVendor
type LibraryDownloader ¶
type LibraryDownloader struct {
// contains filtered or unexported fields
}
LibraryDownloader handles downloading versioned GPU libraries from CDN
func NewLibraryDownloader ¶
func NewLibraryDownloader(cdnURL, version string) *LibraryDownloader
NewLibraryDownloader creates a new library downloader
func (*LibraryDownloader) Download ¶
func (d *LibraryDownloader) Download(lib LibraryInfo) (string, error)
Download downloads a library from the CDN
func (*LibraryDownloader) DownloadDefaultLibraries ¶
func (d *LibraryDownloader) DownloadDefaultLibraries() ([]string, error)
DownloadDefaultLibraries downloads the default set of GPU libraries
func (*LibraryDownloader) DownloadURL ¶
func (d *LibraryDownloader) DownloadURL(lib LibraryInfo) string
DownloadURL constructs the CDN download URL for a library
func (*LibraryDownloader) GetCacheDir ¶
func (d *LibraryDownloader) GetCacheDir() string
GetCacheDir returns the cache directory path
func (*LibraryDownloader) SetCacheDir ¶
func (d *LibraryDownloader) SetCacheDir(dir string)
SetCacheDir sets a custom cache directory
type LibraryInfo ¶
type LibraryInfo struct {
Name string
Version string
Arch Architecture
Checksum string // SHA256 checksum
}
LibraryInfo contains information about a library to download
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages AI studio environments across different backends
func (*Manager) AddSSHConfig ¶
func (m *Manager) AddSSHConfig(env *Environment) error
AddSSHConfig adds an SSH config entry for an environment
func (*Manager) Create ¶
func (m *Manager) Create(ctx context.Context, opts *CreateOptions) (*Environment, error)
Create creates a new environment
func (*Manager) GetBackend ¶
GetBackend returns a backend by mode
func (*Manager) List ¶
func (m *Manager) List(ctx context.Context) ([]*Environment, error)
List lists all environments across all backends
func (*Manager) ListAvailableBackends ¶
ListAvailableBackends returns all available backends
func (*Manager) RegisterBackend ¶
RegisterBackend registers a backend
func (*Manager) RemoveSSHConfig ¶
RemoveSSHConfig removes an SSH config entry for an environment
type Mode ¶
type Mode string
Mode represents the container/VM runtime mode
const ( ModeWSL Mode = "wsl" // Windows Subsystem for Linux ModeColima Mode = "colima" // Colima (macOS/Linux) ModeAppleContainer Mode = "apple" // Apple Virtualization Framework ModeDocker Mode = "docker" // Native Docker ModeKubernetes Mode = "k8s" // Kubernetes (kind, minikube, etc.) ModeAuto Mode = "auto" // Auto-detect best option )
type PortMapping ¶
type PortMapping struct {
HostPort int `json:"host_port"`
ContainerPort int `json:"container_port"`
Protocol string `json:"protocol,omitempty"` // tcp, udp
}
PortMapping represents a port mapping
type ResourceSpec ¶
type ResourceSpec struct {
CPUs float64 `json:"cpus,omitempty"`
Memory string `json:"memory,omitempty"` // e.g., "8Gi"
}
ResourceSpec represents resource limits
type SSHConfig ¶
type SSHConfig struct {
Host string
HostName string
User string
Port int
IdentityFile string
ExtraOptions map[string]string
}
SSHConfig represents an SSH configuration entry
func (*SSHConfig) GenerateSSHConfigEntry ¶
GenerateSSHConfigEntry generates an SSH config entry string
type StudioImage ¶
type StudioImage struct {
Name string `json:"name"`
Tag string `json:"tag"`
Description string `json:"description"`
Features []string `json:"features"` // torch, cuda, ssh, jupyter, etc.
Size string `json:"size"`
Registry string `json:"registry"`
Labels map[string]string `json:"labels,omitempty"`
}
StudioImage represents a pre-configured AI development image
func DefaultImages ¶
func DefaultImages() []StudioImage
DefaultImages returns the list of available studio images
type VolumeMount ¶
type VolumeMount struct {
HostPath string `json:"host_path"`
ContainerPath string `json:"container_path"`
ReadOnly bool `json:"read_only,omitempty"`
}
VolumeMount represents a volume mount
func MergeVolumeMounts ¶ added in v1.1.17
func MergeVolumeMounts(setupVolumes, userVolumes []VolumeMount) []VolumeMount
MergeVolumeMounts merges user-provided volumes with setup result volumes If the same container path exists, user-provided volume takes precedence
type WSLBackend ¶
type WSLBackend struct {
// contains filtered or unexported fields
}
WSLBackend implements the Backend interface using Windows Subsystem for Linux
func NewWSLBackendWithDistro ¶
func NewWSLBackendWithDistro(distro string) *WSLBackend
NewWSLBackendWithDistro creates a new WSL backend with specific distro
func (*WSLBackend) Create ¶
func (b *WSLBackend) Create(ctx context.Context, opts *CreateOptions) (*Environment, error)
func (*WSLBackend) EnsureSSHServer ¶
func (b *WSLBackend) EnsureSSHServer(ctx context.Context, envID string) error
EnsureSSHServer ensures SSH server is running in the container
func (*WSLBackend) Get ¶
func (b *WSLBackend) Get(ctx context.Context, idOrName string) (*Environment, error)
func (*WSLBackend) GetDistro ¶
func (b *WSLBackend) GetDistro(ctx context.Context) (string, error)
GetDistro returns the configured or default WSL distribution
func (*WSLBackend) GetWSLIP ¶
func (b *WSLBackend) GetWSLIP(ctx context.Context) (string, error)
GetWSLIP returns the IP address of the WSL instance
func (*WSLBackend) GetWSLStatus ¶ added in v1.1.7
func (b *WSLBackend) GetWSLStatus(ctx context.Context) *WSLStatus
GetWSLStatus checks the detailed status of WSL
func (*WSLBackend) IsAvailable ¶
func (b *WSLBackend) IsAvailable(ctx context.Context) bool
func (*WSLBackend) List ¶
func (b *WSLBackend) List(ctx context.Context) ([]*Environment, error)
func (*WSLBackend) Mode ¶
func (b *WSLBackend) Mode() Mode
func (*WSLBackend) Name ¶
func (b *WSLBackend) Name() string
func (*WSLBackend) SetDistro ¶
func (b *WSLBackend) SetDistro(distro string)
SetDistro sets the WSL distribution name
type WSLStatus ¶ added in v1.1.7
type WSLStatus struct {
WSLInstalled bool
HasDistribution bool
DistributionName string
DockerInstalled bool
DockerRunning bool
ErrorMessage string
}
WSLStatus represents the detailed status of WSL
func (*WSLStatus) GetInstallGuidance ¶ added in v1.1.7
GetInstallGuidance returns installation guidance based on the current status