ddevapp

package
v1.22.0-beta4 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: Apache-2.0 Imports: 53 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SiteRunning defines the string used to denote running sites.
	SiteRunning  = "running"
	SiteStarting = "starting"

	// SiteStopped means a site where the containers were not found/do not exist, but the project is there.
	SiteStopped = "stopped"

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

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

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

	// SiteUnhealthy is the status for a project whose services are not all reporting healthy yet
	SiteUnhealthy = "unhealthy"
)
View Source
const (
	// WarnTypeAbsent warns if type is absent
	WarnTypeAbsent = iota
	// WarnTypeNotConfigured warns if type not configured
	WarnTypeNotConfigured = iota
)
View Source
const ConfigInstructions = `` /* 10111-byte string literal not displayed */

ConfigInstructions is used to add example hooks usage

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 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 Typo3Hooks = `#  post-start:
#    - exec: composer install -d /var/www/html
`

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

Variables

DatabaseDefault is the default database/version

View Source
var ReportableEvents = map[string]bool{"start": true}

ReportableEvents is the list of events that we choose to report specifically. Excludes non-ddev custom commands.

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

SequelproTemplate is the template for Sequelpro config.

Functions

func AddHostEntry added in v1.21.5

func AddHostEntry(name string, ip string) error

AddHostEntry adds an entry to default hosts file This is only used by `ddev hostname` and only used with admin privs

func AvailablePHPDocrootLocations added in v1.22.0

func AvailablePHPDocrootLocations() []string

AvailablePHPDocrootLocations 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.21.5

func CheckForMissingProjectFiles(project *DdevApp) error

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

func CheckMutagenVolumeSyncCompatibility added in v1.21.5

func CheckMutagenVolumeSyncCompatibility(app *DdevApp) (ok bool, volumeExists bool, info string)

CheckMutagenVolumeSyncCompatibility checks to see if the mutagen label and volume label are the same. Compatible if:

  • No volume (or no volume and no mutagen sync session)
  • Volume and mutagen sync exist and Volume label matches mutagen label

Not compatible if

  • Volume and mutagen sync exist and have different labels
  • Volume exists (with label) but there's no mutagen sync session matching it. In this case we'd want to start from scratch with a new volume and sync, so we get authoritative files from alpha (host)
  • Volume has a label that is not based on this docker context.

Return ok, info, where ok true if compatible, info gives reasoning

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(out *bytes.Buffer, wrapTableText bool) table.Writer

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 CreateOrResumeMutagenSync added in v1.21.5

func CreateOrResumeMutagenSync(app *DdevApp) error

CreateOrResumeMutagenSync creates or resumes a sync session It detects problems with the sync and errors if there are problems

func DiscoverDefaultDocroot added in v0.15.0

func DiscoverDefaultDocroot(app *DdevApp) string

DiscoverDefaultDocroot returns the default docroot directory.

func DownloadMutagen added in v1.21.5

func DownloadMutagen() error

DownloadMutagen gets the mutagen binary and related and puts it into ~/.ddev/.bin

func DownloadMutagenIfNeeded added in v1.21.5

func DownloadMutagenIfNeeded() error

DownloadMutagenIfNeeded downloads mutagen if we don't have it or there's an update

func DownloadMutagenIfNeededAndEnabled added in v1.22.0

func DownloadMutagenIfNeededAndEnabled(app *DdevApp) error

DownloadMutagenIfNeededAndEnabled downloads the proper version of mutagen if it's enabled and if it's either not yet installed or has the wrong version.

func EnvToUniqueEnv added in v1.21.5

func EnvToUniqueEnv(inSlice *[]string) []string

EnvToUniqueEnv() makes sure that only the last occurrence of an env (NAME=val) slice is actually retained.

func ExtractProjectNames added in v1.21.5

func ExtractProjectNames(apps []*DdevApp) []string

ExtractProjectNames returns a list of names by a bunch of projects

func FindDdevRouter added in v1.21.5

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

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

func FormatSiteStatus added in v1.21.5

func FormatSiteStatus(status string) string

FormatSiteStatus formats "paused" or "running" with color

func FullRenderedRouterComposeYAMLPath added in v1.21.5

func FullRenderedRouterComposeYAMLPath() string

FullRenderedRouterComposeYAMLPath returns the path of the full rendered .router-compose-full.yaml

func FullRenderedSSHAuthComposeYAMLPath added in v1.21.5

func FullRenderedSSHAuthComposeYAMLPath() string

FullRenderedSSHAuthComposeYAMLPath returns the filepath to the rendered .ssh-auth-compose-full.yaml file.

func GenerateRouterDockerfile added in v1.21.5

func GenerateRouterDockerfile() error

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 GetContainer added in v1.21.5

func GetContainer(app *DdevApp, service string) (*docker.APIContainers, error)

GetContainer returns the container struct of the app service name provided.

func GetContainerName added in v1.21.5

func GetContainerName(app *DdevApp, service string) string

GetContainerName returns the contructed container name of the service provided.

func GetDefaultMutagenVolumeSignature added in v1.21.5

func GetDefaultMutagenVolumeSignature(_ *DdevApp) string

GetDefaultMutagenVolumeSignature gets a new volume signature to be applied to mutagen volume

func GetErrLogsFromApp added in v1.21.5

func GetErrLogsFromApp(app *DdevApp, errorReceived error) (string, 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 returns logs, healthcheck history, error

func GetExposedPort added in v1.21.5

func GetExposedPort(app *DdevApp, service string) string

GetExposedPort returns the internal exposed port (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 GetInstrumentationUser added in v1.21.5

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 GetMutagenConfigFile added in v1.21.5

func GetMutagenConfigFile(app *DdevApp) string

GetMutagenConfigFile looks to see if there's a project .mutagen.yml If nothing is found, returns empty

func GetMutagenConfigFileHash added in v1.22.0

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

GetMutagenConfigFileHash returns the SHA1 hash of the mutagen.yml

func GetMutagenConfigFileHashLabel added in v1.22.0

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

GetMutagenConfigFileHashLabel gets the com.ddev.hash- label from an existing sync session

func GetMutagenConfigFilePath added in v1.21.5

func GetMutagenConfigFilePath(app *DdevApp) string

GetMutagenConfigFilePath returns the canonical location where the mutagen.yml lives

func GetMutagenSyncLabel added in v1.21.5

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

GetMutagenSyncLabel gets the com.ddev.volume-signature label from an existing sync session

func GetMutagenVolumeLabel added in v1.21.5

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

GetMutagenVolumeLabel returns the com.ddev.volume-signature on the project_mutagen docker volume

func GetMutagenVolumeName added in v1.21.5

func GetMutagenVolumeName(app *DdevApp) string

GetMutagenVolumeName returns the name for the mutagen docker volume

func GetRouterStatus added in v0.11.0

func GetRouterStatus() (string, string)

GetRouterStatus returns 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 GetSnapshotFileFromName added in v1.21.5

func GetSnapshotFileFromName(name string, app *DdevApp) (string, error)

GetSnapshotFileFromName returns the filename corresponding to the snapshot name

func GetValidAppTypes added in v0.11.0

func GetValidAppTypes() []string

GetValidAppTypes returns the valid apptype keys from the appTypeMatrix

func IsBundledCustomCommand added in v1.22.0

func IsBundledCustomCommand(globalCommand bool, service, command string) bool

func IsHostnameInHostsFile added in v1.21.5

func IsHostnameInHostsFile(hostname string) (bool, error)

IsHostnameInHostsFile checks to see if the hostname already exists On WSL2 it normally assumes that the hosts file is in WSL2WindowsHostsFile Otherwise it lets goodhosts decide where the hosts file is.

func IsMutagenVolumeMounted added in v1.21.5

func IsMutagenVolumeMounted(app *DdevApp) (bool, error)

IsMutagenVolumeMounted checks to see if the mutagen volume is mounted

func IsRouterDisabled added in v1.21.5

func IsRouterDisabled(app *DdevApp) bool

IsRouterDisabled returns true if the router is disabled

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 IsWindowsDdevExeAvailable added in v1.21.5

func IsWindowsDdevExeAvailable() bool

IsWindowsDdevExeAvailable checks to see if we can use ddev.exe on Windows side

func List added in v1.21.5

func List(settings ListCommandSettings)

List provides the functionality for `ddev list` activeOnly if true only shows projects that are currently docker containers continuous if true keeps requesting and outputting continuously wrapTableText if true the text is wrapped instead of truncated to fit the row length continuousSleepTime is the time between reports

func MutagenMonitor added in v1.21.5

func MutagenMonitor(app *DdevApp)

MutagenMonitor shows the output of `mutagen sync monitor <syncName>`

func MutagenReset added in v1.21.5

func MutagenReset(app *DdevApp) error

MutagenReset stops (with flush), removes the docker volume, starts again (with flush)

func MutagenSyncExists added in v1.21.5

func MutagenSyncExists(app *DdevApp) bool

MutagenSyncExists detects whether the named sync exists

func MutagenSyncName added in v1.21.5

func MutagenSyncName(name string) string

MutagenSyncName transforms a projectname string into an acceptable mutagen sync "name" See restrictions on sync name at https://mutagen.io/documentation/introduction/names-labels-identifiers The input must be a valid DNS name (valid ddev project name)

func PauseMutagenSync added in v1.21.5

func PauseMutagenSync(app *DdevApp) error

PauseMutagenSync pauses a mutagen sync session

func PopulateCustomCommandFiles added in v1.21.5

func PopulateCustomCommandFiles(app *DdevApp) error

PopulateCustomCommandFiles sets up the custom command files in the project directories where they need to go.

func PopulateExamplesCommandsHomeadditions added in v1.21.5

func PopulateExamplesCommandsHomeadditions(appName string) error

PopulateExamplesCommandsHomeadditions grabs embedded assets and installs them into the named directory Note that running this with no appName (very common) can result in updating a *different* projects assets. So `ddev start something` will first update the current directory's assets (if it's a project) and then later (when called with appName) update the actual project's assets.

func PowerOff added in v1.21.5

func PowerOff()

func PrepDdevDirectory

func PrepDdevDirectory(app *DdevApp) error

PrepDdevDirectory creates a .ddev directory in the current working directory

func PullBaseContainerImages added in v1.22.0

func PullBaseContainerImages() error

PullBaseontainerImages pulls only the fundamentally needed images so they can be available early We always need web image and busybox just for housekeeping.

func ReadProjectEnvFile added in v1.21.5

func ReadProjectEnvFile(envFilePath string) (envMap map[string]string, envText string, err error)

ReadProjectEnvFile reads the .env in the project root into a envText and envMap The map has the envFile content, but without comments

func RemoveHostEntry added in v1.21.5

func RemoveHostEntry(name string, ip string) error

RemoveHostEntry removes named /etc/hosts entry if it exists This should be run with administrative privileges only and used by ddev hostname only

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(t table.Writer, 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 ResumeMutagenSync added in v1.21.5

func ResumeMutagenSync(app *DdevApp) error

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 filepath to the base .ssh-auth-compose yaml file.

func SegmentEvent added in v1.21.5

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.21.5

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.21.5

func SendInstrumentationEvents(event string)

SendInstrumentationEvents does the actual send to segment

func SetInstrumentationBaseTags added in v1.21.5

func SetInstrumentationBaseTags()

SetInstrumentationBaseTags sets the basic always-used tags for Segment

func SetMutagenVolumeOwnership added in v1.21.5

func SetMutagenVolumeOwnership(app *DdevApp) error

SetMutagenVolumeOwnership chowns the volume in use to the current user. The mutagen volume is mounted both in /var/www (where it gets used) and also on /tmp/project_mutagen (where it can be chowned without accidentally hitting lots of bind-mounted files).

func StartDdevRouter added in v0.11.0

func StartDdevRouter() error

StartDdevRouter ensures the router is running.

func StartMutagenDaemon added in v1.21.5

func StartMutagenDaemon()

StartMutagenDaemon will make sure the daemon is running

func StopMutagenDaemon added in v1.21.5

func StopMutagenDaemon()

StopMutagenDaemon will try to stop a running mutagen daemon But no problem if there wasn't one

func StopRouterIfNoContainers added in v0.12.0

func StopRouterIfNoContainers() error

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

func SyncAndPauseMutagenSession added in v1.21.5

func SyncAndPauseMutagenSession(app *DdevApp) error

SyncAndPauseMutagenSession syncs and pauses a mutagen sync session

func TerminateAllMutagenSync added in v1.21.5

func TerminateAllMutagenSync()

TerminateAllMutagenSync terminates all sync sessions

func TerminateMutagenSync added in v1.21.5

func TerminateMutagenSync(app *DdevApp) error

TerminateMutagenSync destroys a mutagen sync session It is not an error if the sync session does not exist

func ValidateProjectName added in v1.21.5

func ValidateProjectName(name string) error

ValidateProjectName checks to see if the project name works for a proper hostname

func WriteBuildDockerfile added in v1.21.5

func WriteBuildDockerfile(fullpath string, userDockerfilePath string, extraPackages []string, composerVersion string, extraContent string) error

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

func WriteDrushrc added in v1.21.5

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.21.5

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

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

func WriteProjectEnvFile added in v1.21.5

func WriteProjectEnvFile(envFilePath string, envMap map[string]string, envText string) error

WriteProjectEnvFile writes the passed envText into the project-root .env file with all items in envMap changed in envText there

Types

type BackdropSettings added in v0.13.0

type BackdropSettings struct {
	DatabaseName     string
	DatabaseUsername string
	DatabasePassword string
	DatabaseHost     string
	DatabaseDriver   string
	DatabasePort     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.21.5

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

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

func (ComposerTask) Execute added in v1.21.5

func (c ComposerTask) Execute() error

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

func (ComposerTask) GetDescription added in v1.21.5

func (c ComposerTask) GetDescription() string

GetDescription returns a human-readable description of the task

type DatabaseDesc added in v1.21.5

type DatabaseDesc struct {
	Type    string `yaml:"type"`
	Version string `yaml:"version"`
}

type DdevApp added in v0.11.0

type DdevApp struct {
	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"`
	DBImage                   string                 `yaml:"dbimage,omitempty"`
	DBAImage                  string                 `yaml:"dbaimage,omitempty"`
	RouterHTTPPort            string                 `yaml:"router_http_port,omitempty"`
	RouterHTTPSPort           string                 `yaml:"router_https_port,omitempty"`
	XdebugEnabled             bool                   `yaml:"xdebug_enabled"`
	NoProjectMount            bool                   `yaml:"no_project_mount,omitempty"`
	AdditionalHostnames       []string               `yaml:"additional_hostnames"`
	AdditionalFQDNs           []string               `yaml:"additional_fqdns"`
	MariaDBVersion            string                 `yaml:"mariadb_version,omitempty"`
	MySQLVersion              string                 `yaml:"mysql_version,omitempty"`
	Database                  DatabaseDesc           `yaml:"database"`
	PerformanceMode           types.PerformanceMode  `yaml:"performance_mode,omitempty"`
	FailOnHookFail            bool                   `yaml:"fail_on_hook_fail,omitempty"`
	BindAllInterfaces         bool                   `yaml:"bind_all_interfaces,omitempty"`
	FailOnHookFailGlobal      bool                   `yaml:"-"`
	ConfigPath                string                 `yaml:"-"`
	AppRoot                   string                 `yaml:"-"`
	DataDir                   string                 `yaml:"-"`
	SiteSettingsPath          string                 `yaml:"-"`
	SiteDdevSettingsFile      string                 `yaml:"-"`
	ProviderInstance          *Provider              `yaml:"-"`
	Hooks                     map[string][]YAMLTask  `yaml:"hooks,omitempty"`
	UploadDirDeprecated       string                 `yaml:"upload_dir,omitempty"`
	UploadDirs                []string               `yaml:"upload_dirs,omitempty"`
	WorkingDir                map[string]string      `yaml:"working_dir,omitempty"`
	OmitContainers            []string               `yaml:"omit_containers,omitempty,flow"`
	OmitContainersGlobal      []string               `yaml:"-"`
	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"`
	MailhogHTTPSPort          string                 `yaml:"mailhog_https_port,omitempty"`
	HostMailhogPort           string                 `yaml:"host_mailhog_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,omitempty"`
	ComposerRoot              string                 `yaml:"composer_root,omitempty"`
	ComposerVersion           string                 `yaml:"composer_version"`
	DisableSettingsManagement bool                   `yaml:"disable_settings_management,omitempty"`
	WebEnvironment            []string               `yaml:"web_environment"`
	NodeJSVersion             string                 `yaml:"nodejs_version"`
	DefaultContainerTimeout   string                 `yaml:"default_container_timeout,omitempty"`
	WebExtraExposedPorts      []WebExposedPort       `yaml:"web_extra_exposed_ports,omitempty"`
	WebExtraDaemons           []WebExtraDaemon       `yaml:"web_extra_daemons,omitempty"`
	OverrideConfig            bool                   `yaml:"override_config,omitempty"`
	DisableUploadDirsWarning  bool                   `yaml:"disable_upload_dirs_warning,omitempty"`
	ComposeYaml               map[string]interface{} `yaml:"-"`
}

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.21.5

func GetActiveProjects() []*DdevApp

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

func GetInactiveProjects added in v1.21.5

func GetInactiveProjects() ([]*DdevApp, error)

GetInactiveProjects returns projects that are currently running

func GetProjects added in v1.21.5

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) (*DdevApp, error)

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

func (*DdevApp) AddHostsEntriesIfNeeded added in v1.21.5

func (app *DdevApp) AddHostsEntriesIfNeeded() error

AddHostsEntriesIfNeeded will run sudo ddev hostname to the site URL to the host's /etc/hosts. This should be run without admin privs; the ddev hostname command will handle escalation.

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) CheckAddonIncompatibilities added in v1.21.5

func (app *DdevApp) CheckAddonIncompatibilities() error

CheckAddonIncompatibilities looks for problems with docker-compose.*.yaml 3rd-party services

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) CheckDeprecations added in v1.21.5

func (app *DdevApp) CheckDeprecations()

CheckDeprecations warns the user if anything in use is deprecated.

func (*DdevApp) CheckExistingAppInApproot added in v1.21.5

func (app *DdevApp) CheckExistingAppInApproot() error

CheckExistingAppInApproot looks to see if we already have a project in this approot with different name

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 .ddev/docker-compose.*.y*ml first It has to put the docker-compose.override.y*l last

func (*DdevApp) Composer added in v1.21.5

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

Composer runs composer commands in the web container, managing pre- and post- hooks returns stdout, stderr, error

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) CreateSSHAuthComposeFile added in v1.21.5

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

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

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. It also preps the ddev directory, including setting up the .ddev gitignore

func (*DdevApp) CreateUploadDirsIfNecessary added in v1.22.0

func (app *DdevApp) CreateUploadDirsIfNecessary()

CreateUploadDirsIfNecessary creates the upload dirs if it doesn't exist, so we can properly set up bind-mounts when doing mutagen. There is no need to do it if mutagen is not enabled, and we'll just respect a symlink if it exists, and the user has to figure out the right thing to do with mutagen.

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) DeleteSnapshot added in v1.21.5

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

DeleteSnapshot removes the snapshot tarball or directory inside a project

func (*DdevApp) Describe added in v0.11.0

func (app *DdevApp) Describe(short bool) (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) DockerComposeFullRenderedYAMLPath added in v1.21.5

func (app *DdevApp) DockerComposeFullRenderedYAMLPath() string

DockerComposeFullRenderedYAMLPath returns the absolute path to where the the complete generated yaml file should exist for this project.

func (*DdevApp) DockerComposeYAMLPath added in v0.11.0

func (app *DdevApp) DockerComposeYAMLPath() string

DockerComposeYAMLPath returns the absolute path to where the base generated yaml file should exist for this project.

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) ExecOnHostOrService added in v1.21.5

func (app *DdevApp) ExecOnHostOrService(service string, cmd string) error

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(dumpFile string, compressionType string, targetDB string) error

ExportDB exports the db, with optional output to a file, default gzip targetDB is the db name if not default "db"

func (*DdevApp) FindAllImages added in v1.21.5

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

FindAllImages returns an array of image tags for all containers in the compose file

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) FindMaxTimeout added in v1.21.5

func (app *DdevApp) FindMaxTimeout() int

FindMaxTimeout looks through all services and returns the max timeout found Defaults to 120

func (*DdevApp) FixObsolete added in v1.21.5

func (app *DdevApp) FixObsolete()

FixObsolete removes files that may be obsolete, etc.

func (*DdevApp) GenerateMutagenYml added in v1.21.5

func (app *DdevApp) GenerateMutagenYml() error

GenerateMutagenYml generates the .ddev/mutagen.yml

func (*DdevApp) GeneratePostgresConfig added in v1.21.5

func (app *DdevApp) GeneratePostgresConfig() error

func (*DdevApp) GenerateWebserverConfig added in v1.21.5

func (app *DdevApp) GenerateWebserverConfig() error

GenerateWebserverConfig generates the default nginx and apache config files

func (DdevApp) GetAbsAppRoot added in v1.22.0

func (app DdevApp) GetAbsAppRoot(inContainer bool) string

GetAbsAppRoot returns the absolute path to the project root on the host or if inContainer is set to true in the container.

func (DdevApp) GetAbsDocroot added in v1.22.0

func (app DdevApp) GetAbsDocroot(inContainer bool) string

GetAbsDocroot returns the absolute path to the docroot on the host or if inContainer is set to true in the container.

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) GetComposerRoot added in v1.21.5

func (app *DdevApp) GetComposerRoot(inContainer, showWarning bool) string

GetComposerRoot will determine the absolute composer root directory where all Composer related commands will be executed. If inContainer set to true, the absolute path in the container will be returned, else the absolute path on the host. If showWarning set to true, a warning containing the composer root will be shown to the user to avoid confusion.

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) GetDBImage added in v1.21.5

func (app *DdevApp) GetDBImage() string

GetDBImage uses the available version info

func (DdevApp) GetDocroot added in v0.11.0

func (app DdevApp) GetDocroot() string

GetDocroot returns the docroot path for ddev app

func (*DdevApp) GetExistingDBType added in v1.21.5

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

GetExistingDBType returns type/version like mariadb:10.4 or postgres:13 or "" if no existing volume This has to make a docker container run so is fairly costly.

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) GetHostUploadDirFullPath added in v1.21.5

func (app *DdevApp) GetHostUploadDirFullPath() string

GetHostUploadDirFullPath returns the full path to the first upload directory on the host or "" if there is none.

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 a slice of all the configured hostnames.

func (*DdevApp) GetLatestSnapshot added in v1.21.5

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

GetLatestSnapshot returns the latest created snapshot of a project

func (*DdevApp) GetMariaDBVolumeName added in v1.21.5

func (app *DdevApp) GetMariaDBVolumeName() string

GetMariaDBVolumeName returns the docker volume name of the mariadb/database volume For historical reasons this isn't lowercased.

func (*DdevApp) GetMutagenSyncID added in v1.22.0

func (app *DdevApp) GetMutagenSyncID() (id string, err error)

GetMutagenSyncID() returns the project sync ID

func (*DdevApp) GetNFSMountVolumeName added in v1.21.5

func (app *DdevApp) GetNFSMountVolumeName() string

GetNFSMountVolumeName 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) GetOmittedContainers added in v1.21.5

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

GetOmittedContainers returns full list of global and local omitted containers

func (*DdevApp) GetPerformanceMode added in v1.22.0

func (app *DdevApp) GetPerformanceMode() types.PerformanceMode

GetPerformanceMode returns performance mode config respecting defaults.

func (*DdevApp) GetPhpVersion added in v0.12.0

func (app *DdevApp) GetPhpVersion() string

GetPhpVersion returns the app's php version

func (*DdevApp) GetPostgresVolumeName added in v1.21.5

func (app *DdevApp) GetPostgresVolumeName() string

GetPostgresVolumeName returns the docker volume name of the Postgres/database volume For historical reasons this isn't lowercased.

func (*DdevApp) GetPrimaryURL added in v1.21.5

func (app *DdevApp) GetPrimaryURL() string

GetPrimaryURL returns the primary URL that can be used, https or http

func (*DdevApp) GetProvider added in v0.11.0

func (app *DdevApp) GetProvider(providerName string) (*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) GetRelativeWorkingDirectory added in v1.21.5

func (app *DdevApp) GetRelativeWorkingDirectory() string

GetRelativeWorkingDirectory returns the relative working directory relative to project root Note that the relative dir is returned as unix-style forward-slashes

func (*DdevApp) GetRouterHTTPPort added in v1.22.0

func (app *DdevApp) GetRouterHTTPPort() string

GetRouterHTTPPort returns app's router http port Start with global config and then override with project config

func (*DdevApp) GetRouterHTTPSPort added in v1.22.0

func (app *DdevApp) GetRouterHTTPSPort() string

GetRouterHTTPSPort returns app's router https port Start with global config and then override with project config

func (*DdevApp) GetType added in v0.11.0

func (app *DdevApp) GetType() string

GetType returns the application type as a (lowercase) string

func (*DdevApp) GetUploadDir added in v0.11.0

func (app *DdevApp) GetUploadDir() string

GetUploadDir returns the first upload (public files) directory. This value is relative to the docroot

func (*DdevApp) GetUploadDirs added in v1.22.0

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

GetUploadDirs returns the upload (public files) directories. These are gathered from the per-CMS configurations and the value of upload_dirs. upload_dirs overrides the per-CMS configuration

func (*DdevApp) GetValidProviders added in v1.21.5

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

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

func (*DdevApp) GetWebContainerDirectHTTPSURL added in v1.21.5

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.21.5

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.21.5

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) GetWebserverType added in v1.2.0

func (app *DdevApp) GetWebserverType() string

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

func (*DdevApp) GetWorkingDir added in v1.21.5

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(dumpFile string, extractPath string, progress bool, noDrop bool, targetDB string) 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(uploadDir, importPath, extractPath string) error

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

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) IsMutagenEnabled added in v1.21.5

func (app *DdevApp) IsMutagenEnabled() bool

IsMutagenEnabled returns true if mutagen is enabled locally or globally It's also required and set if NoBindMounts is set, since we have to have a way to get code on there.

func (*DdevApp) IsNFSMountEnabled added in v1.21.5

func (app *DdevApp) IsNFSMountEnabled() bool

IsNFSMountEnabled determines whether NFS is enabled.

func (*DdevApp) IsUploadDirsWarningDisabled added in v1.22.0

func (app *DdevApp) IsUploadDirsWarningDisabled() bool

IsUploadDirsWarningDisabled returns true if UploadDirs is disabled by the user.

func (*DdevApp) IsValidProvider added in v1.21.5

func (app *DdevApp) IsValidProvider(provider string) (bool, error)

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 (*DdevApp) ListSnapshots added in v1.21.5

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

ListSnapshots returns a list of the names of all project snapshots

func (*DdevApp) LoadConfigYamlFile added in v1.21.5

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) MutagenStatus added in v1.21.5

func (app *DdevApp) MutagenStatus() (status string, shortResult string, mapResult map[string]interface{}, err error)

MutagenStatus checks to see if there is an error case in mutagen We don't want to do a flush yet in that case. Note that the available statuses are at https://github.com/mutagen-io/mutagen/blob/master/pkg/synchronization/state.go#L9 in func (s Status) Description() Can return any of those or "nosession" (with more info) if we didn't find a session at all

func (*DdevApp) MutagenSyncFlush added in v1.21.5

func (app *DdevApp) MutagenSyncFlush() error

MutagenSyncFlush performs a mutagen sync flush, waits for result, and checks for errors

func (*DdevApp) Pause added in v1.21.5

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) ProtectedID added in v1.22.0

func (app *DdevApp) ProtectedID() string

ProtectedID returns the unique hash value for the project.

func (*DdevApp) Pull added in v1.3.0

func (app *DdevApp) Pull(provider *Provider, skipDbArg bool, skipFilesArg bool, skipImportArg bool) error

Pull performs an import of db and files

func (*DdevApp) PullContainerImages added in v1.21.5

func (app *DdevApp) PullContainerImages() error

PullContainerImages configured docker images with full output, since docker-compose up doesn't have nice output

func (*DdevApp) Push added in v1.21.5

func (app *DdevApp) Push(provider *Provider, skipDbArg bool, skipFilesArg bool) error

Push pushes db and files up to upstream hosting provider

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.21.5

func (app *DdevApp) RemoveGlobalProjectInfo()

RemoveGlobalProjectInfo deletes the project from ProjectList

func (*DdevApp) RemoveHostsEntriesIfNeeded added in v1.21.5

func (app *DdevApp) RemoveHostsEntriesIfNeeded() error

RemoveHostsEntriesIfNeeded will remove the site URL from the host's /etc/hosts. This should be run without administrative privileges and will escalate where needed.

func (*DdevApp) RenderComposeYAML added in v0.11.0

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

RenderComposeYAML renders the contents of .ddev/.ddev-docker-compose*.

func (*DdevApp) Restart added in v1.21.5

func (app *DdevApp) Restart() error

Restart does a Stop() and a Start

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.21.5

func (app *DdevApp) SetInstrumentationAppTags()

SetInstrumentationAppTags creates app-specific tags for Segment

func (*DdevApp) SetPerformanceMode added in v1.22.0

func (app *DdevApp) SetPerformanceMode(performanceMode string) *DdevApp

SetPerformanceMode sets the performance mode config.

func (*DdevApp) SiteStatus added in v0.11.0

func (app *DdevApp) SiteStatus() (string, string)

SiteStatus returns the current status of a project determined from web and db service health. returns status, statusDescription Can return SiteConfigMissing, SiteDirMissing, SiteStopped, SiteStarting, SiteRunning, SitePaused, or another status returned from dockerutil.GetContainerHealth(), including "exited", "restarting", "healthy"

func (*DdevApp) Snapshot added in v1.21.5

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

Snapshot causes a snapshot of the db to be written into the snapshots volume Returns the name 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) StartAndWait added in v1.21.5

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

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

func (*DdevApp) StartAppIfNotRunning added in v1.21.5

func (app *DdevApp) StartAppIfNotRunning() error

StartAppIfNotRunning is intended to replace much-duplicated code in the commands.

func (*DdevApp) Stop added in v0.11.0

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

Stop stops and Removes the docker containers for the project in current directory.

func (*DdevApp) TrackProject added in v1.22.0

func (app *DdevApp) TrackProject()

TrackProject collects and tracks information about the project for instrumentation.

func (*DdevApp) UpdateComposeYaml added in v1.21.5

func (app *DdevApp) UpdateComposeYaml(content string) error

UpdateComposeYaml updates app.ComposeYaml from available content

func (*DdevApp) UpdateGlobalProjectList added in v1.21.5

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) WaitByLabels added in v1.21.5

func (app *DdevApp) WaitByLabels(labels map[string]string) error

WaitByLabels waits for containers found by list of labels to be ready

func (*DdevApp) WaitForServices added in v1.21.5

func (app *DdevApp) WaitForServices() error

WaitForServices waits for all the services in docker-compose to come up

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) WriteDockerComposeYAML added in v1.21.5

func (app *DdevApp) WriteDockerComposeYAML() error

WriteDockerComposeYAML writes a .ddev-docker-compose-base.yaml and related to the .ddev directory. It then uses `docker-compose convert` to get a canonical version of the full compose file. It then makes a couple of fixups to the canonical version (networks and approot bind points) by marshalling the canonical version to YAML and then unmarshalling it back into a canonical version.

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
	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.21.5

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.21.5

func (c ExecHostTask) Execute() 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.21.5

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'
	Service string
	// Dir is the full path to the working directory inside the container
	Dir string
	// Cmd is the string to execute via bash/sh
	Cmd string
	// RawCmd is the array to execute if not using
	RawCmd []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
	// Detach does docker-compose detach
	Detach bool
}

ExecOpts contains options for running a command inside a container

type ExecTask added in v1.21.5

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.21.5

func (c ExecTask) Execute() error

Execute executes an ExecTask

func (ExecTask) GetDescription added in v1.21.5

func (c ExecTask) GetDescription() string

GetDescription returns a human-readable description of the task

type InvalidOmitContainers added in v1.21.5

type InvalidOmitContainers error

type ListCommandSettings added in v1.22.0

type ListCommandSettings struct {
	// ActiveOnly, if set, shows only running projects
	ActiveOnly bool

	// Continuous, if set, makes list continuously output
	Continuous bool

	// WrapListTable allow that the text in the table of ddev list wraps instead of cutting it to fit the terminal width
	WrapTableText bool

	// ContinuousSleepTime is time to sleep between reads with --continuous
	ContinuousSleepTime int

	// TypeFilter contains the project type which is then used to filter the project list
	TypeFilter string
}

ListCommandSettings conains all filters and settings of the `ddev list` command

type Provider

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

	ProviderInfo `yaml:"providers"`
	// contains filtered or unexported fields
}

Provider provides generic-specific import functionality.

func (*Provider) GetBackup

func (p *Provider) GetBackup(backupType string) ([]string, []string, error)

GetBackup will create and download a set of backups Valid values for backupType are "database" or "files". returns []fileURL, []importPath, error

func (*Provider) Init

func (p *Provider) Init(pType string, app *DdevApp) error

Init handles loading data from saved config.

func (*Provider) Read

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

Read generic provider configuration from a specified location on disk.

func (*Provider) UploadDB added in v1.21.5

func (p *Provider) UploadDB() error

UploadDB is used by Push to push the database to hosting provider

func (*Provider) UploadFiles added in v1.21.5

func (p *Provider) UploadFiles() error

UploadFiles is used by Push to push the user-generated files to the hosting provider

func (*Provider) Validate

func (p *Provider) Validate() error

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

type ProviderCommand added in v1.21.5

type ProviderCommand struct {
	Command string `yaml:"command"`
	Service string `yaml:"service,omitempty"`
}

ProviderCommand defines the shell command to be run for one of the commands (db pull, etc.)

type ProviderInfo added in v1.21.5

type ProviderInfo struct {
	EnvironmentVariables map[string]string `yaml:"environment_variables"`
	AuthCommand          ProviderCommand   `yaml:"auth_command"`
	DBPullCommand        ProviderCommand   `yaml:"db_pull_command"`
	DBImportCommand      ProviderCommand   `yaml:"db_import_command"`
	FilesPullCommand     ProviderCommand   `yaml:"files_pull_command"`
	FilesImportCommand   ProviderCommand   `yaml:"files_import_command"`
	CodePullCommand      ProviderCommand   `yaml:"code_pull_command,omitempty"`
	DBPushCommand        ProviderCommand   `yaml:"db_push_command"`
	FilesPushCommand     ProviderCommand   `yaml:"files_push_command"`
}

ProviderInfo defines the provider

type SegmentNoopLogger added in v1.21.5

type SegmentNoopLogger struct{}

SegmentNoopLogger defines a no-op logger to prevent Segment log messages from being emitted

func (*SegmentNoopLogger) Errorf added in v1.21.5

func (n *SegmentNoopLogger) Errorf(_ string, _ ...interface{})

func (*SegmentNoopLogger) Logf added in v1.21.5

func (n *SegmentNoopLogger) Logf(_ string, _ ...interface{})

type Task added in v1.21.5

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

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

func NewTask added in v1.21.5

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 TraefikRouting added in v1.21.5

type TraefikRouting struct {
	ExternalHostnames   []string
	ExternalPort        string
	InternalServiceName string
	InternalServicePort string
	HTTPS               bool
}

type WebExposedPort added in v1.21.5

type WebExposedPort struct {
	Name             string `yaml:"name"`
	WebContainerPort int    `yaml:"container_port"`
	HTTPPort         int    `yaml:"http_port"`
	HTTPSPort        int    `yaml:"https_port"`
}

type WebExtraDaemon added in v1.21.5

type WebExtraDaemon struct {
	Name      string `yaml:"name"`
	Command   string `yaml:"command"`
	Directory string `yaml:"directory"`
}

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
	DbCharset        string
	DbCollate        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.21.5

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