platform

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2017 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const DdevRouterTemplate = `` /* 352-byte string literal not displayed */

DdevRouterTemplate is the template for the generic router container.

View Source
const SiteNotFound = "not found"

SiteNotFound defines the string used to denote a site where the containers were not found/do not exist.

View Source
const SiteRunning = "running"

SiteRunning defines the string used to denote running sites.

View Source
const SiteStopped = "stopped"

SiteStopped defines the string used to denote when a site is in the stopped state.

Variables

View Source
var PluginMap = map[string]App{
	"local": &LocalApp{},
}

PluginMap maps the name of the plugins to their implementation.

View Source
var SequelproTemplate = `` /* 1773-byte string literal not displayed */

SequelproTemplate is the template for Sequelpro config.

Functions

func CheckForConf

func CheckForConf(confPath string) (string, error)

CheckForConf checks for a config.yaml at the cwd or parent dirs.

func Cleanup

func Cleanup(app App) error

Cleanup will clean up ddev apps even if the composer file has been deleted.

func CreateAppTable

func CreateAppTable() *uitable.Table

CreateAppTable will create a new app table for describe and list output

func GetActiveAppRoot

func GetActiveAppRoot(siteName string) (string, error)

GetActiveAppRoot returns the fully rooted directory of the active app, or an error

func GetApps

func GetApps() map[string][]App

GetApps returns a list of ddev applictions keyed by platform.

func PrintRouterStatus

func PrintRouterStatus() string

PrintRouterStatus outputs router status and warning if not running or healthy, as applicable.

func RenderAppRow

func RenderAppRow(table *uitable.Table, site App)

RenderAppRow will add an application row to an existing table for describe and list output.

func RenderAppTable

func RenderAppTable(platform string, apps []App)

RenderAppTable will format a table for user display based on a list of apps.

func RenderHomeRootedDir

func RenderHomeRootedDir(path string) string

RenderHomeRootedDir shortens a directory name to replace homedir with ~

func RouterComposeYAMLPath

func RouterComposeYAMLPath() string

RouterComposeYAMLPath returns the full filepath to the routers docker-compose yaml file.

func StartDdevRouter

func StartDdevRouter() error

StartDdevRouter ensures the router is running.

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() (string, error)
	GetType() string
	AppRoot() string
	GetName() string
	Start() error
	Stop() error
	DockerEnv()
	DockerComposeYAMLPath() string
	Down(removeData bool) error
	Config() 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)
	Exec(service string, tty bool, 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

func GetActiveApp(siteName string) (App, error)

GetActiveApp returns the active App based on the current working directory or running siteName provided.

func GetPluginApp

func GetPluginApp(pluginType string) (App, error)

GetPluginApp will return an application of the type specified by pluginType

type LocalApp

type LocalApp struct {
	AppConfig *ddevapp.Config
}

LocalApp implements the AppBase interface local development apps

func (*LocalApp) AddHostsEntry

func (l *LocalApp) AddHostsEntry() error

AddHostsEntry will add the local site URL to the local hostfile.

func (*LocalApp) AppConfDir

func (l *LocalApp) AppConfDir() string

AppConfDir returns the full path to the app's .ddev configuration directory

func (*LocalApp) AppRoot

func (l *LocalApp) AppRoot() string

AppRoot return the full path from root to the app directory

func (*LocalApp) ComposeFiles

func (l *LocalApp) ComposeFiles() []string

ComposeFiles returns a list of compose files for a project.

func (*LocalApp) Config

func (l *LocalApp) Config() error

Config creates the apps config file adding things like database host, name, and password as well as other sensitive data like salts.

func (*LocalApp) Describe

func (l *LocalApp) Describe() (string, error)

Describe returns a string which provides detailed information on services associated with the running site.

func (*LocalApp) DockerComposeYAMLPath

func (l *LocalApp) DockerComposeYAMLPath() string

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) Docroot

func (l LocalApp) Docroot() string

Docroot returns the docroot path for local app

func (*LocalApp) Down

func (l *LocalApp) Down(removeData bool) error

Down stops the docker containers for the local project.

func (*LocalApp) Exec

func (l *LocalApp) Exec(service string, tty bool, cmd ...string) error

Exec executes a given command in the container of given type.

func (*LocalApp) FindContainerByType

func (l *LocalApp) FindContainerByType(containerType string) (docker.APIContainers, error)

FindContainerByType will find a container for this site denoted by the containerType if it is available.

func (*LocalApp) GetName

func (l *LocalApp) GetName() string

GetName returns the name for local app

func (*LocalApp) GetType

func (l *LocalApp) GetType() string

GetType returns the application type as a (lowercase) string

func (*LocalApp) HostName

func (l *LocalApp) HostName() string

HostName returns the hostname of a given application.

func (*LocalApp) Import

func (l *LocalApp) Import() error

Import performs an import from the a configured provider plugin, if one exists.

func (*LocalApp) ImportDB

func (l *LocalApp) ImportDB(imPath string, extPath string) error

ImportDB takes a source sql dump and imports it to an active site's database container.

func (*LocalApp) ImportFiles

func (l *LocalApp) ImportFiles(imPath string, extPath string) error

ImportFiles takes a source directory or archive and copies to the uploaded files directory of a given app.

func (*LocalApp) Init

func (l *LocalApp) Init(basePath string) error

Init populates LocalApp settings based on the current working directory.

func (*LocalApp) Logs

func (l *LocalApp) Logs(service string, follow bool, timestamps bool, tail string) error

Logs returns logs for a site's given container.

func (*LocalApp) ProcessHooks

func (l *LocalApp) ProcessHooks(hookName string) error

ProcessHooks executes commands defined in a ddevapp.Command

func (*LocalApp) SiteStatus

func (l *LocalApp) SiteStatus() string

SiteStatus returns the current status of an application determined from web and db service health.

func (*LocalApp) Start

func (l *LocalApp) Start() error

Start initiates docker-compose up

func (*LocalApp) Stop

func (l *LocalApp) Stop() error

Stop initiates docker-compose stop

func (*LocalApp) URL

func (l *LocalApp) URL() string

URL returns the URL for a given application.

func (*LocalApp) Wait

func (l *LocalApp) Wait(containerTypes ...string) error

Wait ensures that the app service containers are healthy.

Jump to

Keyboard shortcuts

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