コード例 #1
0
ファイル: cmd.go プロジェクト: tob1k/deisctl
func StartPlatform(b backend.Backend) error {
	fmt.Println(utils.DeisIfy("Starting Deis..."))
	if err := startDataContainers(b); err != nil {
		return err
	}
	if err := startDefaultServices(b); err != nil {
		return err
	}
	fmt.Println("Deis started.")
	return nil
}
コード例 #2
0
ファイル: cmd.go プロジェクト: tob1k/deisctl
func InstallPlatform(b backend.Backend) error {
	fmt.Println(utils.DeisIfy("Installing Deis..."))
	if err := installDataContainers(b); err != nil {
		return err
	}
	if err := installDefaultServices(b); err != nil {
		return err
	}
	fmt.Println("Deis installed.")
	fmt.Println("Please run `deisctl start platform` to boot up Deis.")
	return nil
}
コード例 #3
0
ファイル: deisctl.go プロジェクト: tob1k/deisctl
func main() {
	deisctlMotd := utils.DeisIfy("Deis Control Utility")
	usage := deisctlMotd + `
Usage:
  deisctl <command> [<target>...] [options]

Commands:
  deisctl install [<service> | platform]
  deisctl uninstall [<service> | platform]
  deisctl list
  deisctl scale [<service>=<num>]
  deisctl start [<service> | platform]
  deisctl stop [<service> | platform]
  deisctl restart [<service> | platform]
  deisctl journal <service>
  deisctl config <component> <get|set> <args>
  deisctl update
  deisctl refresh-units

Example Commands:
  deisctl install platform
  deisctl uninstall builder@1
  deisctl scale router=2
  deisctl start router@2
  deisctl stop router builder
  deisctl status controller
  deisctl journal controller

Options:
  --version                   print version and exit
  --endpoint=<url>            etcd endpoint for fleet [default: http://127.0.0.1:4001]
  --etcd-key-prefix=<path>    keyspace for fleet data in etcd [default: /_coreos.com/fleet/]
  --etcd-keyfile=<path>       etcd key file authentication [default: ]
  --etcd-certfile=<path>      etcd cert file authentication [default: ]
  --etcd-cafile=<path>        etcd CA file authentication [default: ]
  --known-hosts-file=<path>   file used to store remote machine fingerprints [default: ~/.ssh/known_hosts]
  --strict-host-key-checking  verify SSH host keys [default: true]
  --tunnel=<host>             establish an SSH tunnel for communication with fleet and etcd [default: ]
  --request-timeout=<secs>    amount of time to allow a single request before considering it failed. [default: 3.0]
`
	// parse command-line arguments
	args, err := docopt.Parse(usage, nil, true, Version, true)
	if err != nil {
		exit(err, 2)
	}
	command := args["<command>"]
	targets := args["<target>"].([]string)
	setGlobalFlags(args)
	// construct a client
	c, err := client.NewClient("fleet")
	if err != nil {
		exit(err, 1)
	}
	// dispatch the command
	switch command {
	case "list":
		err = c.List()
	case "scale":
		err = c.Scale(targets)
	case "start":
		err = c.Start(targets)
	case "restart":
		err = c.Restart(targets)
	case "stop":
		err = c.Stop(targets)
	case "status":
		err = c.Status(targets)
	case "journal":
		err = c.Journal(targets)
	case "install":
		err = c.Install(targets)
	case "uninstall":
		err = c.Uninstall(targets)
	case "config":
		err = c.Config()
	case "update":
		err = c.Update()
	case "refresh-units":
		err = c.RefreshUnits()
	default:
		fmt.Printf(usage)
		os.Exit(2)
	}
	if err != nil {
		exit(err, 1)
	}
}