kanbans

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package kanbans manages per-tenant Vikunja kanban board provisioning.

Index

Constants

View Source
const (
	DefaultPortStart = 7100
	DefaultPortEnd   = 9100
)

Default port range for kanban containers.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kanban

type Kanban struct {
	ID          string             `json:"id"`
	TenantID    string             `json:"tenant_id"`
	Status      string             `json:"status"`
	ContainerID string             `json:"-"`
	Host        string             `json:"host,omitempty"`
	Port        int                `json:"port,omitempty"`
	URL         string             `json:"url,omitempty"`
	Credentials *KanbanCredentials `json:"credentials,omitempty"` // only on create
	VolumeName  string             `json:"-"`
	CreatedAt   int64              `json:"created_at"`
	UpdatedAt   int64              `json:"updated_at"`
}

Kanban represents a provisioned Vikunja kanban board instance.

type KanbanCredentials

type KanbanCredentials struct {
	Username     string `json:"username"`
	Password     string `json:"password"`
	JWT          string `json:"jwt,omitempty"`
	SetupSuccess bool   `json:"setup_success"`
}

KanbanCredentials holds the admin credentials returned on create.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager manages kanban board lifecycle.

func NewManager

func NewManager(db *sql.DB, dockerClient docker.Client, masterKey []byte) *Manager

NewManager creates a kanban manager with the default port range.

func NewManagerWithPortRange

func NewManagerWithPortRange(db *sql.DB, dockerClient docker.Client, masterKey []byte, portStart, portEnd int) *Manager

NewManagerWithPortRange creates a kanban manager with a custom port range. portStart and portEnd are inclusive bounds. If portStart >= portEnd the defaults are used.

func (*Manager) Create

func (m *Manager) Create(ctx context.Context, tenantID string) (*Kanban, error)

Create provisions a new Vikunja kanban board for a tenant. It returns immediately with status "provisioning"; a background goroutine handles health checks, Vikunja setup, and status transitions to "ready" or "failed". Callers should poll GET /v1/kanban for the final status.

func (*Manager) Delete

func (m *Manager) Delete(ctx context.Context, tenantID string) error

Delete destroys a kanban board: stops container, removes volume, deletes record.

func (*Manager) Get

func (m *Manager) Get(ctx context.Context, tenantID string) (*Kanban, error)

Get returns the kanban board for a tenant.

func (*Manager) GetAdminToken

func (m *Manager) GetAdminToken(ctx context.Context, tenantID string) (string, error)

GetAdminToken returns the decrypted admin token.

func (*Manager) PortRange

func (m *Manager) PortRange() (start, end int)

PortRange returns the configured port range (inclusive).

func (*Manager) ReconcileStale

func (m *Manager) ReconcileStale()

ReconcileStale marks kanbans stuck in "provisioning" as "failed" and attempts to clean up their Docker resources. Called on startup.

func (*Manager) SetBaseURL

func (m *Manager) SetBaseURL(url string)

SetBaseURL overrides the default base URL (for testing).

func (*Manager) SetHealthCheckTimeout

func (m *Manager) SetHealthCheckTimeout(d time.Duration)

SetHealthCheckTimeout overrides the default health check timeout (for testing).

func (*Manager) StartForTenant

func (m *Manager) StartForTenant(ctx context.Context, tenantID string)

StartForTenant recreates the container of a tenant's stopped kanban board (see StopForTenant) on its existing volume and port. Vikunja's data and admin user live in the volume; only the JWT secret is regenerated, which just invalidates old login tokens. Best-effort: failures mark the board "failed".

func (*Manager) StopForTenant

func (m *Manager) StopForTenant(ctx context.Context, tenantID string)

StopForTenant stops the kanban container for a tenant without deleting the DB record, so it can be restarted if the tenant is ever reactivated. Errors are logged but not returned — suspension should be best-effort.

Jump to

Keyboard shortcuts

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