Code Monkey home page Code Monkey logo

sgcli's Introduction

ServerGrove Control Panel Command Line Interface (CLI)

The utility allows interaction with the ServerGrove Control Panel through the command line. It also provides an interactive shell.

The following command line tools are provided:

  • API client Command Line Interface
  • Interactive Shell

The API client CLI allows to connect to the ServerGrove Control Panel through a HTTP API. To connect to the API you will need to be a registered customer with access to the Control Panel and API, and you will need to enable API access in the user profile.

Installation:

You will need PHP 5.3

Download sgcli.phar executable and place it in a directory in your PATH.

Make sure sgcli.phar has executable permissions or use with php sgcli.phar

Configuration:

By default, the API client will use our demo API secret/key combination. This only lets you runs some tests against the server but it won't allow you to access your account and servers.

You will need to enable API access in your user profile in https://control.servergrove.com/profile

Once you have the API key and secret, add it to your environment variables:

Example:
	$ export SG_API_KEY=yourkey
	$ export SG_API_SECRET=yoursecret
  • For *nix add these two lines to your user's ~/.profile

Usage:

./sgcli.phar client call [args]
  • call: call composed of namespace and action (ie. server/list)
  • args: (optional) list of variables to send to the call (ie. serverId=abc123&isActive=0)

Example:

./sgcli.phar client test/version
./sgcli.phar client server/list
./sgcli.phar client server/stop serverId=abc123

Interactive shell:

./sgcli.phar shell

Commands:

  • help/h/? - list commands
  • servers - list servers
  • server [option] - selects a server from the servers list. option can be an numeric option from the list or a server name. A partial name can also be provided and it will select the first match
  • exec cmd - executes a command in the selected server
  • reboot [server] - reboots a server. [server] is optional. If not given it will use the selected server. It will ask for confirmation before proceding
  • shutdown [server] - shuts down a server. [server] is optional. If not given it will use the selected server. It will ask for confirmation before proceding
  • bootup [server] - boots up a server. [server] is optional. If not given it will use the selected server
  • domains - list domains under selected server
  • domain [option] - selects a domain from the domains list. option can be an numeric option from the list or a domain name. A partial name can also be provided and it will select the first match
  • apps - list apps under selected server
  • app [option] - selects a app from the apps list. option can be an numeric option from the list or a app name. A partial name can also be provided and it will select the first match
  • restart [app] - restarts an application. [app] is optional. If not given it will use the selected app. It will ask for confirmation before proceding
  • stop [app] - restarts an application. [app] is optional. If not given it will use the selected app. It will ask for confirmation before proceding
  • start [app] - restarts an application. [app] is optional. If not given it will use the selected app
  • . - runs the last command again
  • x - resets internal selections
  • exit/quit - exits shell

WARNING

Notice: The API is still under heavy development, so things MAY change. Please be aware of this.

More information:

TODO & Contributions

We have a bunch of features we want to add. If you have any cool ideas feel free to send us suggestions or even Pull Requests. This is a Github project, so anybody can fork it and extend it!

We love PRs!

Credits

  • Fabien Potencier for the awesome Symfony Components.
  • The Composer team for inspiration on the Application code and the phar file compiler.

sgcli's People

Contributors

pgodel avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.