-
Notifications
You must be signed in to change notification settings - Fork 323
Sky
The "sky" command is a management gateway into the skynet cluster. It will allow you to probe the network and look for services/versions, hosts, regions etc in your cluster, as well as run administration commands to operate on instances that match the criteria.
The sky command is targeted towards the system administrator who needs to write shell scripts to interact with the cluster. The premise is that it will except any of the listed commands and will default to the whole cluster, and you can supply flags to filter down your command to target a subset of the cluster. Each command lists the command line flags it accepts.
Usage: sky [options] command <arguments> Commands: cli: Interactive shell for executing commands against skynet cluster hosts: List all hosts available that meet the specified criteria -service - limit results to hosts running the specified service -version - limit results to hosts running the specified version of the service (-service required) -region - limit results to hosts in the specified region instances: List all instances available that meet the specified criteria -service - limit results to instances of the specified service -version - limit results to instances of the specified version of service -region - limit results to instances in the specified region -host - limit results to instances on the specified host -port - limit results to instances on the specified port -registered - (true, false) limit results to instances that are registered (accepting requests) regions: List all regions available that meet the specified criteria services: List all services available that meet the specified criteria -host - limit results to the specified host -port - limit results to the specified port -region - limit results to hosts in the specified region -region - limit results to hosts in the specified region versions: List all services available that meet the specified criteria -service - service name (required) -host - limit results to the specified host -port - limit results to the specified port -region - limit results to hosts in the specified region topology: Print detailed heirarchy of regions/hosts/services/versions/instances -service - limit results to instances of the specified service -version - limit results to instances of the specified version of service -region - limit results to instances in the specified region -host - limit results to instances on the specified host -port - limit results to the specified port deploy: deploy new instances to cluster (deploy <service path> <args>) -region - deploy only to the specified region -host - deploy to the specified host stop: Stop all instances available that meet the specified criteria -service - limit command to instances of the specified service -version - limit command to instances of the specified version of service -region - limit command to instances in the specified region -host - limit command to instances on the specified host -port - limit command to instances on the specified port -registered - (true, false) limit command to instances that are registered (accepting requests) register: Register all instances available that meet the specified criteria -service - limit command to instances of the specified service -version - limit command to instances of the specified version of service -region - limit command to instances in the specified region -host - limit command to instances on the specified host -port - limit command to instances on the specified port -registered - (true, false) limit command to instances that are registered (accepting requests) unregister: Unregister all instances available that meet the specified criteria -service - limit command to instances of the specified service -version - limit command to instances of the specified version of service -region - limit command to instances in the specified region -host - limit command to instances on the specified host -port - limit command to instances on the specified port -registered - (true, false) limit command to instances that are registered (accepting requests)
sky services
sky --service=MyService hosts
sky --service=MyService --version=1 stop
sky --service=MyService --version=1 --region=Tampa unregister
sky --region=Tampa deploy github.com/bketelsen/skynet/examples/service
Another option is to use the interactive shell "sky cli". Which will open a shell you can interact with. With history, and tab completion of commands, as well as hosts, regions, services, and versions already known to the skynet cluster.
The sky command allows you to set filters, which will apply to any future commands you run, until the filter is changed or reset. If you ever feel like you're not getting the correct results back, check your filters.
> filters Region: Tampa Host: Service: MyService Version: Registered:
You can reset all your filters by typing the command
> reset
or a specific filter
> reset region
One thing to keep in mind, if you try to run something along the lines of deploy, and it prompts with 0 instances, you might want to check things like your service and version filters, as it finds hosts that are already running these things.
> host 192.168.126.101 Host: 192.168.126.101 > deploy github.com/bketelsen/skynet/examples/service Service will be deployed to 1 hosts, Are you sure? (Y/N) > y skynet: 2012/09/13 10:25:06 {"*skynet.ClientConfig":{"IdleConnectionsToInstance":1,"MaxConnectionsToInstance":1,"IdleTimeout":0},"Time":"2012-09-13T10:25:06.667416-04:00"} skynet: 2012/09/13 10:25:06 Connected to doozer at 192.168.126.101:8046 deploying github.com/bketelsen/skynet/examples/service skynet: 2012/09/13 10:25:06 Discovered new doozer AQG6QMA7PTE2CV3G at 192.168.126.101:8046 skynet: 2012/09/13 10:25:06 Discovered service "SkynetDaemon" at 192.168.126.101:9000 Deployed service with UUID 47e39d63-6595-4a22-bc1d-84c145d77a34. >
[cli] Skynet Interactive Shell > help Commands: deploy: Deploy new instances to cluster, will deploy to all hosts matching current filters (deploy ) hosts: List all hosts available that meet the specified criteria instances: List all instances available that meet the specified criteria regions: List all regions available that meet the specified criteria register: Registers all instances that match the current filters unregister: Unregisters all instances that match the current filters stop: Stops all instances that match the current filters services: List all services available that meet the specified criteria versions: List all services available that meet the specified criteria topology: Print detailed heirarchy of regions/hosts/services/versions/instances Filters: filters - list current filters reset - reset all filters or specified filter region - Set region filter, all commands will be scoped to this region until reset service - Set service filter, all commands will be scoped to this service until reset version - Set version filter, all commands will be scoped to this version until reset host - Set host filter, all commands will be scoped to this host until reset port - Set port filter, all commands will be scoped to this port until reset >