Documentation
¶
Index ¶
- Constants
- Variables
- func CheckForConf(confPath string) (string, error)
- func CheckRouterPorts() error
- func Cleanup(app App) error
- func CreateAppTable() *uitable.Table
- func GetActiveAppRoot(siteName string) (string, error)
- func GetApps() map[string][]App
- func GetRouterStatus() string
- func RenderAppRow(table *uitable.Table, row map[string]interface{})
- func RenderHomeRootedDir(path string) string
- func RenderRouterStatus() string
- func RouterComposeYAMLPath() string
- func StartDdevRouter() error
- func StopRouter() error
- type App
- type LocalApp
- func (l *LocalApp) AddHostsEntry() error
- func (l *LocalApp) AppConfDir() string
- func (l *LocalApp) AppRoot() string
- func (l *LocalApp) ComposeFiles() []string
- func (l *LocalApp) CreateSettingsFile() error
- func (l *LocalApp) Describe() (map[string]interface{}, error)
- func (l *LocalApp) DockerComposeYAMLPath() string
- func (l *LocalApp) DockerEnv()
- func (l LocalApp) Docroot() string
- func (l *LocalApp) Down(removeData bool) error
- func (l *LocalApp) Exec(service string, cmd ...string) (string, string, error)
- func (l *LocalApp) ExecWithTty(service string, cmd ...string) error
- func (l *LocalApp) FindContainerByType(containerType string) (docker.APIContainers, error)
- func (l *LocalApp) GetName() string
- func (l *LocalApp) GetType() string
- func (l *LocalApp) HostName() string
- func (l *LocalApp) Import() error
- func (l *LocalApp) ImportDB(imPath string, extPath string) error
- func (l *LocalApp) ImportFiles(imPath string, extPath string) error
- func (l *LocalApp) Init(basePath string) error
- func (l *LocalApp) Logs(service string, follow bool, timestamps bool, tail string) error
- func (l *LocalApp) ProcessHooks(hookName string) error
- func (l *LocalApp) SiteStatus() string
- func (l *LocalApp) Start() error
- func (l *LocalApp) Stop() error
- func (l *LocalApp) URL() string
- func (l *LocalApp) Wait(containerTypes ...string) error
Constants ¶
const DdevRouterTemplate = `` /* 392-byte string literal not displayed */
DdevRouterTemplate is the template for the generic router container.
const RouterProjectName = "ddev-router"
RouterProjectName is the "machine name" of the router docker-compose
const SiteConfigMissing = ".ddev/config.yaml missing"
SiteConfigMissing defines the string used to denote when a site is missing its .ddev/config.yml file.
const SiteDirMissing = "app directory missing"
SiteDirMissing defines the string used to denote when a site is missing its application directory.
const SiteNotFound = "not found"
SiteNotFound defines the string used to denote a site where the containers were not found/do not exist.
const SiteRunning = "running"
SiteRunning defines the string used to denote running sites.
const SiteStopped = "stopped"
SiteStopped defines the string used to denote when a site is in the stopped state.
Variables ¶
var PluginMap = map[string]App{ "local": &LocalApp{}, }
PluginMap maps the name of the plugins to their implementation.
var SequelproTemplate = `` /* 1773-byte string literal not displayed */
SequelproTemplate is the template for Sequelpro config.
Functions ¶
func CheckForConf ¶
CheckForConf checks for a config.yaml at the cwd or parent dirs.
func CheckRouterPorts ¶ added in v0.9.4
func CheckRouterPorts() error
CheckRouterPorts tries to connect to ports 80/443 as a heuristic to find out if they're available for docker to bind to. Returns an error if either one results in a successful connection.
func Cleanup ¶
Cleanup will remove ddev containers and volumes even if docker-compose.yml has been deleted.
func CreateAppTable ¶
CreateAppTable will create a new app table for describe and list output
func GetActiveAppRoot ¶
GetActiveAppRoot returns the fully rooted directory of the active app, or an error
func GetRouterStatus ¶ added in v0.9.4
func GetRouterStatus() string
GetRouterStatus outputs router status and warning if not running or healthy, as applicable.
func RenderAppRow ¶
RenderAppRow will add an application row to an existing table for describe and list output.
func RenderHomeRootedDir ¶
RenderHomeRootedDir shortens a directory name to replace homedir with ~
func RenderRouterStatus ¶ added in v0.9.4
func RenderRouterStatus() string
RenderRouterStatus returns a user-friendly string showing router-status
func RouterComposeYAMLPath ¶
func RouterComposeYAMLPath() string
RouterComposeYAMLPath returns the full filepath to the routers docker-compose yaml file.
func StopRouter ¶
func StopRouter() error
StopRouter stops the local router if there are no ddev containers running.
Types ¶
type App ¶
type App interface {
Init(string) error
Describe() (map[string]interface{}, error)
GetType() string
AppRoot() string
GetName() string
Start() error
Stop() error
DockerEnv()
DockerComposeYAMLPath() string
Down(removeData bool) error
CreateSettingsFile() error
HostName() string
URL() string
Import() error
ImportDB(imPath string, extPath string) error
ImportFiles(imPath string, extPath string) error
SiteStatus() string
FindContainerByType(containerType string) (docker.APIContainers, error)
// Returns err, stdout, stderr
Exec(service string, cmd ...string) (string, string, error)
ExecWithTty(service string, cmd ...string) error
Logs(service string, follow bool, timestamps bool, tail string) error
}
App is an interface apps for Drud Local must implement to use shared functionality
func GetActiveApp ¶
GetActiveApp returns the active App based on the current working directory or running siteName provided. To use the current working directory, siteName should be ""
func GetPluginApp ¶
GetPluginApp will return an application of the type specified by pluginType
type LocalApp ¶
LocalApp implements the platform.App interface
func (*LocalApp) AddHostsEntry ¶
AddHostsEntry will add the local site URL to the local hostfile.
func (*LocalApp) AppConfDir ¶
AppConfDir returns the full path to the app's .ddev configuration directory
func (*LocalApp) ComposeFiles ¶
ComposeFiles returns a list of compose files for a project.
func (*LocalApp) CreateSettingsFile ¶ added in v0.9.4
CreateSettingsFile creates the app's settings.php or equivalent, adding things like database host, name, and password
func (*LocalApp) Describe ¶
Describe returns a map which provides detailed information on services associated with the running site.
func (*LocalApp) DockerComposeYAMLPath ¶
DockerComposeYAMLPath returns the absolute path to where the docker-compose.yaml should exist for this app configuration. This is a bit redundant, but is here to avoid having to expose too many details of AppConfig.
func (*LocalApp) DockerEnv ¶
func (l *LocalApp) DockerEnv()
DockerEnv sets environment variables for a docker-compose run.
func (*LocalApp) Exec ¶
Exec executes a given command in the container of given type without allocating a pty Returns ComposeCmd results of stdout, stderr, err
func (*LocalApp) ExecWithTty ¶ added in v0.9.4
ExecWithTty executes a given command in the container of given type. It allocates a pty for interactive work.
func (*LocalApp) FindContainerByType ¶
FindContainerByType will find a container for this site denoted by the containerType if it is available.
func (*LocalApp) Import ¶
Import performs an import from the a configured provider plugin, if one exists.
func (*LocalApp) ImportDB ¶
ImportDB takes a source sql dump and imports it to an active site's database container.
func (*LocalApp) ImportFiles ¶
ImportFiles takes a source directory or archive and copies to the uploaded files directory of a given app.
func (*LocalApp) Init ¶
Init populates LocalApp config based on the current working directory. It does not start the containers.
func (*LocalApp) ProcessHooks ¶
ProcessHooks executes commands defined in a ddevapp.Command
func (*LocalApp) SiteStatus ¶
SiteStatus returns the current status of an application determined from web and db service health.