refactor!: drop auto traefik deploy, rarely works
continuous-integration/drone/push Build is passing Details

This commit is contained in:
decentral1se 2022-01-19 11:08:43 +01:00
parent a1abe5c6be
commit a33767f848
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410
1 changed files with 2 additions and 53 deletions

View File

@ -7,7 +7,6 @@ import (
"os" "os"
"os/exec" "os/exec"
"os/user" "os/user"
"path"
"path/filepath" "path/filepath"
"strings" "strings"
@ -75,13 +74,6 @@ var askSudoPassFlag = &cli.BoolFlag{
Destination: &askSudoPass, Destination: &askSudoPass,
} }
var traefik bool
var traefikFlag = &cli.BoolFlag{
Name: "traefik, t",
Usage: "Deploy traefik",
Destination: &traefik,
}
func cleanUp(domainName string) { func cleanUp(domainName string) {
logrus.Warnf("cleaning up context for %s", domainName) logrus.Warnf("cleaning up context for %s", domainName)
if err := client.DeleteContext(domainName); err != nil { if err := client.DeleteContext(domainName); err != nil {
@ -155,12 +147,6 @@ func newLocalServer(c *cli.Context, domainName string) error {
} }
} }
if traefik {
if err := deployTraefik(c, cl, domainName); err != nil {
return err
}
}
logrus.Info("local server has been added") logrus.Info("local server has been added")
return nil return nil
@ -380,32 +366,6 @@ func createServerDir(domainName string) error {
return nil return nil
} }
func deployTraefik(c *cli.Context, cl *dockerClient.Client, domainName string) error {
internal.NoInput = true
internal.RecipeName = "traefik"
internal.NewAppServer = domainName
internal.Domain = fmt.Sprintf("%s.%s", "traefik", domainName)
internal.NewAppName = fmt.Sprintf("%s_%s", "traefik", config.SanitiseAppName(domainName))
appEnvPath := path.Join(config.ABRA_DIR, "servers", internal.Domain, fmt.Sprintf("%s.env", internal.NewAppName))
if _, err := os.Stat(appEnvPath); os.IsNotExist(err) {
logrus.Info(fmt.Sprintf("-t/--traefik specified, automatically deploying traefik to %s", internal.NewAppServer))
if err := internal.NewAction(c); err != nil {
logrus.Fatal(err)
}
} else {
logrus.Infof("%s already exists, not creating again", appEnvPath)
}
internal.AppName = internal.NewAppName
if err := internal.DeployAction(c); err != nil {
logrus.Fatal(err)
}
return nil
}
var serverAddCommand = cli.Command{ var serverAddCommand = cli.Command{
Name: "add", Name: "add",
Aliases: []string{"a"}, Aliases: []string{"a"},
@ -444,7 +404,7 @@ system username to make an initial connection. You can use the <user> and
Example: Example:
abra server add --provision --traefik varia.zone glodemodem 12345 abra server add --provision varia.zone glodemodem 12345
Abra will construct the following SSH connection and Docker context: Abra will construct the following SSH connection and Docker context:
@ -452,11 +412,7 @@ Abra will construct the following SSH connection and Docker context:
All communication between Abra and the server will use this SSH connection. All communication between Abra and the server will use this SSH connection.
In this example, Abra will run the following operations: In this example, Abra will install Docker and initialise swarm mode.
1. Install Docker
2. Initialise Swarm mode
3. Deploy Traefik (core web proxy)
You may omit flags to avoid performing this provisioning logic. You may omit flags to avoid performing this provisioning logic.
`, `,
@ -467,7 +423,6 @@ You may omit flags to avoid performing this provisioning logic.
provisionFlag, provisionFlag,
sshAuthFlag, sshAuthFlag,
askSudoPassFlag, askSudoPassFlag,
traefikFlag,
}, },
Before: internal.SubCommandBefore, Before: internal.SubCommandBefore,
ArgsUsage: "<domain> [<user>] [<port>]", ArgsUsage: "<domain> [<user>] [<port>]",
@ -543,12 +498,6 @@ You may omit flags to avoid performing this provisioning logic.
logrus.Fatalf("couldn't make a remote docker connection to %s? use --provision/-p to attempt to install", domainName) logrus.Fatalf("couldn't make a remote docker connection to %s? use --provision/-p to attempt to install", domainName)
} }
if traefik {
if err := deployTraefik(c, cl, domainName); err != nil {
logrus.Fatal(err)
}
}
return nil return nil
}, },
} }