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-add' `, 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 collaborators 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 ( DeploymentCacheResetCommand = cli.Command{ Name: "deployment-delete-cache", Category: "Deployment", Usage: "Reset deployment cache", Flags: []cli.Flag{appFlag}, Description: ` Delete the deployment cache (in case of corruption mostly) $ scalingo -a myapp deployment-delete-cache `, Action: func(c *cli.Context) { if len(c.Args()) != 0 { cli.ShowCommandHelp(c, "deployment-delete-cache") } else { currentApp := appdetect.CurrentApp(c) err := deployments.ResetCache(currentApp) if err != nil { errorQuit(err) } io.Status(fmt.Sprintf("Deployment cache successfully deleted")) } }, } DeploymentsListCommand = cli.Command{ Name: "deployments", Category: "Deployment", Usage: "List app deployments", Flags: []cli.Flag{appFlag}, Description: ` List all of your previous app deployments $ scalingo -a myapp deployments `, Action: func(c *cli.Context) { currentApp := appdetect.CurrentApp(c) err := deployments.List(currentApp) if err != nil { errorQuit(err) } }, } DeploymentLogCommand = cli.Command{ Name: "deployment-logs", Category: "Deployment", Usage: "View deployment logs", Flags: []cli.Flag{appFlag}, Description: ` Get the logs of an app deployment $ scalingo -a myapp deployment-logs my-deployment `, Action: func(c *cli.Context) { currentApp := appdetect.CurrentApp(c) if len(c.Args()) == 1 { err := deployments.Logs(currentApp, c.Args()[0]) if err != nil { errorQuit(err) } } else { cli.ShowCommandHelp(c, "deployment-logs") } }, BashComplete: func(c *cli.Context) { autocomplete.DeploymentsAutoComplete(c) }, } DeploymentFollowCommand = cli.Command{ Name: "deployment-follow", Category: "Deployment", Usage: "Follow deployment event stream", Flags: []cli.Flag{appFlag}, Description: ` Get real-time deployment informations $ scalingo -a myapp deployment-follow `, Action: func(c *cli.Context) { currentApp := appdetect.CurrentApp(c) err := deployments.Stream(&deployments.StreamOpts{ AppName: currentApp, }) if err != nil { errorQuit(err) } }, } DeploymentDeployCommand = cli.Command{ Name: "deploy", Category: "Deployment", Usage: "Trigger a deployment by archive", Flags: []cli.Flag{appFlag, cli.BoolFlag{Name: "war, w", Usage: "Specify that you want to deploy a WAR file"}, }, Description: ` Trigger the deployment of a custom archive for your application $ scalingo -a myapp deploy archive.tar.gz or $ scalingo -a myapp deploy http://example.com/archive.tar.gz # See also commands 'deployments' `, Action: func(c *cli.Context) { args := c.Args() if len(args) != 1 && len(args) != 2 { cli.ShowCommandHelp(c, "deploy") return } archivePath := args[0] gitRef := "" if len(args) == 2 { gitRef = args[1] } currentApp := appdetect.CurrentApp(c) if c.Bool("war") || strings.HasSuffix(archivePath, ".war") { io.Status(fmt.Sprintf("Deploying WAR archive: %s", archivePath)) err := deployments.DeployWar(currentApp, archivePath, gitRef) if err != nil { errorQuit(err) } } else { io.Status(fmt.Sprintf("Deploying tarball archive: %s", archivePath)) err := deployments.Deploy(currentApp, archivePath, gitRef) if err != nil { errorQuit(err) } } }, BashComplete: func(c *cli.Context) { autocomplete.CmdFlagsAutoComplete(c, "deploy") }, } )
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 --app my-app 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 ( NotifiersListCommand = cli.Command{ Name: "notifiers", Category: "Notifiers", Usage: "List your notifiers", Flags: []cli.Flag{appFlag}, Description: ` List all notifiers of your app: $ scalingo -a myapp notifiers # See also 'notifiers-add' and 'notifiers-remove' `, Action: func(c *cli.Context) { currentApp := appdetect.CurrentApp(c) var err error if len(c.Args()) == 0 { err = notifiers.List(currentApp) } else { cli.ShowCommandHelp(c, "notifiers") } if err != nil { errorQuit(err) } }, BashComplete: func(c *cli.Context) { autocomplete.CmdFlagsAutoComplete(c, "notifiers") }, } NotifiersDetailsCommand = cli.Command{ Name: "notifiers-details", Category: "Notifiers", Usage: "Show details of your notifiers", Flags: []cli.Flag{appFlag}, Description: ` Show details of your notifiers: $ scalingo -a myapp notifiers-details <ID> # See also 'notifiers' `, Action: func(c *cli.Context) { currentApp := appdetect.CurrentApp(c) var err error if len(c.Args()) == 1 { err = notifiers.Details(currentApp, c.Args()[0]) } else { cli.ShowCommandHelp(c, "notifiers-details") } if err != nil { errorQuit(err) } }, BashComplete: func(c *cli.Context) { autocomplete.CmdFlagsAutoComplete(c, "notifiers-details") autocomplete.NotifiersAutoComplete(c) }, } NotifiersAddCommand = cli.Command{ Name: "notifiers-add", Category: "Notifiers", Flags: []cli.Flag{ appFlag, cli.BoolFlag{Name: "enable, e", Usage: "Enable the notifier (default)"}, cli.BoolFlag{Name: "disable, d", Usage: "Disable the notifier"}, cli.StringFlag{Name: "platform, p", Value: "", Usage: "The notifier platform"}, cli.StringFlag{Name: "name, n", Value: "", Usage: "Name of the notifier"}, cli.BoolFlag{Name: "send-all-events, sa", Usage: "If true the notifier will send all events. Default: false"}, cli.StringFlag{Name: "webhook-url, u", Value: "", Usage: "The webhook url to send notification (if applicable)"}, cli.StringFlag{Name: "phone", Value: "", Usage: "The phone number to send notifications (if applicable)"}, cli.StringSliceFlag{Name: "event, ev", Value: &cli.StringSlice{}, Usage: "List of selected events. Default: []"}, cli.StringSliceFlag{Name: "email", Value: &cli.StringSlice{}, Usage: "The emails (multiple option accepted) to send notifications (if applicable)"}, cli.StringSliceFlag{Name: "collaborator", Value: &cli.StringSlice{}, Usage: "The usernames of the collaborators who will receive notifications"}, }, Usage: "Add a notifier for your application", Description: `Add a notifier for your application: Examples $ scalingo -a myapp notifiers-add \ --platform slack \ --name "My notifier" \ --webhook-url "https://hooks.slack.com/services/1234" \ --event deployment --event stop_app $ scalingo -a myapp notifiers-add \ --platform webhook \ --name "My notifier" \ --webhook-url "https://custom-webhook.com" \ --send-all-events true # Use 'platforms-list' to see all available platforms # See also 'notifiers' and 'notifiers-remove' `, Action: func(c *cli.Context) { currentApp := appdetect.CurrentApp(c) if c.String("platform") == "" { cli.ShowCommandHelp(c, "notifiers-add") } var active bool if c.IsSet("disable") { active = false } else { active = true } sendAllEvents := c.Bool("send-all-events") params := notifiers.ProvisionParams{ CollaboratorUsernames: c.StringSlice("collaborator"), SelectedEventNames: c.StringSlice("event"), NotifierParams: scalingo.NotifierParams{ Active: &active, Name: c.String("name"), SendAllEvents: &sendAllEvents, PhoneNumber: c.String("phone"), Emails: c.StringSlice("email"), WebhookURL: c.String("webhook-url"), }, } err := notifiers.Provision(currentApp, c.String("platform"), params) if err != nil { errorQuit(err) } }, BashComplete: func(c *cli.Context) { autocomplete.CmdFlagsAutoComplete(c, "notifiers-add") }, } NotifiersUpdateCommand = cli.Command{ Name: "notifiers-update", Category: "Notifiers", Flags: []cli.Flag{ appFlag, cli.BoolFlag{Name: "enable, e", Usage: "Enable the notifier"}, cli.BoolFlag{Name: "disable, d", Usage: "Disable the notifier"}, cli.StringFlag{Name: "name, n", Value: "", Usage: "Name of the notifier"}, cli.BoolFlag{Name: "send-all-events, sa", Usage: "If true the notifier will send all events. Default: false"}, cli.StringFlag{Name: "webhook-url, u", Value: "", Usage: "The webhook url to send notification (if applicable)"}, cli.StringFlag{Name: "phone", Value: "", Usage: "The phone number to send notifications (if applicable)"}, cli.StringFlag{Name: "email", Value: "", Usage: "The email to send notifications (if applicable)"}, cli.StringSliceFlag{Name: "event, ev", Value: &cli.StringSlice{}, Usage: "List of selected events. Default: []"}, }, Usage: "Update a notifier", Description: `Update a notifier: Examples $ scalingo -a myapp notifiers-update --disable <ID> $ scalingo -a myapp notifiers-update \ --name "My notifier" \ --webhook-url https://custom-webhook.com \ --send-all-events true \ <ID> # See also 'notifiers' and 'notifiers-remove' `, Action: func(c *cli.Context) { currentApp := appdetect.CurrentApp(c) var err error var active *bool if c.IsSet("enable") { tmpActive := true active = &tmpActive } else if c.IsSet("disable") { tmpActive := false active = &tmpActive } else { active = nil } var sendAllEvents *bool if c.IsSet("send-all-events") { tmpEvents := c.Bool("send-all-events") sendAllEvents = &tmpEvents } else { sendAllEvents = nil } params := notifiers.ProvisionParams{ CollaboratorUsernames: c.StringSlice("collaborator"), SelectedEventNames: c.StringSlice("event"), NotifierParams: scalingo.NotifierParams{ Active: active, Name: c.String("name"), SendAllEvents: sendAllEvents, PhoneNumber: c.String("phone"), Emails: c.StringSlice("email"), WebhookURL: c.String("webhook-url"), }, } if len(c.Args()) >= 1 { err = notifiers.Update(currentApp, c.Args()[0], params) } else { cli.ShowCommandHelp(c, "notifiers-update") } if err != nil { errorQuit(err) } }, BashComplete: func(c *cli.Context) { autocomplete.CmdFlagsAutoComplete(c, "notifiers-update") autocomplete.NotifiersAutoComplete(c) }, } NotifiersRemoveCommand = cli.Command{ Name: "notifiers-remove", Category: "Notifiers", Flags: []cli.Flag{appFlag}, Usage: "Remove an existing notifier from your app", Description: `Remove an existing notifier from your app: $ scalingo -a myapp notifier-remove <ID> # See also 'notifiers' and 'notifiers-add' `, Action: func(c *cli.Context) { currentApp := appdetect.CurrentApp(c) var err error if len(c.Args()) == 1 { err = notifiers.Destroy(currentApp, c.Args()[0]) } else { cli.ShowCommandHelp(c, "notifiers-remove") } if err != nil { errorQuit(err) } }, BashComplete: func(c *cli.Context) { autocomplete.CmdFlagsAutoComplete(c, "notifiers-remove") autocomplete.NotifiersAutoComplete(c) }, } )
View Source
var ( EnvFlag = cli.StringSlice([]string{}) FilesFlag = cli.StringSlice([]string{}) RunCommand = cli.Command{ Name: "run", ShortName: "r", Category: "App Management", Usage: "Run any command for your app", Flags: []cli.Flag{appFlag, cli.BoolFlag{Name: "detached, d", Usage: "Run a detached container"}, cli.StringFlag{Name: "size, s", Value: "", Usage: "Size of the container"}, cli.StringFlag{Name: "type, t", Value: "", Usage: "Procfile Type"}, cli.StringSliceFlag{Name: "env, e", Value: &EnvFlag, Usage: "Environment variables"}, cli.StringSliceFlag{Name: "file, f", Value: &FilesFlag, Usage: "Files to upload"}, cli.BoolFlag{Name: "silent", Usage: "Do not output anything on stderr"}, }, Description: `Run command in current app context, a one-off container will be start with your application environment loaded. Examples scalingo --app rails-app run bundle exec rails console scalingo --app rails-app run --detached bundle exec rake long:task scalingo --app appname run --size XL bash scalingo --app symfony-app run php app/console cache:clear scalingo --app test-app run --silent custom/command > localoutput The --detached flag let you run a 'detached' one-off container, it means the container will be started and you'll get back your terminal immediately. Its output will be accessible from the logs of the application (command 'logs') You can see if the task is still running with the command 'ps' which will display the list of the running containers. The --size flag makes it easy to specify the size of the container you want to run. Each container size has different price and performance. You can read more about container sizes here: http://doc.scalingo.com/internals/container-sizes.html The --silent flag makes that the only output of the command will be the output of the one-off container. There won't be any noise from the command tool itself. Thank to the --type flag, you can build shortcuts to commands of your Procfile. If your procfile is: ==== Procfile web: bundle exec rails server migrate: bundle rake db:migrate ==== You can run the migrate task with the following command: Example: scalingo --app my-app run -t migrate 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(), Size: c.String("s"), Type: c.String("t"), CmdEnv: c.StringSlice("e"), Files: c.StringSlice("f"), Silent: c.Bool("silent"), Detached: c.Bool("detached"), } if (len(c.Args()) == 0 && c.String("t") == "") || (len(c.Args()) > 0 && c.String("t") != "") { 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-mongodb", Usage: "List plans", Action: func(c *cli.Context) { if len(c.Args()) != 1 { cli.ShowCommandHelp(c, "addons-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 ( ConfigCommand = cli.Command{ Name: "config", Category: "Global", Usage: "Configure the CLI", Flags: []cli.Flag{ cli.StringFlag{Name: "region", Value: "", Usage: "Configure the default region used by the CLI"}, }, Description: ` Example 'scalingo config --region agora-fr1' Can also be configured using the environment variable SCALINGO_REGION=agora-fr1`, Action: func(c *cli.Context) { if c.String("region") != "" { err := config.SetRegion(c.String("region")) if err != nil { errorQuit(err) } } if c.String("region") == "" { config.Display() } }, BashComplete: func(c *cli.Context) { autocomplete.CmdFlagsAutoComplete(c, "config") }, } )
View Source
var ( CreateCommand = cli.Command{ Name: "create", ShortName: "c", 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: ""}, cli.StringFlag{Name: "buildpack", Value: "", Usage: "URL to a custom buildpack that Scalingo should use to build your application", EnvVar: ""}, }, Usage: "Create a new app", Action: func(c *cli.Context) { if len(c.Args()) != 1 { cli.ShowCommandHelp(c, "create") return } err := apps.Create(c.Args()[0], c.String("remote"), c.String("buildpack")) 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 (default 10000)"}, cli.StringFlag{Name: "identity, i", Usage: "SSH Private Key"}, cli.StringFlag{Name: "bind, b", Usage: "IP to bind (default 127.0.0.1)"}, cli.BoolTFlag{Name: "reconnect", Usage: "true by default, automatically reconnect to the tunnel when disconnected"}, }, 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 (default is 10000), example: "localhost:10000". 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") return } opts := db.TunnelOpts{ App: currentApp, DBEnvVar: c.Args()[0], Identity: sshIdentity, Port: c.Int("port"), Bind: c.String("bind"), Reconnect: c.BoolT("reconnect"), } err := db.Tunnel(opts) if 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: "App Management", Flags: []cli.Flag{appFlag}, Usage: "Destroy an app /!\\", Description: "Destroy an app /!\\ It is not reversible\n Example:\n 'scalingo destroy my-app'\n 'scalingo -a my-app destroy'", Action: func(c *cli.Context) { var currentApp string if len(c.Args()) > 1 { cli.ShowCommandHelp(c, "destroy") } else { if len(c.Args()) != 0 { currentApp = c.Args()[0] } else { currentApp = appdetect.CurrentApp(c) } 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()) return } cli.ShowAppHelp(c) }, BashComplete: func(c *cli.Context) { autocomplete.CmdFlagsAutoComplete(c, "help") autocomplete.HelpAutoComplete(c) }, } )
View Source
var ( InfluxDBConsoleCommand = cli.Command{ Name: "influxdb-console", Category: "Databases", Usage: "Run an interactive console with your InfluxDB addon", Flags: []cli.Flag{appFlag, cli.StringFlag{Name: "size, s", Value: "", Usage: "Size of the container"}, }, Description: ` Run an interactive console with your InfluxDB addon. Examples scalingo --app myapp influxdb-console scalingo --app myapp influxdb-console --size L The --size flag makes it easy to specify the size of the container executing the InfluxDB console. Each container size has different price and performance. You can read more about container sizes here: http://doc.scalingo.com/internals/container-sizes.html # See also 'mongo-console' and 'mysql-console' `, Action: func(c *cli.Context) { currentApp := appdetect.CurrentApp(c) opts := db.InfluxDBConsoleOpts{ App: currentApp, Size: c.String("s"), } if len(c.Args()) != 0 { cli.ShowCommandHelp(c, "influxdb-console") } else if err := db.InfluxDBConsole(opts); err != nil { errorQuit(err) } }, BashComplete: func(c *cli.Context) { autocomplete.CmdFlagsAutoComplete(c, "influxdb-console") }, } )
View Source
var ( LoginCommand = cli.Command{ Name: "login", Category: "Global", Flags: []cli.Flag{ cli.StringFlag{Name: "api-token", Usage: "Authenticate with a token instead of login/password or SSH"}, cli.BoolFlag{Name: "ssh", Usage: "Login with you SSH identity instead of login/password"}, cli.StringFlag{Name: "ssh-identity", Value: "ssh-agent", Usage: "Use a custom SSH key, only compatible if --ssh is set"}, cli.BoolFlag{Name: "password-only", Usage: "Login with login/password without testing SSH connection"}, }, Usage: "Login to Scalingo platform", Description: ` Example 'scalingo login'`, Action: func(c *cli.Context) { if c.Bool("ssh") && c.Bool("password-only") { errorQuit(errors.New("You cannot use both --ssh and --password-only at the same time")) } err := session.Login(session.LoginOpts{ APIToken: c.String("api-token"), PasswordOnly: c.Bool("password-only"), SSH: c.Bool("ssh"), SSHIdentity: c.String("ssh-identity"), }) 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) { currentUser, err := config.C.CurrentUser() if err != nil { errorQuit(err) } if currentUser == nil { io.Status("You are already logged out.") return } if err := session.DestroyToken(); err != nil { panic(err) } io.Status("Scalingo credentials have been deleted.") }, BashComplete: func(c *cli.Context) { autocomplete.CmdFlagsAutoComplete(c, "logout") }, } )
View Source
var ( LogsArchivesCommand = cli.Command{ Name: "logs-archives", ShortName: "la", Category: "App Management", Usage: "Get the logs archives of your applications", Description: `Get the logs archives of your applications Example: Get most recents archives: 'scalingo --app my-app logs-archives' Get a specific page: 'scalingo --app my-app logs-archives -p 5'`, Flags: []cli.Flag{appFlag, cli.IntFlag{Name: "page, p", Usage: "Page number", EnvVar: ""}, }, Action: func(c *cli.Context) { currentApp := appdetect.CurrentApp(c) if len(c.Args()) == 0 { if err := apps.LogsArchives(currentApp, c.Int("p")); err != nil { errorQuit(err) } } else { cli.ShowCommandHelp(c, "logs-archives") } }, BashComplete: func(c *cli.Context) { autocomplete.CmdFlagsAutoComplete(c, "logs-archives") }, } )
View Source
var ( LogsCommand = cli.Command{ Name: "logs", ShortName: "l", 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' Addon logs: 'scalingo --app my-app --addon addon_uuid logs' 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, addonFlag, 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 { cli.ShowCommandHelp(c, "logs") return } var addonName string if c.GlobalString("addon") != "<addon_id>" { addonName = c.GlobalString("addon") } else if c.String("addon") != "<addon_id>" { addonName = c.String("addon") } var err error if addonName == "" { err = apps.Logs(currentApp, c.Bool("f"), c.Int("n"), c.String("F")) } else { err = db.Logs(currentApp, addonName, db.LogsOpts{ Follow: c.Bool("f"), Count: c.Int("n"), }) } if err != nil { errorQuit(err) } }, 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, cli.StringFlag{Name: "size, s", Value: "", Usage: "Size of the container"}, }, Description: ` Run an interactive console with your MongoDB addon. Examples scalingo --app myapp mongo-console scalingo --app myapp mongo-console --size L The --size flag makes it easy to specify the size of the container executing the MongoDB console. Each container size has different price and performance. You can read more about container sizes here: http://doc.scalingo.com/internals/container-sizes.html # See also 'redis-console' and 'mysql-console' `, Action: func(c *cli.Context) { currentApp := appdetect.CurrentApp(c) opts := db.MongoConsoleOpts{ App: currentApp, Size: c.String("s"), } if len(c.Args()) != 0 { cli.ShowCommandHelp(c, "mongo-console") } else if err := db.MongoConsole(opts); 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, cli.StringFlag{Name: "size, s", Value: "", Usage: "Size of the container"}, }, Description: ` Run an interactive console with your MySQL addon. Examples scalingo --app myapp mysql-console scalingo --app myapp mysql-console --size L The --size flag makes it easy to specify the size of the container executing the MySQL console. Each container size has different price and performance. You can read more about container sizes here: http://doc.scalingo.com/internals/container-sizes.html # See also 'mongo-console' and 'pgsql-console' `, Action: func(c *cli.Context) { currentApp := appdetect.CurrentApp(c) opts := db.MySQLConsoleOpts{ App: currentApp, Size: c.String("s"), } if len(c.Args()) != 0 { cli.ShowCommandHelp(c, "mysql-console") } else if err := db.MySQLConsole(opts); err != nil { errorQuit(err) } }, BashComplete: func(c *cli.Context) { autocomplete.CmdFlagsAutoComplete(c, "mysql-console") }, } )
View Source
var ( NotificationPlatformListCommand = cli.Command{ Name: "notification-platforms", Category: "Notifiers - Global", Description: "List all notification platforms you can use with a notifier.", Usage: "List all notification platforms", Action: func(c *cli.Context) { err := notification_platforms.List() if err != nil { errorQuit(err) } }, BashComplete: func(c *cli.Context) { autocomplete.CmdFlagsAutoComplete(c, "platforms-list") }, } )
View Source
var ( PgSQLConsoleCommand = cli.Command{ Name: "pgsql-console", Category: "Databases", Usage: "Run an interactive console with your PostgreSQL addon", Flags: []cli.Flag{appFlag, cli.StringFlag{Name: "size, s", Value: "", Usage: "Size of the container"}, }, Description: ` Run an interactive console with your PostgreSQL addon. Examples scalingo --app myapp pgsql-console scalingo --app myapp pgsql-console --size L The --size flag makes it easy to specify the size of the container executing the PostgreSQL console. Each container size has different price and performance. You can read more about container sizes here: http://doc.scalingo.com/internals/container-sizes.html # See also 'mongo-console' and 'mysql-console' `, Action: func(c *cli.Context) { currentApp := appdetect.CurrentApp(c) opts := db.PgSQLConsoleOpts{ App: currentApp, Size: c.String("s"), } if len(c.Args()) != 0 { cli.ShowCommandHelp(c, "pgsql-console") } else if err := db.PgSQLConsole(opts); err != nil { errorQuit(err) } }, BashComplete: func(c *cli.Context) { autocomplete.CmdFlagsAutoComplete(c, "pgsql-console") }, } )
View Source
var ( RedisConsoleCommand = cli.Command{ Name: "redis-console", Category: "Databases", Usage: "Run an interactive console with your Redis addon", Flags: []cli.Flag{appFlag, cli.StringFlag{Name: "size, s", Value: "", Usage: "Size of the container"}, }, Description: ` Run an interactive console with your Redis addon. Examples scalingo --app myapp redis-console scalingo --app myapp redis-console --size L The --size flag makes it easy to specify the size of the container executing the Redis console. Each container size has different price and performance. You can read more about container sizes here: http://doc.scalingo.com/internals/container-sizes.html # See also 'mongo-console' and 'mysql-console' `, Action: func(c *cli.Context) { currentApp := appdetect.CurrentApp(c) opts := db.RedisConsoleOpts{ App: currentApp, Size: c.String("s"), } if len(c.Args()) != 0 { cli.ShowCommandHelp(c, "redis-console") } else if err := db.RedisConsole(opts); err != nil { errorQuit(err) } }, BashComplete: func(c *cli.Context) { autocomplete.CmdFlagsAutoComplete(c, "redis-console") }, } )
View Source
var ( RegionsListCommand = cli.Command{ Name: "regions", Category: "Global", Usage: "List available regions", Description: ` Example 'scalingo regions'`, Action: func(c *cli.Context) { err := regions.List() if err != nil { errorQuit(err) } }, BashComplete: func(c *cli.Context) { autocomplete.CmdFlagsAutoComplete(c, "regions") }, } )
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, s", 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("s"), c.Args()); err != nil { errorQuit(err) } }, BashComplete: func(c *cli.Context) { autocomplete.CmdFlagsAutoComplete(c, "restart") autocomplete.RestartAutoComplete(c) }, } )
View Source
var ( StatsCommand = cli.Command{ Name: "stats", Category: "Display metrics of the running containers", Usage: "Display metrics of the currently running containers", Flags: []cli.Flag{ appFlag, cli.BoolFlag{Name: "stream", Usage: "Stream metrics data"}, }, Description: `Display metrics of you application running containers Example 'scalingo --app my-app stats'`, Action: func(c *cli.Context) { currentApp := appdetect.CurrentApp(c) if len(c.Args()) != 0 { cli.ShowCommandHelp(c, "stats") } else if err := apps.Stats(currentApp, c.Bool("stream")); err != nil { errorQuit(err) } }, BashComplete: func(c *cli.Context) { return }, } )
View Source
var ( TimelineCommand = cli.Command{ Name: "timeline", Category: "Events", Flags: []cli.Flag{ appFlag, cli.IntFlag{Name: "page", Usage: "Page to display", Value: 1}, cli.IntFlag{Name: "per-page", Usage: "Number of events to display", Value: 30}, }, Usage: "List the actions related to a given app", Description: `List the actions done by the owner and collaborators of an app: $ scalingo -a myapp timeline`, Action: func(c *cli.Context) { currentApp := appdetect.CurrentApp(c) var err error if len(c.Args()) == 0 { err = apps.Events(currentApp, scalingo.PaginationOpts{ Page: c.Int("page"), PerPage: c.Int("per-page"), }) } else { cli.ShowCommandHelp(c, "timeline") } if err != nil { errorQuit(err) } }, BashComplete: func(c *cli.Context) { autocomplete.CmdFlagsAutoComplete(c, "timeline") }, } )
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") }, } )
View Source
var ( UserTimelineCommand = cli.Command{ Name: "user-timeline", Category: "Events", Flags: []cli.Flag{ cli.IntFlag{Name: "page", Usage: "Page to display", Value: 1}, cli.IntFlag{Name: "per-page", Usage: "Number of events to display", Value: 30}, }, Usage: "List the events you have done on the platform", Description: `List the events you have done on the platform: $ scalingo user-timeline`, Action: func(c *cli.Context) { var err error if len(c.Args()) == 0 { err = user.Events(scalingo.PaginationOpts{ Page: c.Int("page"), PerPage: c.Int("per-page"), }) } else { cli.ShowCommandHelp(c, "user-timeline") } if err != nil { errorQuit(err) } }, BashComplete: func(c *cli.Context) { autocomplete.CmdFlagsAutoComplete(c, "user-timeline") }, } )
Functions ¶
func ShowSuggestions ¶ added in v1.16.6
Types ¶
type AppCommands ¶ added in v1.16.6
type AppCommands struct {
// contains filtered or unexported fields
}
func NewAppCommands ¶ added in v1.16.6
func NewAppCommands() *AppCommands
func (*AppCommands) Commands ¶ added in v1.16.6
func (cmds *AppCommands) Commands() []cli.Command
Source Files ¶
- addon_providers_list.go
- addons.go
- addons_providers_plans_list.go
- alerts.go
- apps.go
- autoscalers.go
- backups.go
- collaborators.go
- commands.go
- config.go
- create.go
- databases.go
- db_tunnel.go
- deployments.go
- destroy.go
- domains.go
- env.go
- error.go
- flags.go
- git.go
- help.go
- influxdb.go
- integration_link.go
- keys.go
- login.go
- logout.go
- logs-archives.go
- logs.go
- mongo.go
- mysql.go
- notification_platforms.go
- notifiers.go
- pgsql.go
- ps.go
- redis.go
- region_migrations.go
- regions.go
- rename.go
- restart.go
- review_apps.go
- routing_settings.go
- run.go
- scale.go
- scm_integrations.go
- self.go
- stacks.go
- stats.go
- suggestions.go
- timeline.go
- update.go
- user-timeline.go
Click to show internal directories.
Click to hide internal directories.