Skip to content

Commit 4a05e52

Browse files
committed
Merge pull request #20 from clarkperkins/feature/upgrade-to-0.7
Upgrade client to work with server v0.7.0
2 parents 8f811a8 + 0e2735e commit 4a05e52

27 files changed

+2080
-332
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,5 @@ target/
5555

5656
# PyCharm
5757
.idea/
58+
59+
.vagrant/

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include README.md

README.md

Lines changed: 100 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,103 @@
11
stackdio-python-client
22
======================
33

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

Vagrantfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5+
VAGRANTFILE_API_VERSION = "2"
6+
7+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
8+
config.vm.box = "precise64"
9+
10+
config.vm.provision "shell", path: "vbox_setup.sh"
11+
12+
config.vm.synced_folder "~/Workspace/pi/stackdio-blueprints", "/home/vagrant/.stackdio-blueprints", create: true
13+
end

blueprints/.keep

Whitespace-only changes.

bootstrap.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
blueprints: {}
2+
3+
formulas:
4+
java: https://github.com/stackdio-formulas/java-formula.git
5+
cdh5: https://github.com/stackdio-formulas/cdh5-formula.git
6+
elasticsearch: https://github.com/stackdio-formulas/elasticsearch-formula.git

setup.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[bdist_wheel]
2+
# This flag says that the code is written to work on both Python 2 and Python
3+
# 3. If at all possible, it is good practice to do this. If you cannot, you
4+
# will need to generate wheels for each Python version that you support.
5+
universal=1

setup.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# limitations under the License.
1616
#
1717

18+
import os
1819
import sys
1920

2021
from setuptools import setup, find_packages
@@ -42,9 +43,15 @@ def test_python_version():
4243
with open('README.md') as f:
4344
LONG_DESCRIPTION = f.read()
4445

46+
CFG_DIR = os.path.expanduser("~/.stackdio-cli")
47+
4548
requirements = [
46-
'simplejson',
49+
'Jinja2==2.7.3',
50+
'PyYAML==3.11',
51+
'cmd2==0.6.7',
52+
'keyring==3.7',
4753
'requests>=2.4.0,<2.6.0',
54+
'simplejson==3.4.0',
4855
]
4956

5057
if __name__ == "__main__":
@@ -63,9 +70,23 @@ def test_python_version():
6370
license='Apache 2.0',
6471
include_package_data=True,
6572
packages=find_packages(),
73+
data_files=[
74+
(CFG_DIR,
75+
[
76+
'bootstrap.yaml',
77+
]),
78+
(os.path.join(CFG_DIR, "blueprints"),
79+
["blueprints/%s" % f for f in os.listdir("blueprints")]),
80+
],
6681
zip_safe=False,
6782
install_requires=requirements,
6883
dependency_links=[],
84+
entry_points={
85+
'console_scripts': [
86+
'stackdio-cli=stackdio.cli:main',
87+
'blueprint-generator=stackdio.cli.blueprints:main',
88+
],
89+
},
6990
classifiers=[
7091
'Development Status :: 4 - Beta',
7192
'Environment :: Web Environment',
@@ -78,6 +99,11 @@ def test_python_version():
7899
'Programming Language :: Python :: 2',
79100
'Programming Language :: Python :: 2.6',
80101
'Programming Language :: Python :: 2.7',
102+
'Programming Language :: Python :: 3',
103+
'Programming Language :: Python :: 3.2',
104+
'Programming Language :: Python :: 3.3',
105+
'Programming Language :: Python :: 3.4',
106+
'Programming Language :: Python :: 3.5',
81107
'Topic :: System :: Clustering',
82108
'Topic :: System :: Distributed Computing',
83109
]

0 commit comments

Comments
 (0)