dockercompose

package
v0.1.7-alpha.7 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package dockercompose provides Docker Compose CLI operations for XenForo.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnexpectedOutput indicates that an operation produced unexpected output.
	ErrUnexpectedOutput = errors.New("unexpected output")

	// ErrTimeout indicates an operation timed out.
	ErrTimeout = errors.New("operation timed out")

	// ErrEnvNotInitialized indicates the Docker environment is not initialized.
	ErrEnvNotInitialized = errors.New("environment not initialized")
)

Functions

func CheckDockerComposeAvailable

func CheckDockerComposeAvailable(ctx context.Context) error

CheckDockerComposeAvailable checks if Docker Compose is available.

func CheckDockerRunning

func CheckDockerRunning(ctx context.Context) error

CheckDockerRunning checks if Docker is running.

Types

type Runner

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

Runner handles Docker Compose operations for a XenForo installation.

func NewRunner

func NewRunner(xfDir string) (*Runner, error)

NewRunner creates a new Docker Compose runner for the given XenForo directory.

func (*Runner) Build

func (r *Runner) Build(ctx context.Context, pull bool, services ...string) error

Build builds or rebuilds services.

func (*Runner) Compose

func (r *Runner) Compose(ctx context.Context, args ...string) error

Compose runs a docker compose command directly.

func (*Runner) Composer

func (r *Runner) Composer(ctx context.Context, args ...string) error

Composer runs composer in the xf container.

func (*Runner) Contexts

func (r *Runner) Contexts() []string

Contexts returns the configured contexts.

func (*Runner) Down

func (r *Runner) Down(ctx context.Context) error

Down stops and removes the Docker containers.

func (*Runner) Exec

func (r *Runner) Exec(ctx context.Context, service string, cmd ...string) error

Exec runs a command in a running container.

func (*Runner) ExecOrRun

func (r *Runner) ExecOrRun(ctx context.Context, service string, rm bool, cmd ...string) error

ExecOrRun uses exec for running services and falls back to run for stopped services.

func (*Runner) ExecOrRunWithEnv

func (r *Runner) ExecOrRunWithEnv(ctx context.Context, service string, rm bool, env map[string]string, cmd ...string) error

ExecOrRunWithEnv uses exec for running services and falls back to run for stopped services.

func (*Runner) ExecOrRunWithEnvAndOutput

func (r *Runner) ExecOrRunWithEnvAndOutput(ctx context.Context, service string, rm bool, env map[string]string, stdout, stderr io.Writer, cmd ...string) error

ExecOrRunWithEnvAndOutput runs a docker-compose exec or run command with output.

func (*Runner) ExecOrRunWithOutput

func (r *Runner) ExecOrRunWithOutput(ctx context.Context, service string, rm bool, stdout, stderr io.Writer, cmd ...string) error

ExecOrRunWithOutput uses exec for running services and falls back to run for stopped services.

func (*Runner) ExecWithEnv

func (r *Runner) ExecWithEnv(ctx context.Context, service string, env map[string]string, cmd ...string) error

ExecWithEnv runs a command in a running container with additional environment variables.

func (*Runner) GetURL

func (r *Runner) GetURL(ctx context.Context) (string, error)

GetURL returns the URL for accessing the XenForo site. It detects OrbStack vs standard Docker.

func (*Runner) Instance

func (r *Runner) Instance() string

Instance returns the Docker instance name.

func (*Runner) IsEnvironmentInitialized

func (r *Runner) IsEnvironmentInitialized() bool

IsEnvironmentInitialized checks if the Docker environment is set up.

func (*Runner) Logs

func (r *Runner) Logs(ctx context.Context, follow bool, services ...string) error

Logs shows container logs.

func (*Runner) PHP

func (r *Runner) PHP(ctx context.Context, args ...string) error

PHP runs PHP in the xf container.

func (*Runner) PHPDebug

func (r *Runner) PHPDebug(ctx context.Context, args ...string) error

PHPDebug runs PHP with XDebug enabled.

func (*Runner) PS

func (r *Runner) PS(ctx context.Context) error

PS lists running containers.

func (*Runner) Pull

func (r *Runner) Pull(ctx context.Context, services ...string) error

Pull pulls the latest images.

func (*Runner) Restart

func (r *Runner) Restart(ctx context.Context, services ...string) error

Restart restarts containers.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, service string, rm bool, cmd ...string) error

Run runs a one-off command in a new container.

func (*Runner) RunCapture

func (r *Runner) RunCapture(ctx context.Context, args ...string) (string, string, error)

RunCapture runs a docker compose command and captures output.

func (*Runner) RunWithEnv

func (r *Runner) RunWithEnv(ctx context.Context, service string, rm bool, env map[string]string, cmd ...string) error

RunWithEnv runs a command with additional environment variables.

func (*Runner) RunWithEnvAndOutput

func (r *Runner) RunWithEnvAndOutput(ctx context.Context, service string, rm bool, env map[string]string, stdout, stderr io.Writer, cmd ...string) error

RunWithEnvAndOutput runs a docker-compose run command with custom output.

func (*Runner) RunWithOutput

func (r *Runner) RunWithOutput(ctx context.Context, service string, rm bool, stdout, stderr io.Writer, cmd ...string) error

RunWithOutput runs a one-off command in a new container with custom output writers.

func (*Runner) Up

func (r *Runner) Up(ctx context.Context, detach bool) error

Up starts the Docker containers.

func (*Runner) UpWithOutput

func (r *Runner) UpWithOutput(ctx context.Context, detach bool, stdout, stderr io.Writer) error

UpWithOutput starts the Docker containers with custom output writers.

func (*Runner) WaitForDatabase

func (r *Runner) WaitForDatabase(ctx context.Context, checkInterval time.Duration) error

WaitForDatabase waits for the database to be ready.

func (*Runner) WaitForReady

func (r *Runner) WaitForReady(ctx context.Context, checkInterval time.Duration) error

WaitForReady waits for the xf container to be ready to accept commands.

func (*Runner) XFCommand

func (r *Runner) XFCommand(ctx context.Context, args ...string) error

XFCommand runs a XenForo CLI command.

func (*Runner) XFCommandDebug

func (r *Runner) XFCommandDebug(ctx context.Context, args ...string) error

XFCommandDebug runs a XenForo CLI command with XDebug.

func (*Runner) XFCommandWithOutput

func (r *Runner) XFCommandWithOutput(ctx context.Context, stdout, stderr io.Writer, args ...string) error

XFCommandWithOutput runs a XenForo CLI command with custom output writers.

func (*Runner) XFDir

func (r *Runner) XFDir() string

XFDir returns the XenForo directory path.

Jump to

Keyboard shortcuts

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