func runSetup(ctx *cli.Context) { var err error env := config.NewEnvironment() force := ctx.Bool("force") env.Tz = prompter.Prompt("Timezone", env.Tz) env.SitesDir, err = promptForDir("Sites directory", env.SitesDir) if err != nil { util.Fatal(err) } env.DataDir, err = promptForDir("Database storage directory", env.DataDir) if err != nil { util.Fatal(err) } err = env.Check() if err != nil { util.Fatal(err) } acts := []step.ConfigStep{ step.VariablesStep, } if env.RequiresMachine() { acts = append(acts, step.MachineStep) acts = append(acts, step.NfsServerStep) acts = append(acts, step.NfsClientStep) } acts = append(acts, step.ServicesStep) acts = append(acts, step.NewDnsAction()) for _, act := range acts { needs := act.NeedsRun(env) if needs || force { util.Successf("Running %s", act.GetName()) err := act.Run(env) if err != nil { util.Fatal(err) } } else { util.Successf("Skipping %s", act.GetName()) } } util.Success("Setup complete") }
func runDiagnose(ctx *cli.Context) { fmt.Println("Running diagnostics...") env := config.NewEnvironment() if err := env.Check(); err != nil { util.Fatal(err) } if err := checkInstall(env); err != nil { util.Fatal(err) } if err := checkConnection(env); err != nil { util.Fatal(err) } if err := checkContainers(env); err != nil { util.Fatal(err) } if err := checkDns(env); err != nil { util.Fatal(err) } util.Success("OK - No issues found") }