Previously, checking if an app was deployed actually checked if there were any running processes. This is not only incorrect, but also fails to take into account applications that do not have running processes and are only used for one-off commands. This fix migrates apps to the new "deployed" property which is set in core-post-deploy. The result is a slightly faster "deployed" check that is correct and allows non-scaled apps to actually work. Closes #4398
40 lines
980 B
Go
40 lines
980 B
Go
package common
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
// TriggerCorePostDeploy associates the container with a specified network
|
|
func TriggerCorePostDeploy(appName string) error {
|
|
quiet := os.Getenv("DOKKU_QUIET_OUTPUT")
|
|
os.Setenv("DOKKU_QUIET_OUTPUT", "1")
|
|
CommandPropertySet("common", appName, "deployed", "true", DefaultProperties, GlobalProperties)
|
|
os.Setenv("DOKKU_QUIET_OUTPUT", quiet)
|
|
return nil
|
|
}
|
|
|
|
// TriggerInstall runs the install step for the common plugin
|
|
func TriggerInstall() error {
|
|
if err := PropertySetup("common"); err != nil {
|
|
return fmt.Errorf("Unable to install the common plugin: %s", err.Error())
|
|
}
|
|
|
|
apps, err := DokkuApps()
|
|
if err != nil {
|
|
return nil
|
|
}
|
|
|
|
// migrate all is-deployed values from trigger to property
|
|
for _, appName := range apps {
|
|
IsDeployed(appName)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// TriggerPostDelete destroys the common property for a given app container
|
|
func TriggerPostDelete(appName string) error {
|
|
return PropertyDestroy("common", appName)
|
|
}
|