refactor: move apps listing from common plugin to apps plugin

This helps centralize app-related listing fetching.
This commit is contained in:
Jose Diaz-Gonzalez committed 2022-02-26 00:37:51 -05:00
1 parent 9d8de8a9db
commit 62a3eff5bb
45 files changed
+136 -55

No files matched your search

+3
View File
@@ -3,10 +3,13 @@ module github.com/dokku/dokku/plugins/app-json
go 1.16 go 1.16
require ( require (
github.com/dokku/dokku/plugins/apps v0.0.0-00010101000000-000000000000
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000 github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a golang.org/x/sync v0.0.0-20201207232520-09787c993a3a
) )
replace github.com/dokku/dokku/plugins/apps => ../apps
replace github.com/dokku/dokku/plugins/common => ../common replace github.com/dokku/dokku/plugins/common => ../common
+2 -1
View File
@@ -1,13 +1,14 @@
package appjson package appjson
import ( import (
"github.com/dokku/dokku/plugins/apps"
"github.com/dokku/dokku/plugins/common" "github.com/dokku/dokku/plugins/common"
) )
// CommandReport displays a network report for one or more apps // CommandReport displays a network report for one or more apps
func CommandReport(appName string, format string, infoFlag string) error { func CommandReport(appName string, format string, infoFlag string) error {
if len(appName) == 0 { if len(appName) == 0 {
apps, err := common.DokkuApps() apps, err := apps.DokkuApps()
if err != nil { if err != nil {
return err return err
} }
+1 -1
View File
@@ -1,5 +1,5 @@
SUBCOMMANDS = subcommands/clone subcommands/create subcommands/destroy subcommands/exists subcommands/list subcommands/lock subcommands/locked subcommands/rename subcommands/report subcommands/unlock SUBCOMMANDS = subcommands/clone subcommands/create subcommands/destroy subcommands/exists subcommands/list subcommands/lock subcommands/locked subcommands/rename subcommands/report subcommands/unlock
TRIGGERS = triggers/app-create triggers/app-destroy triggers/app-exists triggers/app-maybe-create triggers/deploy-source-set triggers/install triggers/post-app-clone-setup triggers/post-app-rename-setup triggers/post-delete triggers/report TRIGGERS = triggers/app-create triggers/app-destroy triggers/app-exists triggers/app-list triggers/app-maybe-create triggers/deploy-source-set triggers/install triggers/post-app-clone-setup triggers/post-app-rename-setup triggers/post-delete triggers/report
BUILD = commands subcommands triggers BUILD = commands subcommands triggers
PLUGIN_NAME = apps PLUGIN_NAME = apps
+35
View File
@@ -1,5 +1,13 @@
package apps package apps
import (
"fmt"
"io/ioutil"
"strings"
"github.com/dokku/dokku/plugins/common"
)
var ( var (
// DefaultProperties is a map of all valid network properties with corresponding default property values // DefaultProperties is a map of all valid network properties with corresponding default property values
DefaultProperties = map[string]string{ DefaultProperties = map[string]string{
@@ -13,3 +21,30 @@ var (
"deploy-source-metadata": true, "deploy-source-metadata": true,
} }
) )
// DokkuApps returns a list of all local apps
func DokkuApps() ([]string, error) {
apps := []string{}
dokkuRoot := common.MustGetEnv("DOKKU_ROOT")
files, err := ioutil.ReadDir(dokkuRoot)
if err != nil {
return apps, fmt.Errorf("You haven't deployed any applications yet")
}
for _, f := range files {
appRoot := common.AppRoot(f.Name())
if !common.DirectoryExists(appRoot) {
continue
}
if strings.HasPrefix(f.Name(), ".") {
continue
}
apps = append(apps, f.Name())
}
if len(apps) == 0 {
return apps, fmt.Errorf("You haven't deployed any applications yet")
}
return apps, nil
}
+2
View File
@@ -27,6 +27,8 @@ func main() {
case "app-exists": case "app-exists":
appName := flag.Arg(0) appName := flag.Arg(0)
err = apps.TriggerAppExists(appName) err = apps.TriggerAppExists(appName)
case "app-list":
err = apps.TriggerAppList()
case "app-maybe-create": case "app-maybe-create":
appName := flag.Arg(0) appName := flag.Arg(0)
err = apps.TriggerAppMaybeCreate(appName) err = apps.TriggerAppMaybeCreate(appName)
+2 -2
View File
@@ -85,7 +85,7 @@ func CommandExists(appName string) error {
// CommandList lists all apps // CommandList lists all apps
func CommandList() error { func CommandList() error {
common.LogInfo2Quiet("My Apps") common.LogInfo2Quiet("My Apps")
apps, err := common.DokkuApps() apps, err := DokkuApps()
if err != nil { if err != nil {
common.LogWarn(err.Error()) common.LogWarn(err.Error())
return nil return nil
@@ -177,7 +177,7 @@ func CommandRename(oldAppName string, newAppName string, skipDeploy bool) error
// CommandReport displays an app report for one or more apps // CommandReport displays an app report for one or more apps
func CommandReport(appName string, format string, infoFlag string) error { func CommandReport(appName string, format string, infoFlag string) error {
if len(appName) == 0 { if len(appName) == 0 {
apps, err := common.DokkuApps() apps, err := DokkuApps()
if err != nil { if err != nil {
return err return err
} }
+10
View File
@@ -21,6 +21,16 @@ func TriggerAppExists(appName string) error {
return appExists(appName) return appExists(appName)
} }
// TriggerAppList outputs each app name to stdout on a newline
func TriggerAppList() error {
apps, _ := DokkuApps()
for _, app := range apps {
common.Log(app)
}
return nil
}
// TriggerAppMaybeCreate is a trigger to allow gated app creation // TriggerAppMaybeCreate is a trigger to allow gated app creation
func TriggerAppMaybeCreate(appName string) error { func TriggerAppMaybeCreate(appName string) error {
return maybeCreateApp(appName) return maybeCreateApp(appName)
@@ -9,7 +9,6 @@ cmd-builder-dockerfile-report() {
declare cmd="builder-dockerfile:report" declare cmd="builder-dockerfile:report"
[[ "$1" == "$cmd" ]] && shift 1 [[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" INFO_FLAG="$2" declare APP="$1" INFO_FLAG="$2"
local INSTALLED_APPS=$(dokku_apps)
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
@@ -21,7 +20,7 @@ cmd-builder-dockerfile-report() {
fi fi
if [[ -z "$APP" ]]; then if [[ -z "$APP" ]]; then
for app in $INSTALLED_APPS; do for app in $(dokku_apps); do
cmd-builder-dockerfile-report-single "$app" "$INFO_FLAG" | tee || true cmd-builder-dockerfile-report-single "$app" "$INFO_FLAG" | tee || true
done done
else else
+1 -2
View File
@@ -9,7 +9,6 @@ cmd-builder-pack-report() {
declare cmd="builder-pack:report" declare cmd="builder-pack:report"
[[ "$1" == "$cmd" ]] && shift 1 [[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" INFO_FLAG="$2" declare APP="$1" INFO_FLAG="$2"
local INSTALLED_APPS=$(dokku_apps)
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
@@ -21,7 +20,7 @@ cmd-builder-pack-report() {
fi fi
if [[ -z "$APP" ]]; then if [[ -z "$APP" ]]; then
for app in $INSTALLED_APPS; do for app in $(dokku_apps); do
cmd-builder-pack-report-single "$app" "$INFO_FLAG" | tee || true cmd-builder-pack-report-single "$app" "$INFO_FLAG" | tee || true
done done
else else
+3
View File
@@ -3,9 +3,12 @@ module github.com/dokku/dokku/plugins/builder
go 1.16 go 1.16
require ( require (
github.com/dokku/dokku/plugins/apps v0.0.0-00010101000000-000000000000
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000 github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
github.com/otiai10/copy v1.6.0 github.com/otiai10/copy v1.6.0
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
) )
replace github.com/dokku/dokku/plugins/apps => ../apps
replace github.com/dokku/dokku/plugins/common => ../common replace github.com/dokku/dokku/plugins/common => ../common
+2 -1
View File
@@ -1,13 +1,14 @@
package builder package builder
import ( import (
"github.com/dokku/dokku/plugins/apps"
"github.com/dokku/dokku/plugins/common" "github.com/dokku/dokku/plugins/common"
) )
// CommandReport displays a builder report for one or more apps // CommandReport displays a builder report for one or more apps
func CommandReport(appName string, format string, infoFlag string) error { func CommandReport(appName string, format string, infoFlag string) error {
if len(appName) == 0 { if len(appName) == 0 {
apps, err := common.DokkuApps() apps, err := apps.DokkuApps()
if err != nil { if err != nil {
return err return err
} }
+3
View File
@@ -3,8 +3,11 @@ module github.com/dokku/dokku/plugins/buildpacks
go 1.16 go 1.16
require ( require (
github.com/dokku/dokku/plugins/apps v0.0.0-00010101000000-000000000000
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000 github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
) )
replace github.com/dokku/dokku/plugins/apps => ../apps
replace github.com/dokku/dokku/plugins/common => ../common replace github.com/dokku/dokku/plugins/common => ../common
+2 -1
View File
@@ -4,6 +4,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/dokku/dokku/plugins/apps"
"github.com/dokku/dokku/plugins/common" "github.com/dokku/dokku/plugins/common"
) )
@@ -106,7 +107,7 @@ func CommandRemove(appName string, buildpack string, index int) (err error) {
// CommandReport displays a buildpacks report for one or more apps // CommandReport displays a buildpacks report for one or more apps
func CommandReport(appName string, format string, infoFlag string) error { func CommandReport(appName string, format string, infoFlag string) error {
if len(appName) == 0 { if len(appName) == 0 {
apps, err := common.DokkuApps() apps, err := apps.DokkuApps()
if err != nil { if err != nil {
return err return err
} }
+1 -2
View File
@@ -9,7 +9,6 @@ cmd-certs-report() {
declare cmd="certs:report" declare cmd="certs:report"
[[ "$1" == "$cmd" ]] && shift 1 [[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" INFO_FLAG="$2" declare APP="$1" INFO_FLAG="$2"
local INSTALLED_APPS=$(dokku_apps)
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
@@ -21,7 +20,7 @@ cmd-certs-report() {
fi fi
if [[ -z "$APP" ]]; then if [[ -z "$APP" ]]; then
for app in $INSTALLED_APPS; do for app in $(dokku_apps); do
cmd-certs-report-single "$app" "$INFO_FLAG" | tee || true cmd-certs-report-single "$app" "$INFO_FLAG" | tee || true
done done
else else
+2 -8
View File
@@ -6,13 +6,10 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions"
migrate_checks_vars_0_5_0() { migrate_checks_vars_0_5_0() {
declare desc="migrates deprecated CHECKS config variables to simplified counter part introduced in 0.5.x" declare desc="migrates deprecated CHECKS config variables to simplified counter part introduced in 0.5.x"
local APPS="$(dokku_apps)"
local GLOBAL_SKIP_ALL_CHECKS=$(config_get --global DOKKU_SKIP_ALL_CHECKS || true) local GLOBAL_SKIP_ALL_CHECKS=$(config_get --global DOKKU_SKIP_ALL_CHECKS || true)
local GLOBAL_SKIP_DEFAULT_CHECKS=$(config_get --global DOKKU_SKIP_DEFAULT_CHECKS || true) local GLOBAL_SKIP_DEFAULT_CHECKS=$(config_get --global DOKKU_SKIP_DEFAULT_CHECKS || true)
local app for app in $(dokku_apps); do
for app in $APPS; do
local APP_SKIP_ALL_CHECKS=$(config_get "$app" DOKKU_SKIP_ALL_CHECKS || true) local APP_SKIP_ALL_CHECKS=$(config_get "$app" DOKKU_SKIP_ALL_CHECKS || true)
local APP_SKIP_DEFAULT_CHECKS=$(config_get "$app" DOKKU_SKIP_DEFAULT_CHECKS || true) local APP_SKIP_DEFAULT_CHECKS=$(config_get "$app" DOKKU_SKIP_DEFAULT_CHECKS || true)
@@ -37,11 +34,8 @@ migrate_checks_vars_0_5_0() {
migrate_checks_vars_0_6_0() { migrate_checks_vars_0_6_0() {
declare desc="migrates CHECKS config variables from 0.5.x to support fully-disabled zero-downtime checks" declare desc="migrates CHECKS config variables from 0.5.x to support fully-disabled zero-downtime checks"
local APPS="$(dokku_apps)"
local app for app in $(dokku_apps); do
for app in $APPS; do
local APP_DOKKU_CHECKS_ENABLED=$(config_get "$app" DOKKU_CHECKS_ENABLED || true) local APP_DOKKU_CHECKS_ENABLED=$(config_get "$app" DOKKU_CHECKS_ENABLED || true)
if [[ $APP_DOKKU_CHECKS_ENABLED ]]; then if [[ $APP_DOKKU_CHECKS_ENABLED ]]; then
dokku_log_info1 "Migrating zero downtime env variables to 0.6.x. The following variables will be migrated" dokku_log_info1 "Migrating zero downtime env variables to 0.6.x. The following variables will be migrated"
+1 -2
View File
@@ -9,7 +9,6 @@ cmd-checks-report() {
declare cmd="checks:report" declare cmd="checks:report"
[[ "$1" == "$cmd" ]] && shift 1 [[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" INFO_FLAG="$2" declare APP="$1" INFO_FLAG="$2"
local INSTALLED_APPS=$(dokku_apps)
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
@@ -21,7 +20,7 @@ cmd-checks-report() {
fi fi
if [[ -z "$APP" ]]; then if [[ -z "$APP" ]]; then
for app in $INSTALLED_APPS; do for app in $(dokku_apps); do
cmd-checks-report-single "$app" "$INFO_FLAG" | tee || true cmd-checks-report-single "$app" "$INFO_FLAG" | tee || true
done done
else else
+5 -2
View File
@@ -17,8 +17,11 @@ has_tty() {
dokku_apps() { dokku_apps() {
declare desc="prints list of all local apps" declare desc="prints list of all local apps"
local INSTALLED_APPS=$(find "$DOKKU_ROOT" -follow -maxdepth 1 -mindepth 1 -type d ! -name '.*' -printf "%f\n" 2>/dev/null | sort) || (dokku_log_fail "You haven't deployed any applications yet") local INSTALLED_APPS="$(plugn trigger app-list)"
[[ $INSTALLED_APPS ]] && echo "$INSTALLED_APPS" if [[ -z "$INSTALLED_APPS" ]]; then
dokku_log_fail "You haven't deployed any applications yet"
fi
echo "$INSTALLED_APPS"
} }
dokku_version() { dokku_version() {
+2 -1
View File
@@ -11,6 +11,7 @@ import (
"text/template" "text/template"
appjson "github.com/dokku/dokku/plugins/app-json" appjson "github.com/dokku/dokku/plugins/app-json"
apps "github.com/dokku/dokku/plugins/apps"
"github.com/dokku/dokku/plugins/common" "github.com/dokku/dokku/plugins/common"
cronparser "github.com/robfig/cron/v3" cronparser "github.com/robfig/cron/v3"
@@ -99,7 +100,7 @@ func deleteCrontab() error {
} }
func writeCronEntries() error { func writeCronEntries() error {
apps, _ := common.DokkuApps() apps, _ := apps.DokkuApps()
commands := []templateCommand{} commands := []templateCommand{}
for _, appName := range apps { for _, appName := range apps {
scheduler := common.GetAppScheduler(appName) scheduler := common.GetAppScheduler(appName)
+3
View File
@@ -4,12 +4,15 @@ go 1.16
require ( require (
github.com/dokku/dokku/plugins/app-json v0.0.0-00010101000000-000000000000 github.com/dokku/dokku/plugins/app-json v0.0.0-00010101000000-000000000000
github.com/dokku/dokku/plugins/apps v0.0.0-00010101000000-000000000000
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000 github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
github.com/robfig/cron/v3 v3.0.1 github.com/robfig/cron/v3 v3.0.1
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
) )
replace github.com/dokku/dokku/plugins/apps => ../apps
replace github.com/dokku/dokku/plugins/app-json => ../app-json replace github.com/dokku/dokku/plugins/app-json => ../app-json
replace github.com/dokku/dokku/plugins/common => ../common replace github.com/dokku/dokku/plugins/common => ../common
+2 -1
View File
@@ -3,6 +3,7 @@ package cron
import ( import (
"fmt" "fmt"
"github.com/dokku/dokku/plugins/apps"
"github.com/dokku/dokku/plugins/common" "github.com/dokku/dokku/plugins/common"
"github.com/ryanuber/columnize" "github.com/ryanuber/columnize"
) )
@@ -31,7 +32,7 @@ func CommandList(appName string) error {
// CommandReport displays a cron report for one or more apps // CommandReport displays a cron report for one or more apps
func CommandReport(appName string, format string, infoFlag string) error { func CommandReport(appName string, format string, infoFlag string) error {
if len(appName) == 0 { if len(appName) == 0 {
apps, err := common.DokkuApps() apps, err := apps.DokkuApps()
if err != nil { if err != nil {
return err return err
} }
+1 -2
View File
@@ -9,7 +9,6 @@ cmd-docker-options-report() {
declare cmd="docker-options:report" declare cmd="docker-options:report"
[[ "$1" == "$cmd" ]] && shift 1 [[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" INFO_FLAG="$2" declare APP="$1" INFO_FLAG="$2"
local INSTALLED_APPS=$(dokku_apps)
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
@@ -21,7 +20,7 @@ cmd-docker-options-report() {
fi fi
if [[ -z "$APP" ]]; then if [[ -z "$APP" ]]; then
for app in $INSTALLED_APPS; do for app in $(dokku_apps); do
cmd-docker-options-report-single "$app" "$INFO_FLAG" | tee || true cmd-docker-options-report-single "$app" "$INFO_FLAG" | tee || true
done done
else else
+1 -2
View File
@@ -9,7 +9,6 @@ cmd-domains-report() {
declare cmd="domains:report" declare cmd="domains:report"
[[ "$1" == "$cmd" ]] && shift 1 [[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" INFO_FLAG="$2" declare APP="$1" INFO_FLAG="$2"
local INSTALLED_APPS=$(dokku_apps)
if [[ "$APP" == "--global" ]]; then if [[ "$APP" == "--global" ]]; then
cmd-domains-report-single "$APP" "$INFO_FLAG" cmd-domains-report-single "$APP" "$INFO_FLAG"
@@ -26,7 +25,7 @@ cmd-domains-report() {
fi fi
if [[ -z "$APP" ]]; then if [[ -z "$APP" ]]; then
for app in $INSTALLED_APPS; do for app in $(dokku_apps); do
cmd-domains-report-single "$app" "$INFO_FLAG" | tee || true cmd-domains-report-single "$app" "$INFO_FLAG" | tee || true
done done
else else
+1 -2
View File
@@ -18,7 +18,6 @@ trigger-git-install() {
migrate_git_vars_0_12_0() { migrate_git_vars_0_12_0() {
declare desc="migrates git config variables from 0.11.x" declare desc="migrates git config variables from 0.11.x"
local APPS="$(dokku_apps)"
local DOKKU_DEPLOY_BRANCH app local DOKKU_DEPLOY_BRANCH app
DOKKU_DEPLOY_BRANCH=$(config_get --global DOKKU_DEPLOY_BRANCH || true) DOKKU_DEPLOY_BRANCH=$(config_get --global DOKKU_DEPLOY_BRANCH || true)
@@ -27,7 +26,7 @@ migrate_git_vars_0_12_0() {
DOKKU_QUIET_OUTPUT=1 config_unset --global DOKKU_DEPLOY_BRANCH || true DOKKU_QUIET_OUTPUT=1 config_unset --global DOKKU_DEPLOY_BRANCH || true
fi fi
for app in $APPS; do for app in $(dokku_apps); do
DOKKU_DEPLOY_BRANCH=$(config_get "$app" DOKKU_DEPLOY_BRANCH || true) DOKKU_DEPLOY_BRANCH=$(config_get "$app" DOKKU_DEPLOY_BRANCH || true)
if [[ -n "$DOKKU_DEPLOY_BRANCH" ]]; then if [[ -n "$DOKKU_DEPLOY_BRANCH" ]]; then
fn-plugin-property-write "git" "$app" "deploy-branch" "$DOKKU_DEPLOY_BRANCH" fn-plugin-property-write "git" "$app" "deploy-branch" "$DOKKU_DEPLOY_BRANCH"
+1 -2
View File
@@ -222,7 +222,6 @@ cmd-git-report() {
declare cmd="git:report" declare cmd="git:report"
[[ "$1" == "$cmd" ]] && shift 1 [[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" INFO_FLAG="$2" declare APP="$1" INFO_FLAG="$2"
local INSTALLED_APPS=$(dokku_apps)
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
@@ -234,7 +233,7 @@ cmd-git-report() {
fi fi
if [[ -z "$APP" ]]; then if [[ -z "$APP" ]]; then
for app in $INSTALLED_APPS; do for app in $(dokku_apps); do
cmd-git-report-single "$app" "$INFO_FLAG" | tee || true cmd-git-report-single "$app" "$INFO_FLAG" | tee || true
done done
else else
+2 -1
View File
@@ -10,6 +10,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/dokku/dokku/plugins/apps"
"github.com/dokku/dokku/plugins/common" "github.com/dokku/dokku/plugins/common"
"github.com/joncalhoun/qson" "github.com/joncalhoun/qson"
) )
@@ -156,7 +157,7 @@ func sinkValueToConfig(appName string, sinkValue string) (vectorSink, error) {
} }
func writeVectorConfig() error { func writeVectorConfig() error {
apps, _ := common.DokkuApps() apps, _ := apps.DokkuApps()
data := vectorConfig{ data := vectorConfig{
Sources: map[string]vectorSource{}, Sources: map[string]vectorSource{},
Sinks: map[string]vectorSink{}, Sinks: map[string]vectorSink{},
+4 -1
View File
@@ -4,12 +4,15 @@ go 1.16
require ( require (
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27
github.com/dokku/dokku/plugins/apps v0.0.0-00010101000000-000000000000
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000 github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
github.com/dokku/dokku/plugins/docker-options v0.0.0-20210208020425-f7beb3d95ddd github.com/dokku/dokku/plugins/docker-options v0.0.0-00010101000000-000000000000
github.com/joncalhoun/qson v0.0.0-20200422171543-84433dcd3da0 github.com/joncalhoun/qson v0.0.0-20200422171543-84433dcd3da0
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
) )
replace github.com/dokku/dokku/plugins/apps => ../apps
replace github.com/dokku/dokku/plugins/common => ../common replace github.com/dokku/dokku/plugins/common => ../common
replace github.com/dokku/dokku/plugins/docker-options => ../docker-options replace github.com/dokku/dokku/plugins/docker-options => ../docker-options
+2 -1
View File
@@ -7,6 +7,7 @@ import (
"strconv" "strconv"
"time" "time"
"github.com/dokku/dokku/plugins/apps"
"github.com/dokku/dokku/plugins/common" "github.com/dokku/dokku/plugins/common"
) )
@@ -52,7 +53,7 @@ func CommandFailed(appName string, allApps bool) error {
// CommandReport displays a logs report for one or more apps // CommandReport displays a logs report for one or more apps
func CommandReport(appName string, format string, infoFlag string) error { func CommandReport(appName string, format string, infoFlag string) error {
if len(appName) == 0 { if len(appName) == 0 {
apps, err := common.DokkuApps() apps, err := apps.DokkuApps()
if err != nil { if err != nil {
return err return err
} }
+3
View File
@@ -4,11 +4,14 @@ go 1.16
require ( require (
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27
github.com/dokku/dokku/plugins/apps v0.0.0-00010101000000-000000000000
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000 github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
github.com/dokku/dokku/plugins/config v0.0.0-00010101000000-000000000000 github.com/dokku/dokku/plugins/config v0.0.0-00010101000000-000000000000
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
) )
replace github.com/dokku/dokku/plugins/apps => ../apps
replace github.com/dokku/dokku/plugins/common => ../common replace github.com/dokku/dokku/plugins/common => ../common
replace github.com/dokku/dokku/plugins/config => ../config replace github.com/dokku/dokku/plugins/config => ../config
+3 -2
View File
@@ -7,6 +7,7 @@ import (
"os" "os"
"strings" "strings"
"github.com/dokku/dokku/plugins/apps"
"github.com/dokku/dokku/plugins/common" "github.com/dokku/dokku/plugins/common"
) )
@@ -107,7 +108,7 @@ func CommandList() error {
// CommandRebuildall rebuilds network settings for all apps // CommandRebuildall rebuilds network settings for all apps
func CommandRebuildall() error { func CommandRebuildall() error {
apps, err := common.DokkuApps() apps, err := apps.DokkuApps()
if err != nil { if err != nil {
return err return err
} }
@@ -125,7 +126,7 @@ func CommandRebuildall() error {
// CommandReport displays a network report for one or more apps // CommandReport displays a network report for one or more apps
func CommandReport(appName string, format string, infoFlag string) error { func CommandReport(appName string, format string, infoFlag string) error {
if len(appName) == 0 { if len(appName) == 0 {
apps, err := common.DokkuApps() apps, err := apps.DokkuApps()
if err != nil { if err != nil {
return err return err
} }
+2 -1
View File
@@ -7,6 +7,7 @@ import (
"strings" "strings"
"unicode/utf8" "unicode/utf8"
"github.com/dokku/dokku/plugins/apps"
"github.com/dokku/dokku/plugins/common" "github.com/dokku/dokku/plugins/common"
"github.com/dokku/dokku/plugins/config" "github.com/dokku/dokku/plugins/config"
) )
@@ -33,7 +34,7 @@ func TriggerInstall() error {
return fmt.Errorf("Unable to install the network plugin: %s", err.Error()) return fmt.Errorf("Unable to install the network plugin: %s", err.Error())
} }
apps, err := common.DokkuApps() apps, err := apps.DokkuApps()
if err != nil { if err != nil {
return nil return nil
} }
+1 -2
View File
@@ -11,7 +11,6 @@ cmd-nginx-report() {
declare cmd="nginx:report" declare cmd="nginx:report"
[[ "$1" == "$cmd" ]] && shift 1 [[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" INFO_FLAG="$2" declare APP="$1" INFO_FLAG="$2"
local INSTALLED_APPS=$(dokku_apps)
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
@@ -23,7 +22,7 @@ cmd-nginx-report() {
fi fi
if [[ -z "$APP" ]]; then if [[ -z "$APP" ]]; then
for app in $INSTALLED_APPS; do for app in $(dokku_apps); do
cmd-nginx-report-single "$app" "$INFO_FLAG" | tee || true cmd-nginx-report-single "$app" "$INFO_FLAG" | tee || true
done done
else else
+3
View File
@@ -3,12 +3,15 @@ module github.com/dokku/dokku/plugins/proxy
go 1.16 go 1.16
require ( require (
github.com/dokku/dokku/plugins/apps v0.0.0-00010101000000-000000000000
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000 github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
github.com/dokku/dokku/plugins/config v0.0.0-00010101000000-000000000000 github.com/dokku/dokku/plugins/config v0.0.0-00010101000000-000000000000
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
) )
replace github.com/dokku/dokku/plugins/apps => ../apps
replace github.com/dokku/dokku/plugins/common => ../common replace github.com/dokku/dokku/plugins/common => ../common
replace github.com/dokku/dokku/plugins/config => ../config replace github.com/dokku/dokku/plugins/config => ../config
+2 -1
View File
@@ -4,6 +4,7 @@ import (
"errors" "errors"
"strings" "strings"
"github.com/dokku/dokku/plugins/apps"
"github.com/dokku/dokku/plugins/common" "github.com/dokku/dokku/plugins/common"
"github.com/dokku/dokku/plugins/config" "github.com/dokku/dokku/plugins/config"
) )
@@ -152,7 +153,7 @@ func CommandPortsSet(appName string, portMaps []string) error {
// CommandReport displays a proxy report for one or more apps // CommandReport displays a proxy report for one or more apps
func CommandReport(appName string, format string, infoFlag string) error { func CommandReport(appName string, format string, infoFlag string) error {
if len(appName) == 0 { if len(appName) == 0 {
apps, err := common.DokkuApps() apps, err := apps.DokkuApps()
if err != nil { if err != nil {
return err return err
} }
+3
View File
@@ -4,6 +4,7 @@ go 1.16
require ( require (
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27
github.com/dokku/dokku/plugins/apps v0.0.0-00010101000000-000000000000
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000 github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
github.com/dokku/dokku/plugins/config v0.0.0-00010101000000-000000000000 github.com/dokku/dokku/plugins/config v0.0.0-00010101000000-000000000000
github.com/dokku/dokku/plugins/docker-options v0.0.0-00010101000000-000000000000 github.com/dokku/dokku/plugins/docker-options v0.0.0-00010101000000-000000000000
@@ -13,6 +14,8 @@ require (
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
) )
replace github.com/dokku/dokku/plugins/apps => ../apps
replace github.com/dokku/dokku/plugins/common => ../common replace github.com/dokku/dokku/plugins/common => ../common
replace github.com/dokku/dokku/plugins/config => ../config replace github.com/dokku/dokku/plugins/config => ../config
+3 -3
View File
@@ -6,9 +6,9 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
dockeroptions "github.com/dokku/dokku/plugins/docker-options" "github.com/dokku/dokku/plugins/apps"
"github.com/dokku/dokku/plugins/common" "github.com/dokku/dokku/plugins/common"
dockeroptions "github.com/dokku/dokku/plugins/docker-options"
"github.com/gofrs/flock" "github.com/gofrs/flock"
) )
@@ -38,7 +38,7 @@ func CommandRebuild(appName string, allApps bool, parallelCount int) error {
// CommandReport displays a ps report for one or more apps // CommandReport displays a ps report for one or more apps
func CommandReport(appName string, format string, infoFlag string) error { func CommandReport(appName string, format string, infoFlag string) error {
if len(appName) == 0 { if len(appName) == 0 {
apps, err := common.DokkuApps() apps, err := apps.DokkuApps()
if err != nil { if err != nil {
return err return err
} }
+2 -1
View File
@@ -10,6 +10,7 @@ import (
"strings" "strings"
sh "github.com/codeskyblue/go-sh" sh "github.com/codeskyblue/go-sh"
"github.com/dokku/dokku/plugins/apps"
"github.com/dokku/dokku/plugins/common" "github.com/dokku/dokku/plugins/common"
"github.com/dokku/dokku/plugins/config" "github.com/dokku/dokku/plugins/config"
dockeroptions "github.com/dokku/dokku/plugins/docker-options" dockeroptions "github.com/dokku/dokku/plugins/docker-options"
@@ -74,7 +75,7 @@ func TriggerInstall() error {
return err return err
} }
apps, err := common.DokkuApps() apps, err := apps.DokkuApps()
if err != nil { if err != nil {
return nil return nil
} }
+3
View File
@@ -4,8 +4,11 @@ go 1.16
require ( require (
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27
github.com/dokku/dokku/plugins/apps v0.0.0-00010101000000-000000000000
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000 github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
) )
replace github.com/dokku/dokku/plugins/apps => ../apps
replace github.com/dokku/dokku/plugins/common => ../common replace github.com/dokku/dokku/plugins/common => ../common
+2 -1
View File
@@ -7,6 +7,7 @@ import (
"os" "os"
"strings" "strings"
"github.com/dokku/dokku/plugins/apps"
"github.com/dokku/dokku/plugins/common" "github.com/dokku/dokku/plugins/common"
) )
@@ -55,7 +56,7 @@ func CommandLogin(server string, username string, password string, passwordStdin
// CommandReport displays a registry report for one or more apps // CommandReport displays a registry report for one or more apps
func CommandReport(appName string, format string, infoFlag string) error { func CommandReport(appName string, format string, infoFlag string) error {
if len(appName) == 0 { if len(appName) == 0 {
apps, err := common.DokkuApps() apps, err := apps.DokkuApps()
if err != nil { if err != nil {
return err return err
} }
+3
View File
@@ -3,8 +3,11 @@ module github.com/dokku/dokku/plugins/resource
go 1.16 go 1.16
require ( require (
github.com/dokku/dokku/plugins/apps v0.0.0-00010101000000-000000000000
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000 github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
) )
replace github.com/dokku/dokku/plugins/apps => ../apps
replace github.com/dokku/dokku/plugins/common => ../common replace github.com/dokku/dokku/plugins/common => ../common
+2 -1
View File
@@ -1,6 +1,7 @@
package resource package resource
import ( import (
"github.com/dokku/dokku/plugins/apps"
"github.com/dokku/dokku/plugins/common" "github.com/dokku/dokku/plugins/common"
) )
@@ -26,7 +27,7 @@ func CommandLimitClear(appName string, processType string) error {
// CommandReport displays a resource report for one or more apps // CommandReport displays a resource report for one or more apps
func CommandReport(appName string, format string, infoFlag string) error { func CommandReport(appName string, format string, infoFlag string) error {
if len(appName) == 0 { if len(appName) == 0 {
apps, err := common.DokkuApps() apps, err := apps.DokkuApps()
if err != nil { if err != nil {
return err return err
} }
@@ -10,7 +10,6 @@ cmd-scheduler-docker-local-report() {
declare cmd="scheduler-docker-local:report" declare cmd="scheduler-docker-local:report"
[[ "$1" == "$cmd" ]] && shift 1 [[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" INFO_FLAG="$2" declare APP="$1" INFO_FLAG="$2"
local INSTALLED_APPS=$(dokku_apps)
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
@@ -22,7 +21,7 @@ cmd-scheduler-docker-local-report() {
fi fi
if [[ -z "$APP" ]]; then if [[ -z "$APP" ]]; then
for app in $INSTALLED_APPS; do for app in $(dokku_apps); do
cmd-scheduler-docker-local-report-single "$app" "$INFO_FLAG" | tee || true cmd-scheduler-docker-local-report-single "$app" "$INFO_FLAG" | tee || true
done done
else else
+3
View File
@@ -3,11 +3,14 @@ module github.com/dokku/dokku/plugins/scheduler
go 1.16 go 1.16
require ( require (
github.com/dokku/dokku/plugins/apps v0.0.0-00010101000000-000000000000
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000 github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
github.com/dokku/dokku/plugins/config v0.0.0-00010101000000-000000000000 github.com/dokku/dokku/plugins/config v0.0.0-00010101000000-000000000000
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
) )
replace github.com/dokku/dokku/plugins/apps => ../apps
replace github.com/dokku/dokku/plugins/common => ../common replace github.com/dokku/dokku/plugins/common => ../common
replace github.com/dokku/dokku/plugins/config => ../config replace github.com/dokku/dokku/plugins/config => ../config
+2 -1
View File
@@ -1,13 +1,14 @@
package scheduler package scheduler
import ( import (
"github.com/dokku/dokku/plugins/apps"
"github.com/dokku/dokku/plugins/common" "github.com/dokku/dokku/plugins/common"
) )
// CommandReport displays a scheduler report for one or more apps // CommandReport displays a scheduler report for one or more apps
func CommandReport(appName string, format string, infoFlag string) error { func CommandReport(appName string, format string, infoFlag string) error {
if len(appName) == 0 { if len(appName) == 0 {
apps, err := common.DokkuApps() apps, err := apps.DokkuApps()
if err != nil { if err != nil {
return err return err
} }
+2 -1
View File
@@ -3,6 +3,7 @@ package scheduler
import ( import (
"fmt" "fmt"
"github.com/dokku/dokku/plugins/apps"
"github.com/dokku/dokku/plugins/common" "github.com/dokku/dokku/plugins/common"
"github.com/dokku/dokku/plugins/config" "github.com/dokku/dokku/plugins/config"
) )
@@ -31,7 +32,7 @@ func TriggerInstall() error {
return fmt.Errorf("Unable to install the scheduler plugin: %s", err.Error()) return fmt.Errorf("Unable to install the scheduler plugin: %s", err.Error())
} }
apps, err := common.DokkuApps() apps, err := apps.DokkuApps()
if err != nil { if err != nil {
return nil return nil
} }
+1 -2
View File
@@ -66,7 +66,6 @@ cmd-storage-report() {
declare cmd="storage:report" declare cmd="storage:report"
[[ "$1" == "$cmd" ]] && shift 1 [[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" INFO_FLAG="$2" declare APP="$1" INFO_FLAG="$2"
local INSTALLED_APPS=$(dokku_apps)
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
@@ -78,7 +77,7 @@ cmd-storage-report() {
fi fi
if [[ -z "$APP" ]]; then if [[ -z "$APP" ]]; then
for app in $INSTALLED_APPS; do for app in $(dokku_apps); do
cmd-storage-report-single "$app" "$INFO_FLAG" | tee || true cmd-storage-report-single "$app" "$INFO_FLAG" | tee || true
done done
else else