refactor!: app name -> domain
This commit is contained in:
parent
bc1729c5ca
commit
e670844b56
|
@ -8,7 +8,7 @@ var AppCommand = cli.Command{
|
|||
Name: "app",
|
||||
Aliases: []string{"a"},
|
||||
Usage: "Manage apps",
|
||||
ArgsUsage: "<app>",
|
||||
ArgsUsage: "<domain>",
|
||||
Description: "This command provides functionality for managing the life cycle of your apps",
|
||||
Subcommands: []cli.Command{
|
||||
appNewCommand,
|
||||
|
|
|
@ -16,7 +16,7 @@ var appCheckCommand = cli.Command{
|
|||
Name: "check",
|
||||
Aliases: []string{"c"},
|
||||
Usage: "Check if app is configured correctly",
|
||||
ArgsUsage: "<service>",
|
||||
ArgsUsage: "<domain>",
|
||||
Flags: []cli.Flag{
|
||||
internal.DebugFlag,
|
||||
internal.NoInputFlag,
|
||||
|
|
|
@ -14,9 +14,10 @@ import (
|
|||
)
|
||||
|
||||
var appConfigCommand = cli.Command{
|
||||
Name: "config",
|
||||
Aliases: []string{"c"},
|
||||
Usage: "Edit app config",
|
||||
Name: "config",
|
||||
Aliases: []string{"c"},
|
||||
Usage: "Edit app config",
|
||||
ArgsUsage: "<domain>",
|
||||
Flags: []cli.Flag{
|
||||
internal.DebugFlag,
|
||||
internal.NoInputFlag,
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
var appCpCommand = cli.Command{
|
||||
Name: "cp",
|
||||
Aliases: []string{"c"},
|
||||
ArgsUsage: "<src> <dst>",
|
||||
ArgsUsage: "<domain> <src> <dst>",
|
||||
Flags: []cli.Flag{
|
||||
internal.DebugFlag,
|
||||
internal.NoInputFlag,
|
||||
|
@ -34,11 +34,11 @@ This command supports copying files to and from any app service file system.
|
|||
|
||||
If you want to copy a myfile.txt to the root of the app service:
|
||||
|
||||
abra app cp <app> myfile.txt app:/
|
||||
abra app cp <domain> myfile.txt app:/
|
||||
|
||||
And if you want to copy that file back to your current working directory locally:
|
||||
|
||||
abra app cp <app> app:/myfile.txt .
|
||||
abra app cp <domain> app:/myfile.txt .
|
||||
|
||||
`,
|
||||
Action: func(c *cli.Context) error {
|
||||
|
|
|
@ -7,9 +7,10 @@ import (
|
|||
)
|
||||
|
||||
var appDeployCommand = cli.Command{
|
||||
Name: "deploy",
|
||||
Aliases: []string{"d"},
|
||||
Usage: "Deploy an app",
|
||||
Name: "deploy",
|
||||
Aliases: []string{"d"},
|
||||
Usage: "Deploy an app",
|
||||
ArgsUsage: "<domain>",
|
||||
Flags: []cli.Flag{
|
||||
internal.DebugFlag,
|
||||
internal.NoInputFlag,
|
||||
|
@ -21,7 +22,7 @@ var appDeployCommand = cli.Command{
|
|||
Before: internal.SubCommandBefore,
|
||||
Description: `
|
||||
This command deploys an app. It does not support incrementing the version of a
|
||||
deployed app, for this you need to look at the "abra app upgrade <app>"
|
||||
deployed app, for this you need to look at the "abra app upgrade <domain>"
|
||||
command.
|
||||
|
||||
You may pass "--force" to re-deploy the same version again. This can be useful
|
||||
|
|
|
@ -20,8 +20,9 @@ import (
|
|||
)
|
||||
|
||||
var appErrorsCommand = cli.Command{
|
||||
Name: "errors",
|
||||
Usage: "List errors for a deployed app",
|
||||
Name: "errors",
|
||||
Usage: "List errors for a deployed app",
|
||||
ArgsUsage: "<domain>",
|
||||
Description: `
|
||||
This command lists errors for a deployed app.
|
||||
|
||||
|
@ -40,7 +41,7 @@ Got any more ideas? Please let us know:
|
|||
|
||||
https://git.coopcloud.tech/coop-cloud/organising/issues/new/choose
|
||||
|
||||
This command is best accompanied by "abra app logs <app>" which may reveal
|
||||
This command is best accompanied by "abra app logs <domain>" which may reveal
|
||||
further information which can help you debug the cause of an app failure via
|
||||
the logs.
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ can take some time.
|
|||
|
||||
serverStat := allStats[app.Server]
|
||||
|
||||
tableCol := []string{"recipe", "domain", "app name"}
|
||||
tableCol := []string{"recipe", "domain"}
|
||||
if status {
|
||||
tableCol = append(tableCol, []string{"status", "version", "upgrade"}...)
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ can take some time.
|
|||
table := formatter.CreateTable(tableCol)
|
||||
|
||||
for _, appStat := range serverStat.apps {
|
||||
tableRow := []string{appStat.recipe, appStat.domain, appStat.appName}
|
||||
tableRow := []string{appStat.recipe, appStat.domain}
|
||||
if status {
|
||||
tableRow = append(tableRow, []string{appStat.status, appStat.version, appStat.upgrade}...)
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ func stackLogs(c *cli.Context, stackName string, client *dockerClient.Client) {
|
|||
var appLogsCommand = cli.Command{
|
||||
Name: "logs",
|
||||
Aliases: []string{"l"},
|
||||
ArgsUsage: "[<service>]",
|
||||
ArgsUsage: "<domain> [<service>]",
|
||||
Usage: "Tail app logs",
|
||||
Flags: []cli.Flag{
|
||||
internal.StdErrOnlyFlag,
|
||||
|
|
|
@ -11,7 +11,7 @@ This command takes a recipe and uses it to create a new app. This new app
|
|||
configuration is stored in your ~/.abra directory under the appropriate server.
|
||||
|
||||
This command does not deploy your app for you. You will need to run "abra app
|
||||
deploy <app>" to do so.
|
||||
deploy <domain>" to do so.
|
||||
|
||||
You can see what recipes are available (i.e. values for the <recipe> argument)
|
||||
by running "abra recipe ls".
|
||||
|
@ -36,12 +36,11 @@ var appNewCommand = cli.Command{
|
|||
internal.NoInputFlag,
|
||||
internal.NewAppServerFlag,
|
||||
internal.DomainFlag,
|
||||
internal.NewAppNameFlag,
|
||||
internal.PassFlag,
|
||||
internal.SecretsFlag,
|
||||
},
|
||||
Before: internal.SubCommandBefore,
|
||||
ArgsUsage: "<recipe>",
|
||||
ArgsUsage: "[<recipe>]",
|
||||
Action: internal.NewAction,
|
||||
BashComplete: autocomplete.RecipeNameComplete,
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ var appPsCommand = cli.Command{
|
|||
Name: "ps",
|
||||
Aliases: []string{"p"},
|
||||
Usage: "Check app status",
|
||||
ArgsUsage: "<domain>",
|
||||
Description: "This command shows a more detailed status output of a specific deployed app.",
|
||||
Flags: []cli.Flag{
|
||||
internal.WatchFlag,
|
||||
|
|
|
@ -26,9 +26,10 @@ var VolumesFlag = &cli.BoolFlag{
|
|||
}
|
||||
|
||||
var appRemoveCommand = cli.Command{
|
||||
Name: "remove",
|
||||
Aliases: []string{"rm"},
|
||||
Usage: "Remove an already undeployed app",
|
||||
Name: "remove",
|
||||
Aliases: []string{"rm"},
|
||||
ArgsUsage: "<domain>",
|
||||
Usage: "Remove an already undeployed app",
|
||||
Flags: []cli.Flag{
|
||||
VolumesFlag,
|
||||
internal.ForceFlag,
|
||||
|
|
|
@ -18,7 +18,7 @@ var appRestartCommand = cli.Command{
|
|||
Name: "restart",
|
||||
Aliases: []string{"re"},
|
||||
Usage: "Restart an app",
|
||||
ArgsUsage: "<service>",
|
||||
ArgsUsage: "<domain>",
|
||||
Flags: []cli.Flag{
|
||||
internal.DebugFlag,
|
||||
internal.NoInputFlag,
|
||||
|
|
|
@ -22,7 +22,7 @@ var appRollbackCommand = cli.Command{
|
|||
Name: "rollback",
|
||||
Aliases: []string{"rl"},
|
||||
Usage: "Roll an app back to a previous version",
|
||||
ArgsUsage: "<app>",
|
||||
ArgsUsage: "<domain>",
|
||||
Flags: []cli.Flag{
|
||||
internal.DebugFlag,
|
||||
internal.NoInputFlag,
|
||||
|
|
|
@ -40,7 +40,7 @@ var appRunCommand = cli.Command{
|
|||
userFlag,
|
||||
},
|
||||
Before: internal.SubCommandBefore,
|
||||
ArgsUsage: "<service> <args>...",
|
||||
ArgsUsage: "<domain> <service> <args>...",
|
||||
Usage: "Run a command in a service container",
|
||||
BashComplete: autocomplete.AppNameComplete,
|
||||
Action: func(c *cli.Context) error {
|
||||
|
|
|
@ -29,7 +29,7 @@ var appSecretGenerateCommand = cli.Command{
|
|||
Name: "generate",
|
||||
Aliases: []string{"g"},
|
||||
Usage: "Generate secrets",
|
||||
ArgsUsage: "<secret> <version>",
|
||||
ArgsUsage: "<domain> <secret> <version>",
|
||||
Flags: []cli.Flag{
|
||||
internal.DebugFlag,
|
||||
internal.NoInputFlag,
|
||||
|
@ -109,7 +109,7 @@ var appSecretInsertCommand = cli.Command{
|
|||
internal.PassFlag,
|
||||
},
|
||||
Before: internal.SubCommandBefore,
|
||||
ArgsUsage: "<app> <secret-name> <version> <data>",
|
||||
ArgsUsage: "<domain> <secret-name> <version> <data>",
|
||||
BashComplete: autocomplete.AppNameComplete,
|
||||
Description: `
|
||||
This command inserts a secret into an app environment.
|
||||
|
@ -159,7 +159,7 @@ var appSecretRmCommand = cli.Command{
|
|||
allSecretsFlag, internal.PassFlag,
|
||||
},
|
||||
Before: internal.SubCommandBefore,
|
||||
ArgsUsage: "<app> <secret-name>",
|
||||
ArgsUsage: "<domain> <secret-name>",
|
||||
BashComplete: autocomplete.AppNameComplete,
|
||||
Description: `
|
||||
This command removes a secret from an app environment.
|
||||
|
@ -295,7 +295,7 @@ var appSecretCommand = cli.Command{
|
|||
Name: "secret",
|
||||
Aliases: []string{"s"},
|
||||
Usage: "Manage app secrets",
|
||||
ArgsUsage: "<command>",
|
||||
ArgsUsage: "<domain>",
|
||||
Subcommands: []cli.Command{
|
||||
appSecretGenerateCommand,
|
||||
appSecretInsertCommand,
|
||||
|
|
|
@ -12,8 +12,9 @@ import (
|
|||
)
|
||||
|
||||
var appUndeployCommand = cli.Command{
|
||||
Name: "undeploy",
|
||||
Aliases: []string{"un"},
|
||||
Name: "undeploy",
|
||||
Aliases: []string{"un"},
|
||||
ArgsUsage: "<domain>",
|
||||
Flags: []cli.Flag{
|
||||
internal.DebugFlag,
|
||||
internal.NoInputFlag,
|
||||
|
|
|
@ -21,7 +21,7 @@ var appUpgradeCommand = cli.Command{
|
|||
Name: "upgrade",
|
||||
Aliases: []string{"up"},
|
||||
Usage: "Upgrade an app",
|
||||
ArgsUsage: "<app>",
|
||||
ArgsUsage: "<domain>",
|
||||
Flags: []cli.Flag{
|
||||
internal.DebugFlag,
|
||||
internal.NoInputFlag,
|
||||
|
@ -35,7 +35,7 @@ This command supports upgrading an app. You can use it to choose and roll out a
|
|||
new upgrade to an existing app.
|
||||
|
||||
This command specifically supports incrementing the version of running apps, as
|
||||
opposed to "abra app deploy <app>" which will not change the version of a
|
||||
opposed to "abra app deploy <domain>" which will not change the version of a
|
||||
deployed app.
|
||||
|
||||
You may pass "--force/-f" to upgrade to the same version again. This can be
|
||||
|
|
|
@ -31,8 +31,9 @@ func getImagePath(image string) (string, error) {
|
|||
}
|
||||
|
||||
var appVersionCommand = cli.Command{
|
||||
Name: "version",
|
||||
Aliases: []string{"v"},
|
||||
Name: "version",
|
||||
Aliases: []string{"v"},
|
||||
ArgsUsage: "<domain>",
|
||||
Flags: []cli.Flag{
|
||||
internal.DebugFlag,
|
||||
internal.NoInputFlag,
|
||||
|
|
|
@ -13,8 +13,9 @@ import (
|
|||
)
|
||||
|
||||
var appVolumeListCommand = cli.Command{
|
||||
Name: "list",
|
||||
Aliases: []string{"ls"},
|
||||
Name: "list",
|
||||
Aliases: []string{"ls"},
|
||||
ArgsUsage: "<domain>",
|
||||
Flags: []cli.Flag{
|
||||
internal.DebugFlag,
|
||||
internal.NoInputFlag,
|
||||
|
@ -58,7 +59,7 @@ var appVolumeRemoveCommand = cli.Command{
|
|||
Description: `
|
||||
This command supports removing volumes associated with an app. The app in
|
||||
question must be undeployed before you try to remove volumes. See "abra app
|
||||
undeploy <app>" for more.
|
||||
undeploy <domain>" for more.
|
||||
|
||||
The command is interactive and will show a multiple select input which allows
|
||||
you to make a seclection. Use the "?" key to see more help on navigating this
|
||||
|
@ -66,7 +67,7 @@ interface.
|
|||
|
||||
Passing "--force" will select all volumes for removal. Be careful.
|
||||
`,
|
||||
ArgsUsage: "<app>",
|
||||
ArgsUsage: "<domain>",
|
||||
Aliases: []string{"rm"},
|
||||
Flags: []cli.Flag{
|
||||
internal.DebugFlag,
|
||||
|
@ -115,7 +116,7 @@ var appVolumeCommand = cli.Command{
|
|||
Name: "volume",
|
||||
Aliases: []string{"vl"},
|
||||
Usage: "Manage app volumes",
|
||||
ArgsUsage: "<command>",
|
||||
ArgsUsage: "<domain>",
|
||||
Subcommands: []cli.Command{
|
||||
appVolumeListCommand,
|
||||
appVolumeRemoveCommand,
|
||||
|
|
|
@ -92,7 +92,7 @@ Supported shells are as follows:
|
|||
sudo mkdir /etc/bash_completion.d/
|
||||
sudo cp %s /etc/bash_completion.d/abra
|
||||
echo "source /etc/bash_completion.d/abra" >> ~/.bashrc
|
||||
# And finally run "abra app ps <hit tab key>" to test things are working, you should see app names listed!
|
||||
# And finally run "abra app ps <hit tab key>" to test things are working, you should see app domains listed!
|
||||
`, autocompletionFile))
|
||||
case "zsh":
|
||||
fmt.Println(fmt.Sprintf(`
|
||||
|
@ -100,7 +100,7 @@ echo "source /etc/bash_completion.d/abra" >> ~/.bashrc
|
|||
sudo mkdir /etc/zsh/completion.d/
|
||||
sudo cp %s /etc/zsh/completion.d/abra
|
||||
echo "PROG=abra\n_CLI_ZSH_AUTOCOMPLETE_HACK=1\nsource /etc/zsh/completion.d/abra" >> ~/.zshrc
|
||||
# And finally run "abra app ps <hit tab key>" to test things are working, you should see app names listed!
|
||||
# And finally run "abra app ps <hit tab key>" to test things are working, you should see app domains listed!
|
||||
`, autocompletionFile))
|
||||
}
|
||||
|
||||
|
|
|
@ -304,14 +304,6 @@ var NewAppServerFlag = &cli.StringFlag{
|
|||
Destination: &NewAppServer,
|
||||
}
|
||||
|
||||
var NewAppName string
|
||||
var NewAppNameFlag = &cli.StringFlag{
|
||||
Name: "app-name, a",
|
||||
Value: "",
|
||||
Usage: "Choose an app name",
|
||||
Destination: &NewAppName,
|
||||
}
|
||||
|
||||
var NoDomainChecks bool
|
||||
var NoDomainChecksFlag = &cli.BoolFlag{
|
||||
Name: "no-domain-checks, nd",
|
||||
|
|
|
@ -162,7 +162,7 @@ func DeployAction(c *cli.Context) error {
|
|||
|
||||
// DeployOverview shows a deployment overview
|
||||
func DeployOverview(app config.App, version, message string) error {
|
||||
tableCol := []string{"server", "compose", "domain", "app name", "version"}
|
||||
tableCol := []string{"server", "compose", "domain", "version"}
|
||||
table := formatter.CreateTable(tableCol)
|
||||
|
||||
deployConfig := "compose.yml"
|
||||
|
@ -175,7 +175,7 @@ func DeployOverview(app config.App, version, message string) error {
|
|||
server = "local"
|
||||
}
|
||||
|
||||
table.Append([]string{server, deployConfig, app.Domain, app.Name, version})
|
||||
table.Append([]string{server, deployConfig, app.Domain, version})
|
||||
table.Render()
|
||||
|
||||
if NoInput {
|
||||
|
@ -200,7 +200,7 @@ func DeployOverview(app config.App, version, message string) error {
|
|||
|
||||
// NewVersionOverview shows an upgrade or downgrade overview
|
||||
func NewVersionOverview(app config.App, currentVersion, newVersion, releaseNotes string) error {
|
||||
tableCol := []string{"server", "compose", "domain", "app name", "current version", "to be deployed"}
|
||||
tableCol := []string{"server", "compose", "domain", "current version", "to be deployed"}
|
||||
table := formatter.CreateTable(tableCol)
|
||||
|
||||
deployConfig := "compose.yml"
|
||||
|
@ -213,7 +213,7 @@ func NewVersionOverview(app config.App, currentVersion, newVersion, releaseNotes
|
|||
server = "local"
|
||||
}
|
||||
|
||||
table.Append([]string{server, deployConfig, app.Domain, app.Name, currentVersion, newVersion})
|
||||
table.Append([]string{server, deployConfig, app.Domain, currentVersion, newVersion})
|
||||
table.Render()
|
||||
|
||||
if releaseNotes == "" {
|
||||
|
|
|
@ -23,7 +23,7 @@ var RecipeName string
|
|||
|
||||
// createSecrets creates all secrets for a new app.
|
||||
func createSecrets(sanitisedAppName string) (AppSecrets, error) {
|
||||
appEnvPath := path.Join(config.ABRA_DIR, "servers", NewAppServer, fmt.Sprintf("%s.env", NewAppName))
|
||||
appEnvPath := path.Join(config.ABRA_DIR, "servers", NewAppServer, fmt.Sprintf("%s.env", Domain))
|
||||
appEnv, err := config.ReadEnv(appEnvPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -89,25 +89,6 @@ func ensureServerFlag() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// ensureServerFlag checks if the AppName flag was used. if not, asks the user for it.
|
||||
func ensureAppNameFlag() error {
|
||||
if NewAppName == "" && !NoInput {
|
||||
prompt := &survey.Input{
|
||||
Message: "Specify app name:",
|
||||
Default: Domain,
|
||||
}
|
||||
if err := survey.AskOne(prompt, &NewAppName); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if NewAppName == "" {
|
||||
return fmt.Errorf("no app name provided")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAction is the new app creation logic
|
||||
func NewAction(c *cli.Context) error {
|
||||
recipe := ValidateRecipeWithPrompt(c)
|
||||
|
@ -124,17 +105,13 @@ func NewAction(c *cli.Context) error {
|
|||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
if err := ensureAppNameFlag(); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
sanitisedAppName := config.SanitiseAppName(NewAppName)
|
||||
sanitisedAppName := config.SanitiseAppName(Domain)
|
||||
if len(sanitisedAppName) > 45 {
|
||||
logrus.Fatalf("%s cannot be longer than 45 characters", sanitisedAppName)
|
||||
}
|
||||
logrus.Debugf("%s sanitised as %s for new app", NewAppName, sanitisedAppName)
|
||||
logrus.Debugf("%s sanitised as %s for new app", Domain, sanitisedAppName)
|
||||
|
||||
if err := config.TemplateAppEnvSample(recipe.Name, NewAppName, NewAppServer, Domain); err != nil {
|
||||
if err := config.TemplateAppEnvSample(recipe.Name, Domain, NewAppServer, Domain); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
|
@ -163,9 +140,9 @@ func NewAction(c *cli.Context) error {
|
|||
NewAppServer = "local"
|
||||
}
|
||||
|
||||
tableCol := []string{"server", "type", "domain", "app name"}
|
||||
tableCol := []string{"server", "type", "domain"}
|
||||
table := formatter.CreateTable(tableCol)
|
||||
table.Append([]string{NewAppServer, recipe.Name, Domain, NewAppName})
|
||||
table.Append([]string{NewAppServer, recipe.Name, Domain})
|
||||
|
||||
fmt.Println("")
|
||||
fmt.Println(fmt.Sprintf("A new %s app has been created! Here is an overview:", recipe.Name))
|
||||
|
@ -173,10 +150,10 @@ func NewAction(c *cli.Context) error {
|
|||
table.Render()
|
||||
fmt.Println("")
|
||||
fmt.Println("You can configure this app by running the following:")
|
||||
fmt.Println(fmt.Sprintf("\n abra app config %s", NewAppName))
|
||||
fmt.Println(fmt.Sprintf("\n abra app config %s", Domain))
|
||||
fmt.Println("")
|
||||
fmt.Println("You can deploy this app by running the following:")
|
||||
fmt.Println(fmt.Sprintf("\n abra app deploy %s", NewAppName))
|
||||
fmt.Println(fmt.Sprintf("\n abra app deploy %s", Domain))
|
||||
fmt.Println("")
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue