deploy

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compose

func Compose(conn *synology.Connection, opts *ComposeOptions) error

Compose deploys a docker-compose file to the Synology NAS

func ConnectContainerToNetwork added in v0.2.1

func ConnectContainerToNetwork(conn *synology.Connection, networkName, containerName string, opts *NetworkConnectOptions) error

ConnectContainerToNetwork connects a container to a network

func Container

func Container(conn *synology.Connection, opts *ContainerOptions) (string, error)

Container deploys a container using direct Docker commands over SSH

func CreateNetwork added in v0.2.1

func CreateNetwork(conn *synology.Connection, networkName string, opts *NetworkCreateOptions) (string, error)

CreateNetwork creates a Docker network

func CreateVolume added in v0.2.0

func CreateVolume(conn *synology.Connection, volumeName string, opts *VolumeCreateOptions) (string, error)

CreateVolume creates a Docker volume

func DisconnectContainerFromNetwork added in v0.2.1

func DisconnectContainerFromNetwork(conn *synology.Connection, networkName, containerName string, opts *NetworkDisconnectOptions) error

DisconnectContainerFromNetwork disconnects a container from a network

func ExecCommand added in v0.2.0

func ExecCommand(conn *synology.Connection, nameOrID string, command []string, opts *ExecOptions) (string, error)

ExecCommand executes a command in a container and returns output

func ExecInteractive added in v0.2.0

func ExecInteractive(conn *synology.Connection, nameOrID string, command []string, opts *ExecOptions) error

ExecInteractive executes an interactive command in a container

func ExportContainer added in v0.2.0

func ExportContainer(conn *synology.Connection, containerName string, opts *ExportOptions) error

ExportContainer exports a container's filesystem as a tar archive

func FollowContainerLogs added in v0.2.0

func FollowContainerLogs(conn *synology.Connection, nameOrID, tail, since string, timestamps bool, stdout, stderr io.Writer) error

FollowContainerLogs follows container logs in real-time

func GenerateProjectName

func GenerateProjectName(composePath string) string

GenerateProjectName generates a project name from a compose file path

func GetContainerLogs added in v0.2.0

func GetContainerLogs(conn *synology.Connection, nameOrID, tail, since string, timestamps bool) (string, error)

GetContainerLogs retrieves container logs

func GetDockerClient

func GetDockerClient() (*client.Client, error)

GetDockerClient returns a placeholder - not used in simple implementation

func GetSystemInfo added in v0.2.0

func GetSystemInfo(conn *synology.Connection, opts *SystemInfoOptions) (string, error)

GetSystemInfo gets Docker system information

func ImportImage added in v0.2.0

func ImportImage(conn *synology.Connection, source, repository string, opts *ImportOptions) (string, error)

ImportImage imports the contents from a tarball to create a filesystem image

func InspectNetwork added in v0.2.1

func InspectNetwork(conn *synology.Connection, networkName string, opts *NetworkInspectOptions) (string, error)

InspectNetwork inspects a Docker network

func InspectObject added in v0.2.0

func InspectObject(conn *synology.Connection, objectName string, opts *InspectOptions) (string, error)

InspectObject inspects a Docker object (container, image, volume, network)

func InspectVolume added in v0.2.0

func InspectVolume(conn *synology.Connection, volumeName string, opts *VolumeInspectOptions) (string, error)

InspectVolume inspects a Docker volume

func ListImageIDs added in v0.2.0

func ListImageIDs(conn *synology.Connection, repository string, opts *ImagesOptions) ([]string, error)

ListImageIDs lists Docker image IDs only

func ListNetworkIDs added in v0.2.1

func ListNetworkIDs(conn *synology.Connection, opts *NetworkListOptions) ([]string, error)

ListNetworkIDs lists Docker network IDs only

func ListVolumeNames added in v0.2.0

func ListVolumeNames(conn *synology.Connection, opts *VolumeListOptions) ([]string, error)

ListVolumeNames lists Docker volume names only

func PullImage added in v0.2.0

func PullImage(conn *synology.Connection, imageName string, opts *PullOptions) error

PullImage pulls a Docker image

func RemoveContainer

func RemoveContainer(conn *synology.Connection, nameOrID string, force bool) error

RemoveContainer removes a container using direct Docker commands

func RemoveImage added in v0.2.0

func RemoveImage(conn *synology.Connection, imageName string, opts *RmiOptions) error

RemoveImage removes a Docker image

func RemoveNetwork added in v0.2.1

func RemoveNetwork(conn *synology.Connection, networkName string) error

RemoveNetwork removes a Docker network

func RemoveVolume added in v0.2.0

func RemoveVolume(conn *synology.Connection, volumeName string, opts *VolumeRemoveOptions) error

RemoveVolume removes a Docker volume

func RestartContainer added in v0.2.0

func RestartContainer(conn *synology.Connection, nameOrID string, timeout int) error

RestartContainer restarts a container

func ShowContainerStats added in v0.2.0

func ShowContainerStats(conn *synology.Connection, containers []string, opts *StatsOptions) error

ShowContainerStats displays container resource usage statistics

func StartContainer added in v0.2.0

func StartContainer(conn *synology.Connection, nameOrID string) error

StartContainer starts a stopped container

func StopContainer added in v0.2.0

func StopContainer(conn *synology.Connection, nameOrID string, timeout int) error

StopContainer stops a running container

func TestDockerConnection

func TestDockerConnection(conn *synology.Connection) error

TestDockerConnection tests Docker availability over SSH

Types

type ComposeFile

type ComposeFile struct {
	Version  string                    `yaml:"version,omitempty"`
	Services map[string]ComposeService `yaml:"services"`
	Networks map[string]interface{}    `yaml:"networks,omitempty"`
	Volumes  map[string]interface{}    `yaml:"volumes,omitempty"`
}

ComposeFile represents a complete docker-compose file structure

type ComposeOptions

type ComposeOptions struct {
	ComposeFile string
	ProjectName string
	EnvFile     string
}

ComposeOptions represents options for deploying a compose file

type ComposeService

type ComposeService struct {
	Image       string            `yaml:"image,omitempty"`
	Build       interface{}       `yaml:"build,omitempty"`
	Ports       []string          `yaml:"ports,omitempty"`
	Volumes     []string          `yaml:"volumes,omitempty"`
	Environment interface{}       `yaml:"environment,omitempty"`
	Restart     string            `yaml:"restart,omitempty"`
	Networks    interface{}       `yaml:"networks,omitempty"`
	DependsOn   interface{}       `yaml:"depends_on,omitempty"`
	Command     interface{}       `yaml:"command,omitempty"`
	WorkingDir  string            `yaml:"working_dir,omitempty"`
	User        string            `yaml:"user,omitempty"`
	Hostname    string            `yaml:"hostname,omitempty"`
	Labels      map[string]string `yaml:"labels,omitempty"`
}

ComposeService represents a service in a docker-compose file

type ContainerInfo

type ContainerInfo struct {
	ID     string
	Name   string
	Image  string
	Status string
	Ports  []string
}

ContainerInfo represents container information

func ListContainers

func ListContainers(conn *synology.Connection, all bool) ([]ContainerInfo, error)

ListContainers lists containers using direct Docker commands

type ContainerOptions

type ContainerOptions struct {
	Image       string
	Name        string
	Ports       []string // ["8080:80", "443:443"]
	Volumes     []string // ["/volume1/data:/app/data"]
	Env         []string // ["KEY=value"]
	Restart     string   // "unless-stopped"
	NetworkMode string
	WorkingDir  string
	Command     []string
	User        string
}

ContainerOptions defines options for container deployment

func NewContainerOptions

func NewContainerOptions(image string) *ContainerOptions

NewContainerOptions creates new container options with defaults

type ExecOptions added in v0.2.0

type ExecOptions struct {
	Interactive bool
	TTY         bool
	User        string
	WorkingDir  string
	Env         []string
}

ExecOptions defines options for executing commands in containers

type ExportOptions added in v0.2.0

type ExportOptions struct {
	Output string
}

ExportOptions defines options for exporting containers

type ImageInfo added in v0.2.0

type ImageInfo struct {
	Repository string
	Tag        string
	Digest     string
	ID         string
	Created    string
	Size       string
}

ImageInfo represents Docker image information

func ListImages added in v0.2.0

func ListImages(conn *synology.Connection, repository string, opts *ImagesOptions) ([]ImageInfo, error)

ListImages lists Docker images

type ImagesOptions added in v0.2.0

type ImagesOptions struct {
	All      bool
	Dangling bool
	Digests  bool
	Format   string
	NoTrunc  bool
	Quiet    bool
}

ImagesOptions defines options for listing images

type ImportOptions added in v0.2.0

type ImportOptions struct {
	Change   []string
	Message  string
	Platform string
}

ImportOptions defines options for importing images

type InspectOptions added in v0.2.0

type InspectOptions struct {
	Format string
	Size   bool
	Type   string
}

InspectOptions defines options for inspecting objects

type NetworkConnectOptions added in v0.2.1

type NetworkConnectOptions struct {
	Alias     []string
	IP        string
	IPv6      string
	LinkLocal []string
}

NetworkConnectOptions defines options for connecting containers to networks

type NetworkCreateOptions added in v0.2.1

type NetworkCreateOptions struct {
	Driver     string
	DriverOpts []string
	Gateway    []string
	IPRange    []string
	IPAM       []string
	Subnet     []string
	Labels     []string
	Attachable bool
	Ingress    bool
	Internal   bool
	IPv6       bool
}

NetworkCreateOptions defines options for creating networks

type NetworkDisconnectOptions added in v0.2.1

type NetworkDisconnectOptions struct {
	Force bool
}

NetworkDisconnectOptions defines options for disconnecting containers from networks

type NetworkInfo added in v0.2.1

type NetworkInfo struct {
	ID     string
	Name   string
	Driver string
	Scope  string
}

NetworkInfo represents Docker network information

func ListNetworks added in v0.2.1

func ListNetworks(conn *synology.Connection, opts *NetworkListOptions) ([]NetworkInfo, error)

ListNetworks lists Docker networks

type NetworkInspectOptions added in v0.2.1

type NetworkInspectOptions struct {
	Format string
}

NetworkInspectOptions defines options for inspecting networks

type NetworkListOptions added in v0.2.1

type NetworkListOptions struct {
	Format string
	Quiet  bool
	Filter []string
}

NetworkListOptions defines options for listing networks

type NetworkPruneOptions added in v0.2.1

type NetworkPruneOptions struct {
	Force  bool
	Filter []string
}

NetworkPruneOptions defines options for pruning networks

type NetworkPruneResult added in v0.2.1

type NetworkPruneResult struct {
	NetworksDeleted int
	SpaceReclaimed  string
}

NetworkPruneResult represents the result of network prune

func PruneNetworks added in v0.2.1

func PruneNetworks(conn *synology.Connection, opts *NetworkPruneOptions) (*NetworkPruneResult, error)

PruneNetworks removes unused Docker networks

type PullOptions added in v0.2.0

type PullOptions struct {
	AllTags             bool
	Platform            string
	Quiet               bool
	DisableContentTrust bool
}

PullOptions defines options for pulling images

type RmiOptions added in v0.2.0

type RmiOptions struct {
	Force   bool
	NoPrune bool
}

RmiOptions defines options for removing images

type StatsOptions added in v0.2.0

type StatsOptions struct {
	All      bool
	NoStream bool
	Format   string
}

StatsOptions defines options for container stats

type SystemDfItem added in v0.2.0

type SystemDfItem struct {
	Type        string
	Total       string
	Active      string
	Size        string
	Reclaimable string
}

SystemDfItem represents disk usage information

func GetSystemDf added in v0.2.0

func GetSystemDf(conn *synology.Connection, opts *SystemDfOptions) ([]SystemDfItem, error)

GetSystemDf gets Docker system disk usage

type SystemDfOptions added in v0.2.0

type SystemDfOptions struct {
	Format  string
	Verbose bool
}

SystemDfOptions defines options for system df

type SystemInfoOptions added in v0.2.0

type SystemInfoOptions struct {
	Format string
}

SystemInfoOptions defines options for system info

type SystemPruneOptions added in v0.2.0

type SystemPruneOptions struct {
	All     bool
	Force   bool
	Volumes bool
	Filter  []string
}

SystemPruneOptions defines options for system prune

type SystemPruneResult added in v0.2.0

type SystemPruneResult struct {
	ContainersDeleted int
	ImagesDeleted     int
	NetworksDeleted   int
	VolumesDeleted    int
	SpaceReclaimed    string
}

SystemPruneResult represents the result of system prune

func SystemPrune added in v0.2.0

func SystemPrune(conn *synology.Connection, opts *SystemPruneOptions) (*SystemPruneResult, error)

SystemPrune removes unused Docker data

type VolumeCreateOptions added in v0.2.0

type VolumeCreateOptions struct {
	Driver  string
	Labels  []string
	Options []string
}

VolumeCreateOptions defines options for creating volumes

type VolumeInfo added in v0.2.0

type VolumeInfo struct {
	Name   string
	Driver string
}

VolumeInfo represents Docker volume information

func ListVolumes added in v0.2.0

func ListVolumes(conn *synology.Connection, opts *VolumeListOptions) ([]VolumeInfo, error)

ListVolumes lists Docker volumes

type VolumeInspectOptions added in v0.2.0

type VolumeInspectOptions struct {
	Format string
}

VolumeInspectOptions defines options for inspecting volumes

type VolumeListOptions added in v0.2.0

type VolumeListOptions struct {
	Format string
	Quiet  bool
}

VolumeListOptions defines options for listing volumes

type VolumePruneOptions added in v0.2.0

type VolumePruneOptions struct {
	Force  bool
	Filter []string
}

VolumePruneOptions defines options for pruning volumes

type VolumePruneResult added in v0.2.0

type VolumePruneResult struct {
	VolumesDeleted int
	SpaceReclaimed string
}

VolumePruneResult represents the result of volume prune

func PruneVolumes added in v0.2.0

func PruneVolumes(conn *synology.Connection, opts *VolumePruneOptions) (*VolumePruneResult, error)

PruneVolumes removes unused Docker volumes

type VolumeRemoveOptions added in v0.2.0

type VolumeRemoveOptions struct {
	Force bool
}

VolumeRemoveOptions defines options for removing volumes

Jump to

Keyboard shortcuts

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