feat: no domain checks flag

See coop-cloud/organising#281.
This commit is contained in:
cellarspoon 2021-12-21 23:57:20 +01:00
parent e9b4541c91
commit b72bad955a
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410
4 changed files with 22 additions and 7 deletions

View File

@ -13,6 +13,7 @@ var appDeployCommand = &cli.Command{
Flags: []cli.Flag{
internal.ForceFlag,
internal.ChaosFlag,
internal.NoDomainChecksFlag,
},
Description: `
This command deploys a new instance of an app. It does not support changing the

View File

@ -24,6 +24,7 @@ var appUpgradeCommand = &cli.Command{
Flags: []cli.Flag{
internal.ForceFlag,
internal.ChaosFlag,
internal.NoDomainChecksFlag,
},
Description: `
This command supports upgrading an app. You can use it to choose and roll out a

View File

@ -392,6 +392,15 @@ var NewAppNameFlag = &cli.StringFlag{
Destination: &NewAppName,
}
var NoDomainChecks bool
var NoDomainChecksFlag = &cli.BoolFlag{
Name: "no-domain-checks",
Aliases: []string{"nd"},
Value: false,
Usage: "Disable app domain sanity checks",
Destination: &NoDomainChecks,
}
// SSHFailMsg is a hopefully helpful SSH failure message
var SSHFailMsg = `
Woops, Abra is unable to connect to connect to %s.

View File

@ -116,14 +116,18 @@ func DeployAction(c *cli.Context) error {
logrus.Fatal(err)
}
domainName := app.Env["DOMAIN"]
ipv4, err := dns.EnsureIPv4(domainName)
if err != nil || ipv4 == "" {
logrus.Fatalf("could not find an IP address assigned to %s?", domainName)
}
if !NoDomainChecks {
domainName := app.Env["DOMAIN"]
ipv4, err := dns.EnsureIPv4(domainName)
if err != nil || ipv4 == "" {
logrus.Fatalf("could not find an IP address assigned to %s?", domainName)
}
if _, err = dns.EnsureDomainsResolveSameIPv4(domainName, app.Server); err != nil {
logrus.Fatal(err)
if _, err = dns.EnsureDomainsResolveSameIPv4(domainName, app.Server); err != nil {
logrus.Fatal(err)
}
} else {
logrus.Warn("skipping domain checks as requested")
}
if err := stack.RunDeploy(cl, deployOpts, compose, app.Env["TYPE"]); err != nil {