trellis

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigDir string = ".trellis"
View Source
const DefaultSiteName = "example.com"
View Source
const GlobPattern = "group_vars/*/wordpress_sites.yml"
View Source
const OldPathEnvName string = "PRE_TRELLIS_PATH"
View Source
const PathEnvName string = "PATH"
View Source
const Template = `
[{{ .Environment }}]
{{ .Host }}

[web]
{{ .Host }}
`
View Source
const TrellisVenvEnvName string = "TRELLIS_VENV"
View Source
const VenvEnvName string = "VIRTUAL_ENV"
View Source
const VirtualenvDir string = "virtualenv"

Variables

This section is empty.

Functions

func IsFileEncrypted

func IsFileEncrypted(filepath string) (isEncrypted bool, err error)

func LoadFixtureProject

func LoadFixtureProject(t *testing.T) func()

func TestChdir

func TestChdir(t *testing.T, dir string) func()

Types

type Config

type Config struct {
	WordPressSites map[string]*Site `yaml:"wordpress_sites"`
}

type Detector

type Detector interface {
	Detect(path string) (projectPath string, ok bool)
}

type Hosts

type Hosts struct {
	Environment string
	Host        string
}

type Project

type Project struct{}

func (*Project) Detect

func (p *Project) Detect(path string) (projectPath string, ok bool)

Detect if a path is a Trellis project or not This will traverse up the directory tree until it finds a valid project, or stop at the root and give up.

type RandomStringGenerator

type RandomStringGenerator struct {
	Length int
}

func (*RandomStringGenerator) Generate

func (rs *RandomStringGenerator) Generate() string

type Requirement

type Requirement struct {
	Name              string
	Command           string
	Url               string
	VersionConstraint string
	ExtractVersion    func(output string) string
}

func (*Requirement) Check

func (r *Requirement) Check() (result RequirementResult, err error)

func (*Requirement) IsInstalled

func (r *Requirement) IsInstalled() (path string, ok bool)

type RequirementResult

type RequirementResult struct {
	Satisfied bool
	Installed bool
	Version   string
}

type Site

type Site struct {
	SiteHosts       []SiteHost             `yaml:"site_hosts"`
	LocalPath       string                 `yaml:"local_path"`
	AdminEmail      string                 `yaml:"admin_email,omitempty"`
	Branch          string                 `yaml:"branch,omitempty"`
	Repo            string                 `yaml:"repo,omitempty"`
	RepoSubtreePath string                 `yaml:"repo_subtree_path,omitempty"`
	Multisite       map[string]interface{} `yaml:"multisite"`
	Ssl             map[string]interface{} `yaml:"ssl"`
	Cache           map[string]interface{} `yaml:"cache"`
}

func (*Site) MainHost

func (s *Site) MainHost() string

type SiteHost

type SiteHost struct {
	Canonical string   `yaml:"canonical"`
	Redirects []string `yaml:"redirects"`
}

type StringGenerator

type StringGenerator interface {
	Generate() string
}

type Trellis

type Trellis struct {
	Environments    map[string]*Config
	ConfigPath      string
	Path            string
	Virtualenv      *Virtualenv
	VenvInitialized bool
	// contains filtered or unexported fields
}

func NewTrellis

func NewTrellis(d Detector) *Trellis

func (*Trellis) ActivateProject

func (t *Trellis) ActivateProject() bool

Activates a Trellis project's virtualenv without loading the config files. This is optimized to be a lighter weight version of LoadProject more suitable for the shell hook.

func (*Trellis) AutocompleteEnvironment

func (t *Trellis) AutocompleteEnvironment() complete.Predictor

func (*Trellis) AutocompleteSite

func (t *Trellis) AutocompleteSite() complete.Predictor

func (*Trellis) CheckVirtualenv added in v1.2.0

func (t *Trellis) CheckVirtualenv(ui cli.Ui)

func (*Trellis) CreateConfigDir

func (t *Trellis) CreateConfigDir() error

func (*Trellis) Detect

func (t *Trellis) Detect(path string) (projectPath string, ok bool)

Detect if a path is a Trellis project or not This will traverse up the directory tree until it finds a valid project, or stop at the root and give up.

func (*Trellis) EnvironmentNames

func (t *Trellis) EnvironmentNames() []string

func (*Trellis) FindSiteNameFromEnvironment

func (t *Trellis) FindSiteNameFromEnvironment(environment string, siteNameArg string) (string, error)

func (*Trellis) GenerateSite

func (t *Trellis) GenerateSite(site *Site, host string, env string)

func (*Trellis) GenerateVaultConfig

func (t *Trellis) GenerateVaultConfig(name string, env string, randomString StringGenerator) *Vault

func (*Trellis) GenerateVaultPassFile

func (t *Trellis) GenerateVaultPassFile(path string) error

func (*Trellis) HostsFromDomain

func (t *Trellis) HostsFromDomain(domain string, env string) (canonical *publicsuffix.DomainName, redirect *publicsuffix.DomainName)

func (*Trellis) LoadProject

func (t *Trellis) LoadProject() error

Loads a Trellis project. If a project is detected, the wordpress_sites config files are parsed and the directory is changed to the project path.

func (*Trellis) ParseConfig

func (t *Trellis) ParseConfig(path string) *Config

func (*Trellis) PredictEnvironment

func (t *Trellis) PredictEnvironment() complete.PredictFunc

func (*Trellis) PredictSite

func (t *Trellis) PredictSite() complete.PredictFunc

func (*Trellis) SiteFromEnvironmentAndName

func (t *Trellis) SiteFromEnvironmentAndName(environment string, name string) *Site

func (*Trellis) SiteNamesFromEnvironment

func (t *Trellis) SiteNamesFromEnvironment(environment string) []string

func (*Trellis) UpdateAnsibleConfig

func (t *Trellis) UpdateAnsibleConfig(section string, key string, value string) error

func (*Trellis) UpdateDefaultConfig

func (t *Trellis) UpdateDefaultConfig(config *Config, name string, host string, env string)

func (*Trellis) UpdateHosts

func (t *Trellis) UpdateHosts(env string, ip string) (path string, err error)

func (*Trellis) ValidateEnvironment

func (t *Trellis) ValidateEnvironment(name string) (err error)

func (*Trellis) WriteYamlFile

func (t *Trellis) WriteYamlFile(s interface{}, path string, header string) error

type Vault

type Vault struct {
	MysqlRootPassword string                        `yaml:"vault_mysql_root_password"`
	Users             []VaultUser                   `yaml:"vault_users,omitempty"`
	WordPressSites    map[string]VaultWordPressSite `yaml:"vault_wordpress_sites"`
}

type VaultUser

type VaultUser struct {
	Name     string `yaml:"name"`
	Password string `yaml:"password"`
	Salt     string `yaml:"salt"`
}

type VaultWordPressSite

type VaultWordPressSite struct {
	AdminPassword string                `yaml:"admin_password"`
	Env           VaultWordPressSiteEnv `yaml:"env"`
}

type VaultWordPressSiteEnv

type VaultWordPressSiteEnv struct {
	DbPassword     string `yaml:"db_password"`
	AuthKey        string `yaml:"auth_key,omitempty"`
	SecureAuthKey  string `yaml:"secure_auth_key,omitempty"`
	LoggedInKey    string `yaml:"logged_in_key,omitempty"`
	NonceKey       string `yaml:"nonce_key,omitempty"`
	AuthSalt       string `yaml:"auth_salt,omitempty"`
	SecureAuthSalt string `yaml:"secure_auth_salt,omitempty"`
	LoggedInSalt   string `yaml:"logged_in_salt,omitempty"`
	NonceSalt      string `yaml:"nonce_salt,omitempty"`
}

type Virtualenv

type Virtualenv struct {
	Path    string
	BinPath string
	OldPath string
}

func NewVirtualenv

func NewVirtualenv(path string) *Virtualenv

func (*Virtualenv) Activate

func (v *Virtualenv) Activate()

func (*Virtualenv) Active

func (v *Virtualenv) Active() bool

func (*Virtualenv) Create

func (v *Virtualenv) Create() (err error)

func (*Virtualenv) Deactivate

func (v *Virtualenv) Deactivate()

func (*Virtualenv) Initialized

func (v *Virtualenv) Initialized() bool

func (*Virtualenv) Install

func (v *Virtualenv) Install() string

func (*Virtualenv) Installed

func (v *Virtualenv) Installed() (ok bool, cmd *exec.Cmd)

func (*Virtualenv) LocalPath

func (v *Virtualenv) LocalPath() string

Jump to

Keyboard shortcuts

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