cmd

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2015 License: BSD-4-Clause, MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AddonsListCommand = cli.Command{
		Name:     "addons",
		Category: "Addons",
		Usage:    "List used add-ons",
		Flags:    []cli.Flag{appFlag},
		Description: ` List all addons used by your app:
    $ scalingo -a myapp addons

		# See also 'addons-add' and 'addons-remove'
`,
		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			var err error
			if len(c.Args()) == 0 {
				err = addons.List(currentApp)
			} else {
				cli.ShowCommandHelp(c, "addons")
			}

			if err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "addons")
		},
	}
	AddonsAddCommand = cli.Command{
		Name:     "addons-add",
		Category: "Addons",
		Flags:    []cli.Flag{appFlag},
		Usage:    "Provision an add-on for your application",
		Description: ` Provision an add-on for your application:
    $ scalingo -a myapp addons-add <addon-name> <plan>

		# See also 'addons-list' and 'addons-plans'
`,
		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			var err error
			if len(c.Args()) == 2 {
				err = addons.Provision(currentApp, c.Args()[0], c.Args()[1])
			} else {
				cli.ShowCommandHelp(c, "addons-add")
			}
			if err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "addons-add")
			autocomplete.AddonsAddAutoComplete(c)
		},
	}
	AddonsRemoveCommand = cli.Command{
		Name:     "addons-remove",
		Category: "Addons",
		Flags:    []cli.Flag{appFlag},
		Usage:    "Remove an existing addon from your app",
		Description: ` Remove an existing addon from your app:
    $ scalingo -a myapp addons-remove <addon-id>

		# See also 'addons' and 'addons-remove'
`,
		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			var err error
			if len(c.Args()) == 1 {
				err = addons.Destroy(currentApp, c.Args()[0])
			} else {
				cli.ShowCommandHelp(c, "addons-remove")
			}
			if err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "addons-remove")
			autocomplete.AddonsRemoveAutoComplete(c)
		},
	}
	AddonsUpgradeCommand = cli.Command{
		Name:     "addons-upgrade",
		Category: "Addons",
		Flags:    []cli.Flag{appFlag},
		Usage:    "Upgrade or downgrade an add-on attached to your app",
		Description: ` Upgrade an addon attached to your app:
    $ scalingo -a myapp addons-upgrade <addon-id> <plan>

		# See also 'addons-plans' and 'addons-remove'
`,
		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			var err error
			if len(c.Args()) == 2 {
				err = addons.Upgrade(currentApp, c.Args()[0], c.Args()[1])
			} else {
				cli.ShowCommandHelp(c, "addons-upgrade")
			}
			if err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "addons-upgrade")
			autocomplete.AddonsUpgradeAutoComplete(c)
		},
	}
)
View Source
var (
	CollaboratorsListCommand = cli.Command{
		Name:        "collaborators",
		Category:    "Collaborators",
		Usage:       "List the collaborators of an application",
		Flags:       []cli.Flag{appFlag},
		Description: "List all the collaborator of an application and display information about them.",
		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			if len(c.Args()) != 0 {
				cli.ShowCommandHelp(c, "collaborators")
			} else {
				err := collaborators.List(currentApp)
				if err != nil {
					errorQuit(err)
				}
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "collaborators")
		},
	}

	CollaboratorsAddCommand = cli.Command{
		Name:        "collaborators-add",
		Category:    "Collaborators",
		Usage:       "Invite someone to work on an application",
		Flags:       []cli.Flag{appFlag},
		Description: "Invite someone to collaborate on an application, an invitation will be sent to the given email\n scalingo -a myapp collaborators-add user@example.com",
		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			if len(c.Args()) != 1 {
				cli.ShowCommandHelp(c, "collaborators-add")
			} else {
				err := collaborators.Add(currentApp, c.Args()[0])
				if err != nil {
					errorQuit(err)
				}
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "collaborators-add")
			autocomplete.CollaboratorsAddAutoComplete(c)
		},
	}

	CollaboratorsRemoveCommand = cli.Command{
		Name:        "collaborators-remove",
		Category:    "Collaborators",
		Usage:       "Revoke permission to collaborate on an application",
		Flags:       []cli.Flag{appFlag},
		Description: "Revoke the invitation of collaboration to the given email\n    scalingo -a myapp collaborators-remove user@example.com",
		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			if len(c.Args()) != 1 {
				cli.ShowCommandHelp(c, "collaborators-remove")
			} else {
				err := collaborators.Remove(currentApp, c.Args()[0])
				if err != nil {
					errorQuit(err)
				}
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "collaborators-remove")
			autocomplete.CollaboratorsRemoveAutoComplete(c)
		},
	}
)
View Source
var (
	DomainsListCommand = cli.Command{
		Name:     "domains",
		Category: "Custom Domains",
		Flags:    []cli.Flag{appFlag},
		Usage:    "List the domains of an application",
		Description: `List all the custom domains of an application:

    $ scalingo -a myapp domains

    # See also commands 'domains-add' and 'domains-remove'`,

		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			var err error
			if len(c.Args()) == 0 {
				err = domains.List(currentApp)
			} else {
				cli.ShowCommandHelp(c, "domains")
			}

			if err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "domains")
		},
	}

	DomainsAddCommand = cli.Command{
		Name:     "domains-add",
		Category: "Custom Domains",
		Usage:    "Add a custom domain to an application",
		Flags: []cli.Flag{appFlag,
			cli.StringFlag{Name: "cert", Usage: "SSL Signed Certificate", Value: "domain.crt", EnvVar: ""},
			cli.StringFlag{Name: "key", Usage: "SSL Keypair", Value: "domain.key", EnvVar: ""},
		},
		Description: `Add a custom domain to an application:

    $ scalingo -a myapp domains-add example.com

    # See also commands 'domains' and 'domains-remove'`,

		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			var err error
			if len(c.Args()) == 1 {
				cert := c.String("cert")
				if cert == "domain.crt" {
					cert = ""
				}
				key := c.String("key")
				if key == "domain.key" {
					key = ""
				}
				err = domains.Add(currentApp, c.Args()[0], cert, key)
			} else {
				cli.ShowCommandHelp(c, "domains-add")
			}

			if err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "domains-add")
		},
	}

	DomainsRemoveCommand = cli.Command{
		Name:     "domains-remove",
		Category: "Custom Domains",
		Flags:    []cli.Flag{appFlag},
		Usage:    "Remove a custom domain from an application",
		Description: `Remove a custom domain from an application:

    $ scalingo -a myapp domains-remove example.com

    # See also commands 'domains' and 'domains-add'`,

		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			var err error
			if len(c.Args()) == 1 {
				err = domains.Remove(currentApp, c.Args()[0])
			} else {
				cli.ShowCommandHelp(c, "domains-remove")
			}

			if err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "domains-remove")
			autocomplete.DomainsRemoveAutoComplete(c)
		},
	}

	DomainsSSLCommand = cli.Command{
		Name:     "domains-ssl",
		Category: "Custom Domains",
		Usage:    "Enable or disable SSL for your custom domains",
		Flags: []cli.Flag{appFlag,
			cli.StringFlag{Name: "cert", Usage: "SSL Signed Certificate", Value: "domain.crt", EnvVar: ""},
			cli.StringFlag{Name: "key", Usage: "SSL Keypair", Value: "domain.key", EnvVar: ""},
		},
		Description: `Enable or disable SSL for your custom domains:
		
		$ scalingo -a myapp domains-ssl example.com --cert <certificate.crt> --key <keyfile.key>

		$ scalingo -a myapp domains-ssl example.com disable
		
		# See also commands 'domains' and 'domains-add'`,

		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			var err error
			if len(c.Args()) == 2 && c.Args()[1] == "disable" {
				err = domains.DisableSSL(currentApp, c.Args()[0])
			} else if len(c.Args()) == 1 {
				err = domains.EnableSSL(currentApp, c.Args()[0], c.String("cert"), c.String("key"))
			} else {
				cli.ShowCommandHelp(c, "domains-ssl")
			}
			if err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "domains-ssl")
		},
	}
)
View Source
var (
	EnvCommand = cli.Command{
		Name:     "env",
		Category: "Environment",
		Flags:    []cli.Flag{appFlag},
		Usage:    "Display the environment of your apps",
		Description: `List all the environment variables:

    $ scalingo -a myapp env

    # See also commands 'env-set' and 'env-unset'`,

		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			var err error
			if len(c.Args()) == 0 {
				err = env.Display(currentApp)
			} else {
				cli.ShowCommandHelp(c, "env")
			}

			if err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "env")
		},
	}

	EnvSetCommand = cli.Command{
		Name:     "env-set",
		Category: "Environment",
		Flags:    []cli.Flag{appFlag},
		Usage:    "Set the environment variables of your apps",
		Description: `Set variables:

    $ scalingo -a myapp env-set VAR1=VAL1 VAR2=VAL2

    # See also commands 'env' and 'env-unset'`,

		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			var err error
			if len(c.Args()) > 0 {
				err = env.Add(currentApp, c.Args())
			} else {
				cli.ShowCommandHelp(c, "env-set")
			}
			if err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "env-set")
		},
	}

	EnvUnsetCommand = cli.Command{
		Name:     "env-unset",
		Category: "Environment",
		Flags:    []cli.Flag{appFlag},
		Usage:    "Unset environment variables of your apps",
		Description: `Unset variables:

    $ scalingo -a myapp env-unset VAR1 VAR2

    # See also commands 'env' and 'env-set'`,

		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			var err error
			if len(c.Args()) > 0 {
				err = env.Delete(currentApp, c.Args())
			} else {
				cli.ShowCommandHelp(c, "env-unset")
			}
			if err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "env-unset")
			autocomplete.EnvUnsetAutoComplete(c)
		},
	}
)
View Source
var (
	ListSSHKeyCommand = cli.Command{
		Name:     "keys",
		Category: "Public SSH Keys",
		Usage:    "List your SSH public keys",
		Description: `List all the public SSH keys associated with your account:

    $ scalingo keys
		
    # See also commands 'keys-add' and 'keys-remove'`,

		Action: func(c *cli.Context) {
			err := keys.List()
			if err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "keys")
		},
	}

	AddSSHKeyCommand = cli.Command{
		Name:     "keys-add",
		Category: "Public SSH Keys",
		Usage:    "Add a public SSH key to deploy your apps",
		Description: `Add a public SSH key:

    $ scalingo keys-add keyname /path/to/key

    # See also commands 'keys' and 'keys-remove'`,

		Action: func(c *cli.Context) {
			if len(c.Args()) != 2 {
				cli.ShowCommandHelp(c, "keys-add")
				return
			}
			err := keys.Add(c.Args()[0], c.Args()[1])
			if err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "keys-add")
		},
	}

	RemoveSSHKeyCommand = cli.Command{
		Name:     "keys-remove",
		Category: "Public SSH Keys",
		Usage:    "Remove a public SSH key",
		Description: `Remove a public SSH key:

    $ scalingo keys-remove keyname

    # See also commands 'keys' and 'keys-add'`,

		Action: func(c *cli.Context) {
			if len(c.Args()) != 1 {
				cli.ShowCommandHelp(c, "keys-remove")
				return
			}
			err := keys.Remove(c.Args()[0])
			if err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "keys-remove")
			autocomplete.KeysRemoveAutoComplete(c)
		},
	}
)
View Source
var (
	EnvFlag    = cli.StringSlice([]string{})
	FilesFlag  = cli.StringSlice([]string{})
	RunCommand = cli.Command{
		Name:     "run",
		Category: "App Management",
		Usage:    "Run any command for your app",
		Flags: []cli.Flag{appFlag,
			cli.StringSliceFlag{Name: "env, e", Value: &EnvFlag, Usage: "Environment variables", EnvVar: ""},
			cli.StringSliceFlag{Name: "file, f", Value: &FilesFlag, Usage: "Files to upload", EnvVar: ""},
		},
		Description: `Run command in current app context, a one-off container will be
   start with your application environment loaded.

   Example
     scalingo --app rails-app run bundle exec rails console
     scalingo --app synfony-app run php app/console cache:clear

   If you need to inject additional environment variables, you can use the flag
   '-e'. You can use it multiple time to define multiple variables. These
   variables will override those defined in your application environment.

   Example
     scalingo run -e VARIABLE=VALUE -e VARIABLE2=OTHER_VALUE rails console

   Furthermore, you may want to upload a file, like a database dump or anything
   useful to you. The option '-f' has been built for this purpose, you can even
   upload multiple files if you wish. You will be able to find these files in the
   '/tmp/uploads' directory of the one-off container.

   Example
     scalingo run -f mysqldump.sql rails dbconsole < /tmp/uploads/mysqldump.sql`,
		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			opts := apps.RunOpts{
				App:    currentApp,
				Cmd:    c.Args(),
				CmdEnv: c.StringSlice("e"),
				Files:  c.StringSlice("f"),
			}
			if len(c.Args()) == 0 {
				cli.ShowCommandHelp(c, "run")
			} else if err := apps.Run(opts); err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "run")
		},
	}
)
View Source
var (
	AddonProvidersListCommand = cli.Command{
		Name:        "addons-list",
		Category:    "Addons - Global",
		Description: "List all addons you can add to your app.",
		Usage:       "List all addons",
		Action: func(c *cli.Context) {
			if err := addon_providers.List(); err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "addons-list")
		},
	}
)
View Source
var (
	AddonProvidersPlansCommand = cli.Command{
		Name:        "addons-plans",
		Category:    "Addons - Global",
		Description: "List the plans for an addon.\n    Example:\n    scalingo addon-plans scalingo-mongo",
		Usage:       "List plans",
		Action: func(c *cli.Context) {
			if len(c.Args()) != 1 {
				cli.ShowCommandHelp(c, "addon-plans")
				return
			}
			if err := addon_providers.Plans(c.Args()[0]); err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.AddonsPlansAutoComplete(c)
		},
	}
)
View Source
var (
	AppsCommand = cli.Command{
		Name:        "apps",
		Category:    "Global",
		Description: "List your apps and give some details about them",
		Usage:       "List your apps",
		Action: func(c *cli.Context) {
			if err := apps.List(); err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "apps")
		},
	}
)
View Source
var (
	CreateCommand = cli.Command{
		Name:        "create",
		Category:    "Global",
		Description: "Create a new app:\n   Example:\n     'scalingo create mynewapp'\n     'scalingo create mynewapp --remote \"staging\"'",
		Flags:       []cli.Flag{cli.StringFlag{Name: "remote", Value: "scalingo", Usage: "Remote to add to your current git repository", EnvVar: ""}},
		Usage:       "Create a new app",
		Action: func(c *cli.Context) {
			if len(c.Args()) != 1 {
				cli.ShowCommandHelp(c, "create")
			} else {
				err := apps.Create(c.Args()[0], c.String("remote"))
				if err != nil {
					errorQuit(err)
				}
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "create")
		},
	}
)
View Source
var (
	DbTunnelCommand = cli.Command{
		Name:     "db-tunnel",
		Category: "App Management",
		Usage:    "Create an encrypted connection to access your database",
		Flags: []cli.Flag{appFlag,
			cli.IntFlag{Name: "port, p", Usage: "Local port to bind", Value: 0, EnvVar: ""},
			cli.StringFlag{Name: "identity, i", Usage: "SSH Private Key", Value: "", EnvVar: ""},
		},
		Description: `Create an SSH-encrypted connection to access your Scalingo database locally.

   This command works for all the database addons provided by Scalingo. MySQL,
   PostgreSQL, MongoDB, Redis or Elasticsearch. This action authenticates you
   thanks to your SSH key (exactly the same as a 'git push' operation).

   The command takes one argument which is, either the name of an environment
   variable of your app, or its value containing the connection URL to your
   database.

   Example
     $ scalingo -a my-app db-tunnel SCALINGO_MONGO_URL
     $ scalingo -a my-app db-tunnel mongodb://user:pass@host:port/db

   Once the tunnel is built, the port which has been allocated will be
   displayed, example: "localhost:58000". You can choose this port
   manually with the '-p' option.

   Example
     $ scalingo -a my-app db-tunnel -p 20000 MONGO_URL
     Building tunnel to my-app-1.mongo.dbs.scalingo.com:12345
     You can access your database on '127.0.0.1:20000'

     $ mongo -u <user> -p <pass> 127.0.0.1:20000/my-app-1
     >

   We are looking if an SSH-agent is running on your host, otherwise we are
   using the SSH key '$HOME/.ssh/id_rsa'. You can specify a precise SSH key
   you want to use to authenticate thanks to the '-i' flag.

   Example
     $ scalingo -a rails-app db-tunnel -i ~/.ssh/custom_key DATABASE_URL`,
		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			var sshIdentity string
			if c.String("identity") == "" && os.Getenv("SSH_AUTH_SOCK") != "" {
				sshIdentity = "ssh-agent"
			} else if c.String("identity") == "" {
				sshIdentity = sshkeys.DefaultKeyPath
			} else {
				sshIdentity = c.String("identity")
			}
			if len(c.Args()) != 1 {
				cli.ShowCommandHelp(c, "db-tunnel")
			} else if err := db.Tunnel(currentApp, c.Args()[0], sshIdentity, c.Int("port")); err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "db-tunnel")
			autocomplete.DbTunnelAutoComplete(c)
		},
	}
)
View Source
var (
	DestroyCommand = cli.Command{
		Name:        "destroy",
		Category:    "Global",
		Flags:       []cli.Flag{appFlag},
		Usage:       "Destroy an app /!\\",
		Description: "Destroy an app /!\\ It is not reversible\n  Example:\n    'scalingo destroy my-app'",
		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			if len(c.Args()) != 0 {
				cli.ShowCommandHelp(c, "destroy")
			} else {
				err := apps.Destroy(currentApp)
				if err != nil {
					errorQuit(err)
				}
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "destroy")
		},
	}
)
View Source
var (
	HelpCommand = cli.Command{
		Name:  "help",
		Usage: "Shows a list of commands or help for one command",
		Action: func(c *cli.Context) {
			args := c.Args()
			if args.Present() {
				cli.ShowCommandHelp(c, args.First())
			} else {
				cli.ShowAppHelp(c)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "help")
			autocomplete.HelpAutoComplete(c)
		},
	}
)
View Source
var (
	LoginCommand = cli.Command{
		Name:     "login",
		Category: "Global",
		Usage:    "Login to Scalingo platform",
		Description: `
   Example
     'scalingo login'`,
		Action: func(c *cli.Context) {
			err := session.Login()
			if err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "login")
		},
	}
)
View Source
var (
	LogoutCommand = cli.Command{
		Name:        "logout",
		Category:    "Global",
		Usage:       "Logout from Scalingo",
		Description: "Destroy login information stored on your computer",
		Action: func(c *cli.Context) {
			if err := session.DestroyToken(); err != nil {
				panic(err)
			}
			fmt.Println("Scalingo credentials have been deleted.")
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "logout")
		},
	}
)
View Source
var (
	LogsCommand = cli.Command{
		Name:     "logs",
		Category: "App Management",
		Usage:    "Get the logs of your applications",
		Description: `Get the logs of your applications
   Example:
     Get 100 lines:          'scalingo --app my-app logs -n 100'
     Real-Time logs:         'scalingo --app my-app logs -f'
     Get lines with filter:
       'scalingo --app my-app logs -F web'
       'scalingo --app my-app logs -F web-1'
       'scalingo --app my-app logs --follow -F "worker|clock"'`,
		Flags: []cli.Flag{appFlag,
			cli.IntFlag{Name: "lines, n", Value: 20, Usage: "Number of log lines to dump", EnvVar: ""},
			cli.BoolFlag{Name: "follow, f", Usage: "Stream logs of app, (as \"tail -f\")", EnvVar: ""},
			cli.StringFlag{Name: "filter, F", Usage: "Filter containers logs that will be displayed", EnvVar: ""},
		},
		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			if len(c.Args()) == 0 {
				if err := apps.Logs(currentApp, c.Bool("f"), c.Int("n"), c.String("F")); err != nil {
					errorQuit(err)
				}
			} else {
				cli.ShowCommandHelp(c, "logs")
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "logs")
		},
	}
)
View Source
var (
	MongoConsoleCommand = cli.Command{
		Name:     "mongo-console",
		Category: "Databases",
		Usage:    "Run an interactive console with your MongoDB addon",
		Flags:    []cli.Flag{appFlag},
		Description: ` Run an interactive console with your MongoDB addon.
    $ scalingo -a myapp mongo-console

    # See also 'redis-console' and 'mysql-console'
`,
		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			if len(c.Args()) != 0 {
				cli.ShowCommandHelp(c, "mongo-console")
			} else if err := db.MongoConsole(currentApp); err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "mongo-console")
		},
	}
)
View Source
var (
	MySQLConsoleCommand = cli.Command{
		Name:     "mysql-console",
		Category: "Databases",
		Usage:    "Run an interactive console with your MySQL addon",
		Flags:    []cli.Flag{appFlag},
		Description: ` Run an interactive console with your MySQL addon.
    $ scalingo -a myapp mysql-console

    # See also 'mongo-console' and 'pgsql-console'
`,
		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			if len(c.Args()) != 0 {
				cli.ShowCommandHelp(c, "redis-console")
			} else if err := db.MySQLConsole(currentApp); err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "mysql-console")
		},
	}
)
View Source
var (
	PgSQLConsoleCommand = cli.Command{
		Name:     "pgsql-console",
		Category: "Databases",
		Usage:    "Run an interactive console with your PostgreSQL addon",
		Flags:    []cli.Flag{appFlag},
		Description: ` Run an interactive console with your PostgreSQL addon.
    $ scalingo -a myapp pgsql-console

    # See also 'mongo-console' and 'mysql-console'
`,
		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			if len(c.Args()) != 0 {
				cli.ShowCommandHelp(c, "pgsql-console")
			} else if err := db.PgSQLConsole(currentApp); err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "pgsql-console")
		},
	}
)
View Source
var (
	PsCommand = cli.Command{
		Name:     "ps",
		Category: "App Management",
		Usage:    "Display your application running processes",
		Flags:    []cli.Flag{appFlag},
		Description: `Display your application processes
	Example
	  'scalingo --app my-app ps'`,
		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			if len(c.Args()) != 0 {
				cli.ShowCommandHelp(c, "ps")
			} else if err := apps.Ps(currentApp); err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "ps")
		},
	}
)
View Source
var (
	RedisConsoleCommand = cli.Command{
		Name:     "redis-console",
		Category: "Databases",
		Usage:    "Run an interactive console with your redis addon",
		Flags:    []cli.Flag{appFlag},
		Description: ` Run an interactive console with your redis addon.
    $ scalingo -a myapp redis-console

    # See also 'mongo-console' and 'mysql-console'
`,
		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			if len(c.Args()) != 0 {
				cli.ShowCommandHelp(c, "redis-console")
			} else if err := db.RedisConsole(currentApp); err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "redis-console")
		},
	}
)
View Source
var (
	RestartCommand = cli.Command{
		Name:     "restart",
		Category: "App Management",
		Usage:    "Restart processes of your app",
		Flags:    []cli.Flag{appFlag, cli.BoolFlag{Name: "synchronous", Usage: "Do the restart synchronously", EnvVar: ""}},
		Description: `Restart one or several process or your application:
	Example
	  ## Restart all the processes
	  scalingo --app my-app restart
		## Restart all the web processes
	  scalingo --app my-app restart web
		## Restart a specific container
	  scalingo --app my-app restart web-1`,
		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			if err := apps.Restart(currentApp, c.Bool("synchronous"), c.Args()); err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "restart")
		},
	}
)
View Source
var (
	ScaleCommand = cli.Command{
		Name:     "scale",
		Category: "App Management",
		Flags:    []cli.Flag{appFlag, cli.BoolFlag{Name: "synchronous", Usage: "Do the scaling synchronously", EnvVar: ""}},
		Usage:    "Scale your application instantly",
		Description: `Scale your application processes.
   Example
     'scalingo --app my-app scale web:2 worker:1'
     'scalingo --app my-app scale web:1 worker:0'
     'scalingo --app my-app scale web:1:XL'`,
		Action: func(c *cli.Context) {
			currentApp := appdetect.CurrentApp(c)
			if len(c.Args()) == 0 {
				cli.ShowCommandHelp(c, "scale")
			} else if err := apps.Scale(currentApp, c.Bool("synchronous"), c.Args()); err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "scale")
			autocomplete.ScaleAutoComplete(c)
		},
	}
)
View Source
var (
	SignUpCommand = cli.Command{
		Name:     "signup",
		Category: "Global",
		Usage:    "Create your Scalingo account",
		Description: `
   Example
     'scalingo signup'`,
		Action: func(c *cli.Context) {
			err := session.SignUp()
			if err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "signup")
		},
	}
)
View Source
var (
	UpdateCommand = cli.Command{
		Name:     "update",
		Category: "CLI Internals",
		Usage:    "Update 'scalingo' client",
		Description: `Update 'scalingo' client
   Example
     'scalingo update'`,
		Action: func(c *cli.Context) {
			err := update.Check()
			if err != nil {
				errorQuit(err)
			}
		},
		BashComplete: func(c *cli.Context) {
			autocomplete.CmdFlagsAutoComplete(c, "update")
		},
	}
)

Functions

This section is empty.

Types

type ReportError added in v1.1.0

type ReportError struct {
	Time          time.Time
	User          *users.User
	Error         error
	Command       string
	Version       string
	System        Sysinfo
	FailedRequest *http.Request
}

func (*ReportError) Report added in v1.1.0

func (r *ReportError) Report()

type Sysinfo added in v1.1.0

type Sysinfo struct {
	OS        string
	Arch      string
	Username  string
	GoVersion string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL