|
1 | 1 | stackdio-python-client |
2 | 2 | ====================== |
3 | 3 |
|
4 | | -The canonical Python client for the stackd.io API |
| 4 | +The canonical Python client and cli for the stackd.io API |
| 5 | + |
| 6 | + |
| 7 | +## Overview |
| 8 | +This is a small set of tools for internal use of stackd.io. After cloning |
| 9 | +this repo, you should be able to quickly get up and running with your own |
| 10 | +stacks. |
| 11 | + |
| 12 | +Advanced usage like creating custom blueprints or writing your own formulas is |
| 13 | +beyond the scope of this. |
| 14 | + |
| 15 | +## Installation |
| 16 | +We recommend using virtualenv via [virtualenvwrapper] to install this in a |
| 17 | +virtualenv. If you consider yourself a knowledgeable Pythonista, feel free to |
| 18 | +install this however you'd like, but this document will assume that you are |
| 19 | +using virtualenvwrapper. See the full [virtualenvwrapper] docs for details, |
| 20 | +but in short you can install it on most systems like: |
| 21 | + |
| 22 | + pip install virtualenvwrapper |
| 23 | + |
| 24 | +Once you've got it, installing this tool goes something like: |
| 25 | + |
| 26 | + mkvirtualenv stackdio-client |
| 27 | + |
| 28 | + # assuming you are in whatever dir you cloned this repo to: |
| 29 | + pip install . |
| 30 | + |
| 31 | +You'll see a few things scrolling by, but should be set after this. To use |
| 32 | +this later, you'll need to re-activate the virtualenv like: |
| 33 | + |
| 34 | + workon stackdio-client |
| 35 | + |
| 36 | +Whenever it's activated, `stackdio-cli` should be on your path. |
| 37 | + |
| 38 | +## First Use |
| 39 | +The first time that you fire up `stackdio-cli`, you'll need to run the |
| 40 | +`initial_setup` command. This will prompt you for your LDAP username and |
| 41 | +password, and store them securely in your OS keychain for later use. It will |
| 42 | +import some standard formula, and create a few commonly used blueprints. |
| 43 | + |
| 44 | + $ stackdio-cli |
| 45 | + None @ None |
| 46 | + > initial_setup |
| 47 | + # YOU WILL BE WALKED THROUGH A SIMPLE SET OF QUESTIONS |
| 48 | + |
| 49 | +## Stack Operations |
| 50 | +All of the following assume that you have run `initial_setup` successfully. To |
| 51 | +launch the cli, simply type: |
| 52 | + |
| 53 | + $ stackdio-cli |
| 54 | + |
| 55 | +You can run `help` at any point to see available commands. For details on a |
| 56 | +specific command you can run `help COMMAND`, e.g. `help stacks`. The rest of |
| 57 | +these commands assume you have the cli running. |
| 58 | + |
| 59 | +### Launching Stacks |
| 60 | +Stacks are launched from blueprints. To launch the 3 node HBase stack that's |
| 61 | +included with this you do: |
| 62 | + |
| 63 | + > stacks launch cdh450-ipa-3 MYSTACKNAME |
| 64 | + |
| 65 | +**NOTE:** To avoid DNS namespace collisions, the stack name needs to be unique. |
| 66 | +An easy way to ensure this is to include your name in the stack name. |
| 67 | + |
| 68 | +### Deleting Stacks |
| 69 | +When you are done with a stack you can delete it. This is destructive and |
| 70 | +cannot be recovered from, so think carefully before deleting your stack! |
| 71 | + |
| 72 | + > stacks delete STACK_NAME |
| 73 | + |
| 74 | +Alternatively you can `terminate` a stack which will terminate all instances, |
| 75 | +but leave the stack definition in place. |
| 76 | + |
| 77 | +### Provisioning Stacks |
| 78 | +Occassionally something will go wrong when launching your stack, e.g. network |
| 79 | +connections may flake out causing some package installations to fail. If this |
| 80 | +happens you can manually provision your stack, causing everything to be brought |
| 81 | +back up to date: |
| 82 | + |
| 83 | + > stacks provision STACK_NAME |
| 84 | + |
| 85 | +### Stack Info |
| 86 | +Once you have launched a stack, you can then monitor the status of it like: |
| 87 | + |
| 88 | + > stacks history STACK_NAME |
| 89 | + |
| 90 | +This displays the top level information for a stack. You can supply additional |
| 91 | +arguments to pull back additional info about a stack. For example, to get a |
| 92 | +list of FQDNs (aka hostnames) for a stack: |
| 93 | + |
| 94 | + > stacks hostnames STACK_NAME |
| 95 | + |
| 96 | +There are various logs available that you can access with the `stacks logs` |
| 97 | +command. |
| 98 | + |
| 99 | +## What's Next? |
| 100 | +For anything not covered by this tool, you'll need to use the stackdio-server web UI or |
| 101 | +API directly. For more information on that, check out http://docs.stackd.io. |
| 102 | + |
| 103 | +[virtualenvwrapper]: https://pypi.python.org/pypi/virtualenvwrapper |
0 commit comments