install

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package install sets Zelie up on a fresh server: its users, its services and how the panel is reached. Every step can run again, so an install that stopped halfway is finished by running it once more.

Index

Constants

View Source
const (
	Binary    = "/usr/local/bin/zelie"
	UnitDir   = "/etc/systemd/system"
	PanelUser = "zelie"
	ProxyUser = "zelie-proxy"
)

Where an installed Zelie lives.

View Source
const DefaultTunnelPort = 8480

DefaultTunnelPort is where the proxy listens behind a tunnel. It clashes with neither the usual web ports nor Pterodactyl's and Pelican's 8080.

Variables

View Source
var ErrAdminExists = errors.New("an administrator exists already")

ErrAdminExists is what SetupLink returns on a server set up before.

View Source
var Services = []string{"zelie-core", "zelie-proxy", "zelie-panel"}

Services are Zelie's own systemd services, in the order they start.

Functions

func TunnelToken

func TunnelToken(command string) (string, error)

TunnelToken takes the token out of the command Cloudflare shows, pasted whole, with or without sudo and the lines before it.

func Units

func Units(opts Options) map[string]string

Units returns the systemd units for opts, by file name.

Types

type Cloudflared

type Cloudflared struct {
	Arch   string
	Client *http.Client
	Exec   func(ctx context.Context, name string, args ...string) (string, error)
}

Cloudflared installs the connector from Cloudflare's package and runs it as a service with the tunnel's token.

func (*Cloudflared) Install

func (c *Cloudflared) Install(ctx context.Context, token string) error

type Installer

type Installer struct {
	Opts Options
	Out  io.Writer
	// Root is prepended to every path written; empty on a real server.
	Root string
	// Exec runs a command and returns its combined output.
	Exec func(ctx context.Context, name string, args ...string) (string, error)
	// Engine installs containerd and runc.
	Engine func(ctx context.Context) error
	// Proxy applies the proxy's configuration once it runs.
	Proxy func(ctx context.Context, cfg proxy.Config) error
	// SetupLink makes the one-time link for the first administrator. It
	// returns ErrAdminExists once there is one.
	SetupLink func(ctx context.Context) (string, error)
	// Cloudflared installs the tunnel's connector; see cloudflared.go.
	Cloudflared func(ctx context.Context, token string) error
	// Self is the binary running the install.
	Self string
	// contains filtered or unexported fields
}

Installer does the install. Its fields that touch the machine are replaced in tests.

func (*Installer) Run

func (in *Installer) Run(ctx context.Context) error

Run installs Zelie and prints what it did.

type Mode

type Mode string

How the panel is reached.

const (
	// ModeDomain: the proxy answers on 80 and 443 and gets certificates
	// from Let's Encrypt.
	ModeDomain Mode = "domain"
	// ModeIP: no domain; the proxy serves a self-signed certificate.
	ModeIP Mode = "ip"
	// ModeTunnel: a Cloudflare Tunnel brings the traffic; the proxy only
	// listens on a loopback port.
	ModeTunnel Mode = "tunnel"
)

type Options

type Options struct {
	Mode  Mode
	Host  string // the panel's domain, or the server's IP address
	Email string // for Let's Encrypt, in domain mode
	Port  int    // loopback port, in tunnel mode
	// Cloudflared is the command Cloudflare shows for connecting a new
	// tunnel, pasted as it is. Only needed when no connector runs yet.
	Cloudflared string
}

Options are the answers the install needs.

func (*Options) Check

func (o *Options) Check() error

Check reports what is wrong with the answers, if anything.

Jump to

Keyboard shortcuts

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