Merge pull request #5 from Mirantis/doc-update

Update documentation
This commit is contained in:
Łukasz Oleś 2015-07-06 13:11:08 +02:00
commit dd964dcfb5
2 changed files with 48 additions and 31 deletions

View File

@ -1,55 +1,53 @@
# Setup development env
* Install virtualbox
* Install vagrant
* Setup environment
* Install vagrant
* Setup environment:
```
$ cd solar
$ vagrant up
cd solar
vagrant up
```
* Login into vm, the code is available in /vagrant directory
```
$ vagrant ssh
$ solar --help
vagrant ssh
solar --help
```
* Launch standard deployment:
```
python example.py
```
## Solar usage
* discover nodes, with standard file based discovery
* To clear all resources/connections:
```
solar discover
solar resource clear_all
solar connections clear_all
```
* create profile (global config)
* Some very simple cluster setup:
```
solar profile --create --id prf1 --tags env/test_env
cd /vagrant
```
* assign nodes to profile with tags
solar resource create node1 resources/ro_node/ '{"ip":"10.0.0.3", "ssh_key" : "/vagrant/.vagrant/machines/solar-dev1/virtualbox/private_key", "ssh_user":"vagrant"}'
solar resource create mariadb_service resources/mariadb_service '{"image": "mariadb", "root_password": "mariadb", "port": 3306}'
solar connect node1 mariadb_service
* edit nodes files, in the future we want to provide
some cli in order to change the data
```
vim tmp/storage/nodes-id.yaml
solar changes stage
solar changes commit
```
* add `env/test_env` in tags list
* assign resources to nodes
* Show the connections/graph:
```
# TODO Does not work without default values in golden templates
solar assign -n "env/test_env && node/1" -r resource/mariadb
solar connections show
solar connections graph
```
# Low level API
## HAProxy deployment
## HAProxy deployment (not maintained)
```
cd /vagrant

View File

@ -23,6 +23,7 @@ import networkx as nx
import os
import pprint
import subprocess
import sys
import yaml
from solar import utils
@ -128,6 +129,14 @@ def init_changes():
def changes():
pass
@changes.command()
def validate():
errors = vr.validate_resources()
if errors:
for r, error in errors:
print 'ERROR: %s: %s' % (r.name, error)
sys.exit(1)
@changes.command()
def stage():
log = operations.stage_changes()
@ -191,6 +200,11 @@ def init_cli_connections():
def connections():
pass
@connections.command()
def clear_all():
click.echo('Clearing all connections')
signals.Connections.clear()
@connections.command()
def show():
def format_resource_input(resource_name, resource_input_name):
@ -256,15 +270,20 @@ def init_cli_resource():
pass
@resource.command()
@click.argument('resource_path')
@click.argument('resource_name')
@click.argument('action_name')
def action(action_name, resource_path):
def action(action_name, resource_name):
click.echo(
'action {} for resource {}'.format(action_name, resource_path)
'action {} for resource {}'.format(action_name, resource_name)
)
r = sresource.load(resource_path)
r = sresource.load(resource_name)
actions.resource_action(r, action_name)
@resource.command()
def clear_all():
click.echo('Clearing all resources')
db.clear()
@resource.command()
@click.argument('name')
@click.argument('base_path')