本文整理汇总了Golang中github.com/deis/deis/deisctl/utils.DeisIfy函数的典型用法代码示例。如果您正苦于以下问题:Golang DeisIfy函数的具体用法?Golang DeisIfy怎么用?Golang DeisIfy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DeisIfy函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: InstallPlatform
// InstallPlatform loads all components' definitions from local unit files.
// After InstallPlatform, all components will be available for StartPlatform.
func InstallPlatform(b backend.Backend, checkKeys func() error, stateless bool) error {
if err := checkKeys(); err != nil {
return err
}
if stateless {
fmt.Println("Warning: With a stateless control plane, `deis logs` will be unavailable.")
fmt.Println("Additionally, components will need to be configured to use external persistent stores.")
fmt.Println("See the official Deis documentation for details on running a stateless control plane.")
}
outchan := make(chan string)
errchan := make(chan error)
var wg sync.WaitGroup
go printState(outchan, errchan, 500*time.Millisecond)
outchan <- utils.DeisIfy("Installing Deis...")
installDefaultServices(b, stateless, &wg, outchan, errchan)
wg.Wait()
close(outchan)
fmt.Println("Done.")
fmt.Println()
if stateless {
fmt.Println("Please run `deisctl start stateless-platform` to boot up Deis.")
} else {
fmt.Println("Please run `deisctl start platform` to boot up Deis.")
}
return nil
}
示例2: UnInstallSwarm
//UnInstallSwarm uninstall Swarm
func UnInstallSwarm(b backend.Backend) error {
outchan := make(chan string)
errchan := make(chan error)
defer close(outchan)
defer close(errchan)
var wg sync.WaitGroup
go printState(outchan, errchan, 500*time.Millisecond)
outchan <- utils.DeisIfy("Destroying Swarm...")
outchan <- fmt.Sprintf("swarm nodes and swarm manager...")
b.Destroy([]string{"swarm-node", "swarm-manager"}, &wg, outchan, errchan)
wg.Wait()
fmt.Println("Done.")
fmt.Println()
return nil
}
示例3: InstallSwarm
//InstallSwarm Installs swarm
func InstallSwarm(b backend.Backend) error {
outchan := make(chan string)
errchan := make(chan error)
defer close(outchan)
defer close(errchan)
var wg sync.WaitGroup
go printState(outchan, errchan, 500*time.Millisecond)
outchan <- utils.DeisIfy("Installing Swarm...")
outchan <- fmt.Sprintf("Swarm node and Swarm Manager...")
b.Create([]string{"swarm-node", "swarm-manager"}, &wg, outchan, errchan)
wg.Wait()
fmt.Println("Done.")
fmt.Println()
fmt.Println("Please run `deisctl start swarm` to start swarm.")
return nil
}
示例4: UninstallPlatform
// UninstallPlatform unloads all components' definitions.
// After UninstallPlatform, all components will be unavailable.
func UninstallPlatform(b backend.Backend) error {
outchan := make(chan string)
errchan := make(chan error)
var wg sync.WaitGroup
go printState(outchan, errchan, 500*time.Millisecond)
outchan <- utils.DeisIfy("Uninstalling Deis...")
uninstallAllServices(b, &wg, outchan, errchan)
wg.Wait()
close(outchan)
fmt.Println("Done.")
return nil
}
示例5: StartSwarm
//StartSwarm starts Swarm Schduler
func StartSwarm(b backend.Backend) error {
outchan := make(chan string)
errchan := make(chan error)
defer close(outchan)
defer close(errchan)
var wg sync.WaitGroup
go printState(outchan, errchan, 500*time.Millisecond)
outchan <- utils.DeisIfy("Starting Swarm...")
outchan <- fmt.Sprintf("swarm nodes...")
b.Start([]string{"swarm-node"}, &wg, outchan, errchan)
wg.Wait()
outchan <- fmt.Sprintf("swarm manager...")
b.Start([]string{"swarm-manager"}, &wg, outchan, errchan)
wg.Wait()
fmt.Println("Done.")
fmt.Println("Please run `deisctl config controller set schedulerModule=swarm` to use the swarm scheduler.")
return nil
}
示例6: StopPlatform
// StopPlatform deactivates all components.
func StopPlatform(b backend.Backend) error {
outchan := make(chan string)
errchan := make(chan error)
var wg sync.WaitGroup
go printState(outchan, errchan, 500*time.Millisecond)
outchan <- utils.DeisIfy("Stopping Deis...")
stopDefaultServices(b, &wg, outchan, errchan)
wg.Wait()
close(outchan)
fmt.Println("Done.")
fmt.Println()
fmt.Println("Please run `deisctl start platform` to restart Deis.")
return nil
}
示例7: StartPlatform
// StartPlatform activates all components.
func StartPlatform(b backend.Backend) error {
outchan := make(chan string)
errchan := make(chan error)
var wg sync.WaitGroup
go printState(outchan, errchan, 500*time.Millisecond)
outchan <- utils.DeisIfy("Starting Deis...")
startDefaultServices(b, &wg, outchan, errchan)
wg.Wait()
close(outchan)
fmt.Println("Done.")
fmt.Println()
fmt.Println("Please use `deis register` to setup an administrator account.")
return nil
}
示例8: InstallPlatform
// InstallPlatform loads all components' definitions from local unit files.
// After InstallPlatform, all components will be available for StartPlatform.
func InstallPlatform(b backend.Backend) error {
if err := checkRequiredKeys(); err != nil {
return err
}
outchan := make(chan string)
errchan := make(chan error)
var wg sync.WaitGroup
go printState(outchan, errchan, 500*time.Millisecond)
outchan <- utils.DeisIfy("Installing Deis...")
installDefaultServices(b, &wg, outchan, errchan)
wg.Wait()
close(outchan)
fmt.Println("Done.")
fmt.Println()
fmt.Println("Please run `deisctl start platform` to boot up Deis.")
return nil
}
示例9: Command
// Command executes the given deisctl command line.
func Command(argv []string) int {
deisctlMotd := utils.DeisIfy("Deis Control Utility")
usage := deisctlMotd + `
Usage: deisctl [options] <command> [<args>...]
Commands, use "deisctl help <command>" to learn more:
install install components, or the entire platform
uninstall uninstall components
list list installed components
start start components
stop stop components
restart stop, then start components
scale grow or shrink the number of routers, registries or store gateways
journal print the log output of a component
config set platform or component values
refresh-units refresh unit files from GitHub
help show the help screen for a command
Options:
-h --help show this help screen
--endpoint=<url> etcd endpoint for fleet [default: http://127.0.0.1:4001]
--etcd-cafile=<path> etcd CA file authentication [default: ]
--etcd-certfile=<path> etcd cert file authentication [default: ]
--etcd-key-prefix=<path> keyspace for fleet data in etcd [default: /_coreos.com/fleet/]
--etcd-keyfile=<path> etcd key file authentication [default: ]
--known-hosts-file=<path> where to store remote fingerprints [default: ~/.ssh/known_hosts]
--request-timeout=<secs> seconds before a request is considered failed [default: 10.0]
--ssh-timeout=<secs> seconds before SSH connection is considered failed [default: 10.0]
--strict-host-key-checking verify SSH host keys [default: true]
--tunnel=<host> SSH tunnel for communication with fleet and etcd [default: ]
--version print the version of deisctl
`
// pre-parse command-line arguments
argv, helpFlag := parseArgs(argv)
// give docopt an optional final false arg so it doesn't call os.Exit()
args, err := docopt.Parse(usage, argv, false, version.Version, true, false)
if err != nil || len(args) == 0 {
if helpFlag {
fmt.Print(usage)
return 0
}
return 1
}
command := args["<command>"]
setTunnel := true
// "--help" and "refresh-units" doesn't need SSH tunneling
if helpFlag || command == "refresh-units" {
setTunnel = false
}
setGlobalFlags(args, setTunnel)
// clean up the args so subcommands don't need to reparse them
argv = removeGlobalArgs(argv)
// construct a client
c, err := client.NewClient("fleet")
if err != nil {
fmt.Printf("Error: %v\n", err)
return 1
}
// Dispatch the command, passing the argv through so subcommands can
// re-parse it according to their usage strings.
switch command {
case "list":
err = c.List(argv)
case "scale":
err = c.Scale(argv)
case "start":
err = c.Start(argv)
case "restart":
err = c.Restart(argv)
case "stop":
err = c.Stop(argv)
case "status":
err = c.Status(argv)
case "journal":
err = c.Journal(argv)
case "install":
err = c.Install(argv)
case "uninstall":
err = c.Uninstall(argv)
case "config":
err = c.Config(argv)
case "refresh-units":
err = c.RefreshUnits(argv)
case "help":
fmt.Print(usage)
return 0
default:
fmt.Println(`Found no matching command, try "deisctl help"
Usage: deisctl <command> [<args>...] [options]`)
return 1
}
if err != nil {
fmt.Printf("Error: %v\n", err)
return 1
}
return 0
}