ddevapp

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2019 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderDrudS3   = "drud-s3"
	ProviderPantheon = "pantheon"

	// ProviderDefault contains the name of the default provider which will be used if one is not otherwise specified.
	ProviderDefault = "default"
)

Providers

View Source
const (
	PHP56 = "5.6"
	PHP70 = "7.0"
	PHP71 = "7.1"
	PHP72 = "7.2"
	PHP73 = "7.3"
	PHP74 = "7.4"
)

PHP Versions

View Source
const (
	MariaDB101 = "10.1"
	MariaDB102 = "10.2"
)

MariaDB Versions

View Source
const (
	DdevSSHAgentContainer = "ddev-ssh-agent"
	DBAContainer          = "dba"
	DBContainer           = "db"
	WebContainer          = "web"
	RouterContainer       = "ddev-router"
	BGSYNCContainer       = "bgsync"
)

Container types used with ddev

View Source
const (
	WebserverNginxFPM  = "nginx-fpm"
	WebserverApacheFPM = "apache-fpm"
	WebserverApacheCGI = "apache-cgi"
)

Webserver types

View Source
const (
	AppTypeBackdrop  = "backdrop"
	AppTypeDrupal6   = "drupal6"
	AppTypeDrupal7   = "drupal7"
	AppTypeDrupal8   = "drupal8"
	AppTypePHP       = "php"
	AppTypeTYPO3     = "typo3"
	AppTypeWordPress = "wordpress"
)

App types

View Source
const (
	// DdevDefaultRouterHTTPPort is the default router HTTP port
	DdevDefaultRouterHTTPPort = "80"

	// DdevDefaultRouterHTTPSPort is the default router HTTPS port
	DdevDefaultRouterHTTPSPort = "443"
	// DdevDefaultPHPMyAdminPort is the default router port for dba/PHPMyadmin
	DdevDefaultPHPMyAdminPort = "8036"
	// DdevDefaultMailhogPort is the default router port for Mailhog
	DdevDefaultMailhogPort = "8025"
	// DdevDefaultTLD is the top-level-domain used by default, can be overridden
	DdevDefaultTLD = "ddev.site"
)

Ports and other defaults

View Source
const BackdropDdevSettingsTemplate = `` /* 1032-byte string literal not displayed */

BackdropDdevSettingsTemplate defines the template that will become settings.ddev.php.

View Source
const ConfigInstructions = `` /* 4995-byte string literal not displayed */

ConfigInstructions is used to add example hooks usage

View Source
const DDevComposeTemplate = `` /* 6267-byte string literal not displayed */

DDevComposeTemplate is used to create the main docker-compose.yaml file for a ddev site.

View Source
const DdevFileSignature = "#ddev-generated"

DdevFileSignature is the text we use to detect whether a settings file is managed by us. If this string is found, we assume we can replace/update the file.

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

DdevRouterTemplate is the template for the generic router container.

View Source
const DdevSSHAuthTemplate = `` /* 762-byte string literal not displayed */
View Source
const Drupal7Hooks = `#  post-import-db:
#    - exec: drush cc all
`

Drupal7Hooks adds a d7-specific hooks example for post-import-db

View Source
const Drupal8Hooks = `# post-import-db:
#   - exec: drush cr
#   - exec: drush updb
`

Drupal8Hooks adds a d8-specific hooks example for post-import-db

View Source
const PHPDefault = PHP72

PHPDefault is the default PHP version, overridden by $DDEV_PHP_VERSION

View Source
const RouterProjectName = "ddev-router"

RouterProjectName is the "machine name" of the router docker-compose

View Source
const SSHAuthName = "ddev-ssh-agent"

SSHAuthName is the "machine name" of the ddev-ssh-agent docker-compose service

View Source
const SiteConfigMissing = ".ddev/config.yaml missing"

SiteConfigMissing defines the string used to denote when a site is missing its .ddev/config.yml file.

View Source
const SiteDirMissing = "project directory missing"

SiteDirMissing defines the string used to denote when a site is missing its application directory.

View Source
const SitePaused = "paused"

SitePaused defines the string used to denote when a site is in the paused (docker stopped) state.

View Source
const SiteRunning = "running"

SiteRunning defines the string used to denote running sites.

View Source
const SiteStarting = "starting"

SiteStarting

View Source
const SiteStopped = "stopped"

SiteStopped defines the string used to denote a site where the containers were not found/do not exist, but the project is there.

View Source
const Typo3Hooks = `#  post-start:
#    - exec: composer install -d /var/www/html
`

Typo3Hooks adds a TYPO3-specific hooks example for post-import-db

Variables

View Source
var NFSMountEnabledDefault = false

NFSMountEnabledDefault is default value for app.NFSMountEnabled

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

SequelproTemplate is the template for Sequelpro config.

View Source
var ValidMariaDBVersions = map[string]bool{
	MariaDB101: true,
	MariaDB102: true,
}
View Source
var ValidPHPVersions = map[string]bool{
	PHP56: true,
	PHP70: true,
	PHP71: true,
	PHP72: true,
	PHP73: true,
	PHP74: true,
}

ValidPHPVersions should be updated whenever PHP versions are added or removed, and should be used to ensure user-supplied values are valid.

ValidProviders should be updated whenever provider plugins are added or removed, and should be used to ensure user-supplied values are valid.

ValidWebserverTypes should be updated whenever supported webserver types are added or removed, and should be used to ensure user-supplied values are valid.

View Source
var WebcacheEnabledDefault = false

WebcacheEnabledDefault is the default value for app.WebCacheEnabled

View Source
var WebserverDefault = WebserverNginxFPM

WebserverDefault is the default webserver type, overridden by $DDEV_WEBSERVER_TYPE

Functions

func AvailableDocrootLocations added in v0.15.0

func AvailableDocrootLocations() []string

AvailableDocrootLocations returns an of default docroot locations to look for.

func CheckForConf added in v0.11.0

func CheckForConf(confPath string) (string, error)

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

func CheckForMissingProjectFiles added in v1.6.0

func CheckForMissingProjectFiles(project *DdevApp) error

CheckForMissingProjectFiles returns an error if the project's configuration or project root cannot be found

func CheckRouterPorts added in v0.11.0

func CheckRouterPorts() error

CheckRouterPorts tries to connect to the ports the router will use 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 added in v0.11.0

func Cleanup(app *DdevApp) error

Cleanup will remove ddev containers and volumes even if docker-compose.yml has been deleted.

func CreateAppTable added in v0.11.0

func CreateAppTable() *uitable.Table

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

func CreateGitIgnore added in v1.1.0

func CreateGitIgnore(targetDir string, ignores ...string) error

CreateGitIgnore will create a .gitignore file in the target directory if one does not exist. Each value in ignores will be added as a new line to the .gitignore.

func CreateSSHAuthComposeFile added in v1.4.0

func CreateSSHAuthComposeFile() (string, error)

CreateSSHAuthComposeFile creates the docker-compose file for the ddev-ssh-agent

func DiscoverDefaultDocroot added in v0.15.0

func DiscoverDefaultDocroot(app *DdevApp) string

DiscoverDefaultDocroot returns the default docroot directory.

func FindDdevRouter added in v1.8.0

func FindDdevRouter() (*docker.APIContainers, error)

FindDdevRouter usees FindContainerByLabels to get our router container and return it.

func GetActiveAppRoot added in v0.11.0

func GetActiveAppRoot(siteName string) (string, error)

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

func GetCAROOT added in v1.9.0

func GetCAROOT() string

func GetErrLogsFromApp added in v1.5.0

func GetErrLogsFromApp(app *DdevApp, errorReceived error) (string, error)

GetErrLogsFromApp is used to do app.Logs on an app after an error has been received, especially on app.Start. This is really for testing only

func GetInstrumentationUser added in v1.10.0

func GetInstrumentationUser() string

GetInstrumentationUser normally gets just the hashed hostID but if an explicit user is provided in global_config.yaml that will be prepended.

func GetPort added in v1.10.0

func GetPort(service string) string

GetPort returns the external router (as a string) for the given service. This can be used to find a given port for docker-compose manifests, or for automated testing.

func GetRouterStatus added in v0.11.0

func GetRouterStatus() (string, string)

GetRouterStatus retur s router status and warning if not running or healthy, as applicable. return status and most recent log

func GetSSHAuthStatus added in v1.4.0

func GetSSHAuthStatus() string

GetSSHAuthStatus outputs sshAuth status and warning if not running or healthy, as applicable.

func GetValidAppTypes added in v0.11.0

func GetValidAppTypes() []string

GetValidAppTypes returns the valid apptype keys from the appTypeMatrix

func GetValidMariaDBVersions added in v1.5.0

func GetValidMariaDBVersions() []string

GetValidMariaDBVersions is a helper function that returns a list of valid MariaDB versions.

func GetValidOmitContainers added in v1.4.0

func GetValidOmitContainers() []string

GetValidOmitContainers is a helper function that returns a list of valid containers for OmitContainers.

func GetValidPHPVersions added in v1.3.0

func GetValidPHPVersions() []string

GetValidPHPVersions is a helper function that returns a list of valid PHP versions.

func GetValidProviders added in v1.3.0

func GetValidProviders() []string

GetValidProviders is a helper function that returns a list of valid providers.

func GetValidWebserverTypes added in v1.3.0

func GetValidWebserverTypes() []string

GetValidWebserverTypes is a helper function that returns a list of valid webserver types.

func IsValidAppType added in v0.11.0

func IsValidAppType(apptype string) bool

IsValidAppType is a helper function to determine if an app type is valid, returning true if the given app type is valid and configured and false otherwise.

func IsValidMariaDBVersion added in v1.5.0

func IsValidMariaDBVersion(MariaDBVersion string) bool

IsValidMariaDBVersion is a helper function to determine if a MariaDB version is valid, returning true if the supplied MariaDB version is valid and false otherwise.

func IsValidOmitContainers added in v1.4.0

func IsValidOmitContainers(containerList []string) bool

IsValidOmitContainers is a helper function to determine if a the OmitContainers array is valid

func IsValidPHPVersion added in v1.3.0

func IsValidPHPVersion(phpVersion string) bool

IsValidPHPVersion is a helper function to determine if a PHP version is valid, returning true if the supplied PHP version is valid and false otherwise.

func IsValidProvider added in v1.3.0

func IsValidProvider(provider string) bool

IsValidProvider is a helper function to determine if a provider value is valid, returning true if the supplied provider is valid and false otherwise.

func IsValidWebserverType added in v1.3.0

func IsValidWebserverType(webserverType string) bool

IsValidWebserverType is a helper function to determine if a webserver type is valid, returning true if the supplied webserver type is valid and false otherwise.

func PrepDdevDirectory

func PrepDdevDirectory(dir string) error

PrepDdevDirectory creates a .ddev directory in the current working directory

func RemoveSSHAgentContainer added in v1.4.0

func RemoveSSHAgentContainer() error

RemoveSSHAgentContainer brings down the ddev-ssh-agent if it's running.

func RenderAppRow added in v0.11.0

func RenderAppRow(table *uitable.Table, row map[string]interface{})

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

func RenderHomeRootedDir added in v0.11.0

func RenderHomeRootedDir(path string) string

RenderHomeRootedDir shortens a directory name to replace homedir with ~

func RenderRouterStatus added in v0.11.0

func RenderRouterStatus() string

RenderRouterStatus returns a user-friendly string showing router-status

func RenderSSHAuthStatus added in v1.4.0

func RenderSSHAuthStatus() string

RenderSSHAuthStatus returns a user-friendly string showing sshAuth-status

func RouterComposeYAMLPath added in v0.11.0

func RouterComposeYAMLPath() string

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

func SSHAuthComposeYAMLPath added in v1.4.0

func SSHAuthComposeYAMLPath() string

SSHAuthComposeYAMLPath returns the full filepath to the ssh-auth docker-compose yaml file.

func SegmentEvent added in v1.10.0

func SegmentEvent(client analytics.Client, hashedID string, event string) error

SegmentEvent provides the event and traits that go with it.

func SegmentUser added in v1.10.0

func SegmentUser(client analytics.Client, hashedID string) error

SegmentUser does the enqueue of the Identify action, identifying the user Here we just use the hashed hostid as the user id

func SendInstrumentationEvents added in v1.10.0

func SendInstrumentationEvents(event string)

SendInstrumentationEvents does the actual send to sentry/segment

func SetInstrumentationBaseTags added in v1.10.0

func SetInstrumentationBaseTags()

SetInstrumentationBaseTags sets the basic always-used tags for Sentry/Raven/Segment

func StartDdevRouter added in v0.11.0

func StartDdevRouter() error

StartDdevRouter ensures the router is running.

func StopRouterIfNoContainers added in v0.12.0

func StopRouterIfNoContainers() error

StopRouterIfNoContainers stops the router if there are no ddev containers running.

func WaitForSync added in v1.5.0

func WaitForSync(app *DdevApp, seconds int)

WaitForSync is a test helper; it's hard to know exactly when the bgsync container will have completed syncing an operation, so we do app.WaitSync() and add the number of seconds provided.

func WriteBuildDockerfile added in v1.10.0

func WriteBuildDockerfile(fullpath string, userDockerfile string, extraPackages []string) error

WriteBuildDockerfile writes a Dockerfile to be used in the docker-compose 'build' It may include the contents of .ddev/<container>-build

func WriteDrushYML added in v1.9.0

func WriteDrushYML(app *DdevApp, filePath string) error

WriteDrushYML writes a drush.yaml to set the default uri

func WriteDrushrc added in v1.9.0

func WriteDrushrc(app *DdevApp, filePath string) error

WriteDrushrc writes out drushrc.php based on passed-in values. This works on Drupal 6 and Drupal 7 or with drush8 and older

func WriteImageDockerfile added in v1.8.0

func WriteImageDockerfile(fullpath string, contents []byte) error

WriteImageDockerfile writes a dockerfile at the fullpath (including the filename)

Types

type AppTypeFuncs added in v0.11.0

type AppTypeFuncs struct {
	// contains filtered or unexported fields
}

AppTypeFuncs struct defines the functions that can be called (if populated) for a given appType.

type BackdropSettings added in v0.13.0

type BackdropSettings struct {
	DatabaseName     string
	DatabaseUsername string
	DatabasePassword string
	DatabaseHost     string
	DatabaseDriver   string
	DatabasePort     string
	DatabasePrefix   string
	HashSalt         string
	Signature        string
	SiteSettings     string
	SiteSettingsDdev string
	DockerIP         string
	DBPublishedPort  int
}

BackdropSettings holds database connection details for Backdrop.

func NewBackdropSettings added in v0.13.0

func NewBackdropSettings(app *DdevApp) *BackdropSettings

NewBackdropSettings produces a BackdropSettings object with default values.

type ComposerTask added in v1.9.0

type ComposerTask struct {
	// contains filtered or unexported fields
}

func (ComposerTask) Execute added in v1.9.0

func (c ComposerTask) Execute() (string, string, error)

Execute (ComposerTask) runs a composer command in the web container and returns stdout, stderr, err

func (ComposerTask) GetDescription added in v1.9.0

func (c ComposerTask) GetDescription() string

GetDescription returns a human-readable description of the task

type DdevApp added in v0.11.0

type DdevApp struct {
	APIVersion           string   `yaml:"APIVersion"`
	Name                 string   `yaml:"name"`
	Type                 string   `yaml:"type"`
	Docroot              string   `yaml:"docroot"`
	PHPVersion           string   `yaml:"php_version"`
	WebserverType        string   `yaml:"webserver_type"`
	WebImage             string   `yaml:"webimage,omitempty"`
	BgsyncImage          string   `yaml:"bgsyncimage,omitempty"`
	DBImage              string   `yaml:"dbimage,omitempty"`
	DBAImage             string   `yaml:"dbaimage,omitempty"`
	RouterHTTPPort       string   `yaml:"router_http_port"`
	RouterHTTPSPort      string   `yaml:"router_https_port"`
	XdebugEnabled        bool     `yaml:"xdebug_enabled"`
	AdditionalHostnames  []string `yaml:"additional_hostnames"`
	AdditionalFQDNs      []string `yaml:"additional_fqdns"`
	MariaDBVersion       string   `yaml:"mariadb_version"`
	WebcacheEnabled      bool     `yaml:"webcache_enabled,omitempty"`
	NFSMountEnabled      bool     `yaml:"nfs_mount_enabled"`
	ConfigPath           string   `yaml:"-"`
	AppRoot              string   `yaml:"-"`
	Platform             string   `yaml:"-"`
	Provider             string   `yaml:"provider,omitempty"`
	DataDir              string   `yaml:"-"`
	SiteSettingsPath     string   `yaml:"-"`
	SiteDdevSettingsFile string   `yaml:"-"`

	Hooks                 map[string][]YAMLTask `yaml:"hooks,omitempty"`
	UploadDir             string                `yaml:"upload_dir,omitempty"`
	WorkingDir            map[string]string     `yaml:"working_dir,omitempty"`
	OmitContainers        []string              `yaml:"omit_containers,omitempty,flow"`
	HostDBPort            string                `yaml:"host_db_port,omitempty"`
	HostWebserverPort     string                `yaml:"host_webserver_port,omitempty"`
	HostHTTPSPort         string                `yaml:"host_https_port,omitempty"`
	MailhogPort           string                `yaml:"mailhog_port,omitempty"`
	PHPMyAdminPort        string                `yaml:"phpmyadmin_port,omitempty"`
	WebImageExtraPackages []string              `yaml:"webimage_extra_packages,omitempty,flow"`
	DBImageExtraPackages  []string              `yaml:"dbimage_extra_packages,omitempty,flow"`
	ProjectTLD            string                `yaml:"project_tld,omitempty"`
	UseDNSWhenPossible    bool                  `yaml:"use_dns_when_possible"`
	MkcertEnabled         bool                  `yaml:"-"`
	NgrokArgs             string                `yaml:"ngrok_args,omitempty"`
	Timezone              string                `yaml:"timezone"`
	// contains filtered or unexported fields
}

DdevApp is the struct that represents a ddev app, mostly its config from config.yaml.

func GetActiveApp added in v0.11.0

func GetActiveApp(siteName string) (*DdevApp, error)

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 GetActiveProjects added in v1.9.0

func GetActiveProjects() []*DdevApp

GetActiveProjects returns an array of ddev projects that are currently live in docker.

func GetProjects added in v1.9.0

func GetProjects(activeOnly bool) ([]*DdevApp, error)

GetProjects returns projects that are listed in globalconfig projectlist (or in docker container labels, or both) if activeOnly is true, only show projects that aren't stopped (or broken, missing config, missing files)

func NewApp added in v0.11.0

func NewApp(AppRoot string, includeOverrides bool, provider string) (*DdevApp, error)

NewApp creates a new DdevApp struct with defaults set and overridden by any existing config.yml.

func (*DdevApp) AddHostsEntriesIfNeeded added in v1.9.0

func (app *DdevApp) AddHostsEntriesIfNeeded() error

AddHostsEntriesIfNeeded will (optionally) add the site URL to the host's /etc/hosts.

func (*DdevApp) AppConfDir added in v0.11.0

func (app *DdevApp) AppConfDir() string

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

func (*DdevApp) AppTypePrompt added in v1.0.0

func (app *DdevApp) AppTypePrompt() error

AppTypePrompt handles the Type workflow.

func (*DdevApp) CaptureLogs added in v1.4.0

func (app *DdevApp) CaptureLogs(service string, timestamps bool, tailLines string) (string, error)

CaptureLogs returns logs for a site's given container. See docker.LogsOptions for more information about valid tailLines values.

func (*DdevApp) CheckCustomConfig added in v0.15.0

func (app *DdevApp) CheckCustomConfig()

CheckCustomConfig warns the user if any custom configuration files are in use.

func (*DdevApp) ComposeFiles added in v0.11.0

func (app *DdevApp) ComposeFiles() ([]string, error)

ComposeFiles returns a list of compose files for a project. It has to put the docker-compose.y*l first It has to put the docker-compose.override.y*l last

func (*DdevApp) Composer added in v1.9.0

func (app *DdevApp) Composer(args []string) (string, string, error)

Composer runs composer commands in the web container, managing pre- and post- hooks

func (*DdevApp) ConfigExists added in v0.11.0

func (app *DdevApp) ConfigExists() bool

ConfigExists determines if a ddev config file exists for this application.

func (*DdevApp) ConfigFileOverrideAction added in v0.12.0

func (app *DdevApp) ConfigFileOverrideAction() error

ConfigFileOverrideAction gives a chance for an apptype to override any element of config.yaml that it needs to (on initial creation, but not after that)

func (*DdevApp) CreateSettingsFile added in v0.11.0

func (app *DdevApp) CreateSettingsFile() (string, error)

CreateSettingsFile creates the settings file (like settings.php) for the provided app is the apptype has a settingsCreator function.

func (*DdevApp) DefaultWorkingDirMap added in v1.4.0

func (app *DdevApp) DefaultWorkingDirMap() map[string]string

DefaultWorkingDirMap returns the app type's default working directory map.

func (*DdevApp) Describe added in v0.11.0

func (app *DdevApp) Describe() (map[string]interface{}, error)

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

func (*DdevApp) DetectAppType added in v0.11.0

func (app *DdevApp) DetectAppType() string

DetectAppType calls each apptype's detector until it finds a match, or returns 'php' as a last resort.

func (*DdevApp) DetermineSettingsPathLocation added in v0.11.0

func (app *DdevApp) DetermineSettingsPathLocation() (string, error)

DetermineSettingsPathLocation figures out the path to the settings file for an app based on the contents/existence of app.SiteSettingsPath and app.SiteDdevSettingsFile.

func (*DdevApp) DockerComposeYAMLPath added in v0.11.0

func (app *DdevApp) DockerComposeYAMLPath() string

DockerComposeYAMLPath returns the absolute path to where the docker-compose.yaml should exist for this app.

func (*DdevApp) DockerEnv added in v0.11.0

func (app *DdevApp) DockerEnv()

DockerEnv sets environment variables for a docker-compose run.

func (*DdevApp) EnsureSSHAgentContainer added in v1.4.0

func (app *DdevApp) EnsureSSHAgentContainer() error

EnsureSSHAgentContainer ensures the ssh-auth container is running.

func (*DdevApp) Exec added in v0.11.0

func (app *DdevApp) Exec(opts *ExecOpts) (string, string, error)

Exec executes a given command in the container of given type without allocating a pty Returns ComposeCmd results of stdout, stderr, err If Nocapture arg is true, stdout/stderr will be empty and output directly to stdout/stderr

func (*DdevApp) ExecWithTty added in v0.11.0

func (app *DdevApp) ExecWithTty(opts *ExecOpts) error

ExecWithTty executes a given command in the container of given type. It allocates a pty for interactive work.

func (*DdevApp) ExportDB added in v1.4.0

func (app *DdevApp) ExportDB(outFile string, gzip bool) error

ExportDB exports the db, with optional output to a file, default gzip

func (*DdevApp) FindContainerByType added in v0.11.0

func (app *DdevApp) FindContainerByType(containerType string) (*docker.APIContainers, error)

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

func (*DdevApp) GetAllURLs added in v0.17.0

func (app *DdevApp) GetAllURLs() (httpURLs []string, httpsURLs []string, allURLs []string)

GetAllURLs returns an array of all the URLs for the project

func (*DdevApp) GetAppRoot added in v0.11.0

func (app *DdevApp) GetAppRoot() string

GetAppRoot return the full path from root to the app directory

func (*DdevApp) GetConfigPath added in v0.11.0

func (app *DdevApp) GetConfigPath(filename string) string

GetConfigPath returns the path to an application config file specified by filename.

func (DdevApp) GetDocroot added in v0.11.0

func (app DdevApp) GetDocroot() string

GetDocroot returns the docroot path for ddev app

func (*DdevApp) GetHTTPSURL added in v0.12.0

func (app *DdevApp) GetHTTPSURL() string

GetHTTPSURL returns the HTTPS URL for an app.

func (*DdevApp) GetHTTPURL added in v0.12.0

func (app *DdevApp) GetHTTPURL() string

GetHTTPURL returns the HTTP URL for an app.

func (*DdevApp) GetHookDefaultComments added in v0.11.0

func (app *DdevApp) GetHookDefaultComments() []byte

GetHookDefaultComments gets the actual text of the config.yaml hook suggestions for a given apptype

func (*DdevApp) GetHostname added in v0.11.0

func (app *DdevApp) GetHostname() string

GetHostname returns the primary hostname of the app.

func (*DdevApp) GetHostnames added in v0.17.0

func (app *DdevApp) GetHostnames() []string

GetHostnames returns an array of all the configured hostnames.

func (*DdevApp) GetNFSMountVolName added in v1.5.9

func (app *DdevApp) GetNFSMountVolName() string

Returns the docker volume name of the nfs mount volume

func (*DdevApp) GetName added in v0.11.0

func (app *DdevApp) GetName() string

GetName returns the app's name

func (*DdevApp) GetPhpVersion added in v0.12.0

func (app *DdevApp) GetPhpVersion() string

GetPhpVersion returns the app's php version

func (*DdevApp) GetProvider added in v0.11.0

func (app *DdevApp) GetProvider() (Provider, error)

GetProvider returns a pointer to the provider instance interface.

func (*DdevApp) GetPublishedPort added in v1.1.0

func (app *DdevApp) GetPublishedPort(serviceName string) (int, error)

GetPublishedPort returns the host-exposed public port of a container.

func (*DdevApp) GetType added in v0.11.0

func (app *DdevApp) GetType() string

GetType returns the application type as a (lowercase) string

func (*DdevApp) GetUnisonCatalogVolName added in v1.5.0

func (app *DdevApp) GetUnisonCatalogVolName() string

Returns the docker volume name of the unisoncatalogvolume

func (*DdevApp) GetUploadDir added in v0.11.0

func (app *DdevApp) GetUploadDir() string

GetUploadDir returns the upload (public files) directory for the given app

func (*DdevApp) GetWebContainerDirectHTTPSURL added in v1.8.0

func (app *DdevApp) GetWebContainerDirectHTTPSURL() string

GetWebContainerDirectHTTPSURL returns the URL that can be used without the router to get to web container via https.

func (*DdevApp) GetWebContainerDirectHTTPURL added in v1.9.0

func (app *DdevApp) GetWebContainerDirectHTTPURL() string

GetWebContainerDirectHTTPURL returns the URL that can be used without the router to get to web container.

func (*DdevApp) GetWebContainerHTTPSPublicPort added in v1.8.0

func (app *DdevApp) GetWebContainerHTTPSPublicPort() (int, error)

GetWebContainerHTTPSPublicPort returns the direct-access public tcp port for https

func (*DdevApp) GetWebContainerPublicPort added in v1.3.0

func (app *DdevApp) GetWebContainerPublicPort() (int, error)

GetWebContainerPublicPort returns the direct-access public tcp port for http

func (*DdevApp) GetWebcacheVolName added in v1.5.0

func (app *DdevApp) GetWebcacheVolName() string

Returns the docker volume name of the webcachevol

func (*DdevApp) GetWebserverType added in v1.2.0

func (app *DdevApp) GetWebserverType() string

GetWebserverType returns the app's webserver type (nginx-fpm/apache-fpm/apache-cgi)

func (*DdevApp) GetWorkingDir added in v1.10.0

func (app *DdevApp) GetWorkingDir(service string, dir string) string

GetWorkingDir will determine the appropriate working directory for an Exec/ExecWithTty command by consulting with the project configuration. If no dir is specified for the service, an empty string will be returned.

func (*DdevApp) HostName added in v0.11.0

func (app *DdevApp) HostName() string

HostName returns the hostname of a given application.

func (*DdevApp) ImportDB added in v0.11.0

func (app *DdevApp) ImportDB(imPath string, extPath string, progress bool) error

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

func (*DdevApp) ImportFiles added in v0.11.0

func (app *DdevApp) ImportFiles(importPath string, extPath string) error

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

func (*DdevApp) ImportFilesAction added in v1.1.0

func (app *DdevApp) ImportFilesAction(importPath, extPath string) error

ImportFilesAction executes the relevant import files workflow for each app type.

func (*DdevApp) Init added in v0.11.0

func (app *DdevApp) Init(basePath string) error

Init populates DdevApp config based on the current working directory. It does not start the containers.

func (*DdevApp) LoadConfigYamlFile added in v1.7.0

func (app *DdevApp) LoadConfigYamlFile(filePath string) error

LoadConfigYamlFile loads one config.yaml into app, overriding what might be there.

func (*DdevApp) Logs added in v0.11.0

func (app *DdevApp) Logs(service string, follow bool, timestamps bool, tailLines string) error

Logs returns logs for a site's given container. See docker.LogsOptions for more information about valid tailLines values.

func (*DdevApp) Pause added in v1.8.0

func (app *DdevApp) Pause() error

Pause initiates docker-compose stop

func (*DdevApp) PostConfigAction added in v0.12.0

func (app *DdevApp) PostConfigAction() error

PostConfigAction gives a chance for an apptype to override do something at the end of ddev config.

func (*DdevApp) PostImportDBAction added in v0.11.0

func (app *DdevApp) PostImportDBAction() error

PostImportDBAction calls each apptype's detector until it finds a match, or returns 'php' as a last resort.

func (*DdevApp) PostStartAction added in v0.20.0

func (app *DdevApp) PostStartAction() error

PostStartAction gives a chance for an apptype to do something after the app has been started.

func (*DdevApp) ProcessHooks added in v0.11.0

func (app *DdevApp) ProcessHooks(hookName string) error

ProcessHooks executes Tasks defined in Hooks

func (*DdevApp) PromptForConfig added in v0.11.0

func (app *DdevApp) PromptForConfig() error

PromptForConfig goes through a set of prompts to receive user input and generate an Config struct.

func (*DdevApp) Pull added in v1.3.0

func (app *DdevApp) Pull(provider Provider, opts *PullOptions) error

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

func (*DdevApp) ReadConfig added in v0.11.0

func (app *DdevApp) ReadConfig(includeOverrides bool) ([]string, error)

ReadConfig reads project configuration from the config.yaml file It does not attempt to set default values; that's NewApp's job.

func (*DdevApp) RemoveGlobalProjectInfo added in v1.7.0

func (app *DdevApp) RemoveGlobalProjectInfo()

RemoveGlobalProjectInfo() deletes the project from ProjectList

func (*DdevApp) RemoveHostsEntries added in v1.1.0

func (app *DdevApp) RemoveHostsEntries() error

RemoveHostsEntries will remote the site URL from the host's /etc/hosts.

func (*DdevApp) RenderComposeYAML added in v0.11.0

func (app *DdevApp) RenderComposeYAML() (string, error)

RenderComposeYAML renders the contents of docker-compose.yaml.

func (*DdevApp) RestoreSnapshot added in v1.1.0

func (app *DdevApp) RestoreSnapshot(snapshotName string) error

RestoreSnapshot restores a mariadb snapshot of the db to be loaded The project must be stopped and docker volume removed and recreated for this to work.

func (*DdevApp) SetApptypeSettingsPaths added in v0.11.0

func (app *DdevApp) SetApptypeSettingsPaths()

SetApptypeSettingsPaths chooses and sets the settings.php/settings.local.php and related paths for a given app.

func (*DdevApp) SetInstrumentationAppTags added in v1.10.0

func (app *DdevApp) SetInstrumentationAppTags()

SetInstrumentationAppTags creates app-specific tags for Sentry/Raven/Segment

func (*DdevApp) SiteStatus added in v0.11.0

func (app *DdevApp) SiteStatus() string

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

func (*DdevApp) Snapshot added in v1.9.0

func (app *DdevApp) Snapshot(snapshotName string) (string, error)

Snapshot forces a mariadb snapshot of the db to be written into .ddev/db_snapshots Returns the dirname of the snapshot and err

func (*DdevApp) Start added in v0.11.0

func (app *DdevApp) Start() error

Start initiates docker-compose up

func (*DdevApp) StartAndWaitForSync added in v1.5.0

func (app *DdevApp) StartAndWaitForSync(extraSleep int) error

StartAndWaitForSync() is primarily for use in tests. It does app.Start() but then waits for syncing to be in progress before returning. extraSleep arg in seconds is the time to wait if > 0

func (*DdevApp) Stop added in v0.11.0

func (app *DdevApp) Stop(removeData bool, createSnapshot bool) error

Stops and Removes the docker containers for the project in current directory.

func (*DdevApp) SyncStatus added in v1.5.0

func (app *DdevApp) SyncStatus() (string, error)

func (*DdevApp) UpdateGlobalProjectList added in v1.9.0

func (app *DdevApp) UpdateGlobalProjectList() error

UpdateGlobalProjectList updates any information about project that is tracked in global project list: - approot - configured host ports checks that configured host ports are not already reserved by another project

func (*DdevApp) ValidateConfig added in v0.11.0

func (app *DdevApp) ValidateConfig() error

ValidateConfig ensures the configuration meets ddev's requirements.

func (*DdevApp) Wait added in v0.11.0

func (app *DdevApp) Wait(requiredContainers []string) error

Wait ensures that the app service containers are healthy.

func (*DdevApp) WaitSync added in v1.5.0

func (app *DdevApp) WaitSync() error

WaitSync waits for bgsync container to be consistently syncing.

func (*DdevApp) WarnIfConfigReplace added in v0.11.0

func (app *DdevApp) WarnIfConfigReplace()

WarnIfConfigReplace just messages user about whether config is being replaced or created

func (*DdevApp) WriteConfig added in v0.11.0

func (app *DdevApp) WriteConfig() error

WriteConfig writes the app configuration into the .ddev folder.

func (*DdevApp) WriteDockerComposeConfig added in v0.11.0

func (app *DdevApp) WriteDockerComposeConfig() error

WriteDockerComposeConfig writes a docker-compose.yaml to the app configuration directory.

type DefaultProvider

type DefaultProvider struct{}

DefaultProvider provides a no-op for the provider plugin interface methods.

func (*DefaultProvider) GetBackup

func (p *DefaultProvider) GetBackup(backupType, environment string) (fileLocation string, importPath string, err error)

GetBackup provides a no-op for the GetBackup operation.

func (*DefaultProvider) Init

func (p *DefaultProvider) Init(app *DdevApp) error

Init provides a no-op for the Init operation.

func (*DefaultProvider) PromptForConfig added in v0.9.4

func (p *DefaultProvider) PromptForConfig() error

PromptForConfig provides a no-op for the Config operation.

func (*DefaultProvider) Read

func (p *DefaultProvider) Read(configPath string) error

Read provides a no-op for the Read operation.

func (*DefaultProvider) Validate

func (p *DefaultProvider) Validate() error

Validate always succeeds, because the default provider is a fine provider.

func (*DefaultProvider) ValidateField

func (p *DefaultProvider) ValidateField(field, value string) error

ValidateField provides a no-op for the ValidateField operation.

func (*DefaultProvider) Write

func (p *DefaultProvider) Write(configPath string) error

Write provides a no-op for the Write operation.

type DrudS3Provider added in v1.1.0

type DrudS3Provider struct {
	ProviderType string `yaml:"provider"`

	EnvironmentName string `yaml:"environment"`
	AWSAccessKey    string `yaml:"aws_access_key_id"`
	AWSSecretKey    string `yaml:"aws_secret_access_key"`
	S3Bucket        string `yaml:"s3_bucket"`
	// contains filtered or unexported fields
}

DrudS3Provider provides DrudS3-specific import functionality.

func (*DrudS3Provider) GetBackup added in v1.1.0

func (p *DrudS3Provider) GetBackup(backupType, environment string) (fileLocation string, importPath string, err error)

GetBackup will download the most recent backup specified by backupType in the given environment. If no environment is supplied, the configured environment will be used. Valid values for backupType are "database" or "files".

func (*DrudS3Provider) GetEnvironments added in v1.1.0

func (p *DrudS3Provider) GetEnvironments() (map[string]interface{}, error)

GetEnvironments will return a list of environments for the currently configured upstream DrudS3 site.

func (*DrudS3Provider) Init added in v1.1.0

func (p *DrudS3Provider) Init(app *DdevApp) error

Init handles loading data from saved config.

func (*DrudS3Provider) PromptForConfig added in v1.1.0

func (p *DrudS3Provider) PromptForConfig() error

PromptForConfig provides interactive configuration prompts when running `ddev config DrudS3` 0. Get AWS keys if they don't already exist 1. Get bucketnames accessible 2. If only one bucket, choose it 3. Get projects, this project (same exact name) must exist in the bucket, choose it 4. Get environments, if only one, choose it

func (*DrudS3Provider) Read added in v1.1.0

func (p *DrudS3Provider) Read(configPath string) error

Read DrudS3 provider configuration from a specified location on disk.

func (*DrudS3Provider) Validate added in v1.1.0

func (p *DrudS3Provider) Validate() error

Validate ensures that the current configuration is valid (i.e. the configured DrudS3 site/environment exists) If the environment exists, the project exists, and the AWS keys are working right.

func (*DrudS3Provider) ValidateField added in v1.1.0

func (p *DrudS3Provider) ValidateField(field, value string) error

ValidateField provides field level validation for config settings. This is used any time a field is set via `ddev config` on the primary app config, and allows provider plugins to have additional validation for top level config settings.

func (*DrudS3Provider) Write added in v1.1.0

func (p *DrudS3Provider) Write(configPath string) error

Write the DrudS3 provider configuration to a spcified location on disk.

type DrupalSettings added in v0.11.0

type DrupalSettings struct {
	DeployName       string
	DeployURL        string
	DatabaseName     string
	DatabaseUsername string
	DatabasePassword string
	DatabaseHost     string
	DatabaseDriver   string
	DatabasePort     string
	DatabasePrefix   string
	HashSalt         string
	Signature        string
	SitePath         string
	SiteSettings     string
	SiteSettingsDdev string
	SyncDir          string
	DockerIP         string
	DBPublishedPort  int
}

DrupalSettings encapsulates all the configurations for a Drupal site.

func NewDrupalSettings added in v0.11.0

func NewDrupalSettings(app *DdevApp) *DrupalSettings

NewDrupalSettings produces a DrupalSettings object with default.

type ExecHostTask added in v1.9.0

type ExecHostTask struct {
	// contains filtered or unexported fields
}

ExecHostTask is the struct that defines "exec-host" tasks for hooks, commands that get run on the host.

func (ExecHostTask) Execute added in v1.9.0

func (c ExecHostTask) Execute() (string, string, error)

Execute (HostTask) executes a command in a container, by default the web container, and returns stdout, stderr, err

func (ExecHostTask) GetDescription added in v1.9.0

func (c ExecHostTask) GetDescription() string

GetDescription returns a human-readable description of the task

type ExecOpts added in v1.4.0

type ExecOpts struct {
	// Service is the service, as in 'web', 'db', 'dba'
	Service string
	// Dir is the working directory inside the container
	Dir string
	// Cmd is the string to execute
	Cmd string
	// Nocapture if true causes use of ComposeNoCapture, so the stdout and stderr go right to stdout/stderr
	NoCapture bool
	// Tty if true causes a tty to be allocated
	Tty bool
	// Stdout can be overridden with a File
	Stdout *os.File
	// Stderr can be overridden with a File
	Stderr *os.File
}

ExecOpts contains options for running a command inside a container

type ExecTask added in v1.9.0

type ExecTask struct {
	// contains filtered or unexported fields
}

ExecTask is the struct that defines "exec" tasks for hooks, commands to be run in containers.

func (ExecTask) Execute added in v1.9.0

func (c ExecTask) Execute() (string, string, error)

Execute() executes an ExecTask

func (ExecTask) GetDescription added in v1.9.0

func (c ExecTask) GetDescription() string

GetDescription returns a human-readable description of the task

type InvalidOmitContainers added in v1.5.0

type InvalidOmitContainers error

type PantheonProvider

type PantheonProvider struct {
	ProviderType string `yaml:"provider"`

	Sitename string `yaml:"site"`

	EnvironmentName string `yaml:"environment"`
	// contains filtered or unexported fields
}

PantheonProvider provides pantheon-specific import functionality.

func (*PantheonProvider) GetBackup

func (p *PantheonProvider) GetBackup(backupType, environment string) (fileLocation string, importPath string, err error)

GetBackup will download the most recent backup specified by backupType in the given environment. If no environment is supplied, the configured environment will be used. Valid values for backupType are "database" or "files".

func (*PantheonProvider) GetEnvironments

func (p *PantheonProvider) GetEnvironments() (pantheon.EnvironmentList, error)

GetEnvironments will return a list of environments for the currently configured upstream pantheon site.

func (*PantheonProvider) Init

func (p *PantheonProvider) Init(app *DdevApp) error

Init handles loading data from saved config.

func (*PantheonProvider) PromptForConfig added in v0.9.4

func (p *PantheonProvider) PromptForConfig() error

PromptForConfig provides interactive configuration prompts when running `ddev config pantheon`

func (*PantheonProvider) Read

func (p *PantheonProvider) Read(configPath string) error

Read pantheon provider configuration from a specified location on disk.

func (*PantheonProvider) SetSiteNameAndEnv added in v0.9.4

func (p *PantheonProvider) SetSiteNameAndEnv(environment string)

SetSiteNameAndEnv sets the environment of the provider (dev/test/live)

func (*PantheonProvider) Validate

func (p *PantheonProvider) Validate() error

Validate ensures that the current configuration is valid (i.e. the configured pantheon site/environment exists)

func (*PantheonProvider) ValidateField

func (p *PantheonProvider) ValidateField(field, value string) error

ValidateField provides field level validation for config settings. This is used any time a field is set via `ddev config` on the primary app config, and allows provider plugins to have additional validation for top level config settings.

func (*PantheonProvider) Write

func (p *PantheonProvider) Write(configPath string) error

Write the pantheon provider configuration to a spcified location on disk.

type Provider

type Provider interface {
	Init(app *DdevApp) error
	ValidateField(string, string) error
	PromptForConfig() error
	Write(string) error
	Read(string) error
	Validate() error
	GetBackup(string, string) (fileLocation string, importPath string, err error)
}

Provider is the interface which all provider plugins must implement.

type PullOptions added in v1.3.0

type PullOptions struct {
	SkipDb      bool
	SkipFiles   bool
	SkipImport  bool
	Environment string
}

PullOptions allows for customization of the pull process.

type Task added in v1.9.0

type Task interface {
	Execute() (string, string, error)
	GetDescription() string
}

Task is the interface defining methods we'll use in various tasks

func NewTask added in v1.9.0

func NewTask(app *DdevApp, ytask YAMLTask) Task

NewTask() is the factory method to create whatever kind of task we need using the yaml description of the task. Returns a task (of various types) or nil

type WordpressConfig added in v0.11.0

type WordpressConfig struct {
	WPGeneric        bool
	DeployName       string
	DeployURL        string
	DatabaseName     string
	DatabaseUsername string
	DatabasePassword string
	DatabaseHost     string
	AuthKey          string
	SecureAuthKey    string
	LoggedInKey      string
	NonceKey         string
	AuthSalt         string
	SecureAuthSalt   string
	LoggedInSalt     string
	NonceSalt        string
	Docroot          string
	TablePrefix      string
	Signature        string
	SiteSettings     string
	SiteSettingsDdev string
	AbsPath          string
}

WordpressConfig encapsulates all the configurations for a WordPress site.

func NewWordpressConfig added in v0.11.0

func NewWordpressConfig(app *DdevApp, absPath string) *WordpressConfig

NewWordpressConfig produces a WordpressConfig object with defaults.

type YAMLTask added in v1.9.0

type YAMLTask map[string]interface{}

YAMLTask defines tasks like Exec to be run in hooks

Jump to

Keyboard shortcuts

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