systemd

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SYSTEMD_DIR_PATH         = "/etc/systemd"
	INOX_SERVICE_UNIT_NAME   = "inox"
	INOX_SERVICE_UNIT_PATH   = SYSTEMD_DIR_PATH + "/system/" + INOX_SERVICE_UNIT_NAME + ".service"
	INOX_SERVICE_UNIT_FPERMS = 0o644

	SYSTEMCTL_CMD_NAME = "systemctl"

	DEFAULT_CPU_QUOTA_PERCENT_PER_CPU = 75 //75%
)
View Source
const (
	DEFAULT_INOXD_ENV_FILE_PATH = "/run/inoxd/env"
	INOXD_ENV_FILE_PERMS        = fs.FileMode(0o440)
	INOXD_ENV_FILE_DIR_PERMS    = fs.FileMode(0o770)
)

Variables

View Source
var (
	ErrUnitFileExists = errors.New("unit file already exists")
	ErrNoSystemd      = errors.New("systemd does not seem to be the init system on this machine")
	ErrNotRoot        = errors.New("current user is not root")
)
View Source
var (
	ErrBadEnvFilePerms = errors.New(
		"the permissions of the inoxd environment file are not " + strconv.FormatUint(uint64(INOXD_ENV_FILE_PERMS), 8))
	ErrEnvFileNotOwnedByRoot      = errors.New("the inoxd environment file is not owned by root")
	ErrEnvFileNotOwnedByRootGroup = errors.New("the inoxd environment file is not owned by the root group")
)
View Source
var (
	SYSTEMCTL_ALLOWED_LOCATIONS = []string{"/usr/bin/systemctl", "/usr/sbin/systemctl", "/bin/systemctl", "/sbin/systemctl"}
)

Functions

func CheckFileDoesNotExist

func CheckFileDoesNotExist() error

func CreateInoxdEnvFileIfNotExists

func CreateInoxdEnvFileIfNotExists(outW io.Writer, input EnvFileCreationParams) (path string, _ error)

CreateInoxdEnvFileIfNotExists creates an environment file to be used by systemd to start inoxd. The file contains EXTREMELY SENSITIVE information: INOXD_MASTER_KEYSET: a set of master keys primarily used to encrypt and decrypt keys. CLOUDFLARE_ORIGIN_CERTIFICATE: the origin certificate delivered by Cloudflare.

func EnableInoxd

func EnableInoxd(unitName string, out io.Writer, errOut io.Writer) error

func StartInoxd

func StartInoxd(unitName string, restart bool, out io.Writer, errOut io.Writer) error

func StopRemoveUnit

func StopRemoveUnit(removeEnvFile bool, out io.Writer, errOut io.Writer) error

func WriteInoxUnitFile

func WriteInoxUnitFile(args InoxUnitParams) (unitName string, _ error)

WriteInoxUnitFile writes the unit file for inoxd at INOX_SERVICE_UNIT_PATH, if the file already exists ErrUnitFileExists is returned and unitName is set.

Types

type EnvFileCreationParams

type EnvFileCreationParams struct {
	CloudflareOriginCertificate string //optional, if set CLOUDFLARE_ORIGIN_CERTIFICATE is set.
}

type InoxUnitParams

type InoxUnitParams struct {
	Username, Homedir string
	UID               int
	Log               io.Writer

	InoxCloud   bool
	EnvFilePath string //optional
	ProjectsDir string
	ProdDir     string //optional

	ExposeProjectServers   bool
	ExposeWebServers       bool
	TunnelProviderName     string //optional
	AllowBrowserAutomation bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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