Help us shape the future of Go! Take the 2026 Go Developer Survey

service

package
v1.4.9 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package service provides lifecycle management for individual nSelf optional services (start, stop, restart, ps, update, scale). All operations delegate to `docker compose` via the internal/docker package — no raw docker invocations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Restart

func Restart(ctx context.Context, serviceName string) error

Restart restarts a named nSelf service via `docker compose restart <service>`.

func Scale

func Scale(ctx context.Context, serviceName string, replicas int) error

Scale adjusts the replica count for a named service via `docker compose up -d --scale <service>=<n> <service>`. Replicas must be >= 1.

func Start

func Start(ctx context.Context, serviceName string) error

Start starts a named nSelf service via `docker compose up -d --no-deps <service>`. The service must be configured in the stack (docker-compose.yml must exist).

func Stop

func Stop(ctx context.Context, serviceName string) error

Stop stops a named nSelf service via `docker compose stop <service>`. The container is stopped but not removed; its state is preserved.

func Update

func Update(ctx context.Context, serviceName string) error

Update pulls the latest image for a service and restarts it. This is equivalent to `docker compose pull <service> && docker compose up -d --no-deps <service>`.

Types

type PSEntry

type PSEntry struct {
	Name    string
	Service string
	Status  string
	Health  string
	ID      string
	Uptime  string
}

PSEntry represents a single service row in the `nself service ps` output.

func PS

func PS(ctx context.Context) ([]PSEntry, error)

PS returns the current status of all nSelf stack services.

Jump to

Keyboard shortcuts

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