Resource management and orchestration engine for distributed systems
Go to file
Łukasz Oleś a86e670233 Merge pull request #69 from xarses/various-fixes
Fixes to example.py and Vagrantfile
2015-06-01 12:45:19 +02:00
docs Docs: commit-log update 2015-05-22 13:52:15 +02:00
examples Fix nodes examples 2015-05-28 15:52:32 +02:00
haproxy_deployment haproxy-deployment.yaml fixes according to new keystone inputs 2015-04-28 11:50:14 +02:00
resources Fix mariadb container name in resource description 2015-06-01 12:44:06 +02:00
solar Merge pull request #68 from xarses/deployment-2 2015-06-01 12:44:52 +02:00
templates Fix connection order in profile 2015-05-28 13:31:11 +02:00
.gitignore Rename keystone resource to keystone_service 2015-04-28 09:57:01 +00:00
ansible.cfg Vagrant fixes 2015-04-21 09:56:20 +02:00
cli.py cli.py: add option to print out resource as JSON 2015-05-29 15:47:37 +02:00
config.yaml Implemented a single storage for resources 2015-05-29 12:01:57 +02:00
docker.yml It's not required to pull specific docker image for development env 2015-04-13 16:55:25 +03:00
Dockerfile Add missed items in Dockerfile and kolla.yml 2015-04-16 16:50:58 -07:00
example.py Fixes to example.py and Vagrantfile 2015-06-01 12:17:12 +02:00
jenkins-config.yaml Renamed clients.json to connections.yaml 2015-05-28 14:14:31 +02:00
kolla.yml Add missed items in Dockerfile and kolla.yml 2015-04-16 16:50:58 -07:00
LICENSE Initial commit 2015-03-27 15:54:19 -07:00
main.yml Update pip before running through requirements 2015-05-29 12:41:29 -07:00
README.md Updated README.md with information from x/README.md 2015-05-28 13:31:11 +02:00
requirements.txt Fixed tests 2015-05-29 13:37:05 +02:00
run_tests.sh Set default for WORKSPACE in run_tests.sh 2015-05-29 13:25:30 +02:00
simple-deployment.yaml Old tests pass now 2015-04-22 13:47:15 +02:00
TODO.md Restore TODO.md 2015-05-28 13:31:11 +02:00
Vagrantfile 2 Vagrant slave machines 2015-06-01 12:31:10 +02:00

Setup development env

  • Install virtualbox
  • Install vagrant
  • Setup environment
$ cd fuel-ng
$ vagrant up
  • Login into vm, the code is available in /vagrant directory
$ vagrant ssh
$ solar --help

Solar usage

  • discover nodes, with standard file based discovery
solar discover
  • create profile (global config)
solar profile --create --id prf1 --tags env/test_env

  • assign nodes to profile with tags

  • edit nodes files, in the future we want to provide some cli in order to change the data

vim tmp/storage/nodes-id.yaml
  • add env/test_env in tags list
  • assign resources to nodes
# TODO Does not work without default values in golden templates
solar assign -n "env/test_env && node/1" -r resource/mariadb

Low level API

HAProxy deployment

cd /vagrant
python cli.py deploy haproxy_deployment/haproxy-deployment.yaml

or from Python shell:

from x import deployment

deployment.deploy('/vagrant/haproxy_deployment/haproxy-deployment.yaml')

Usage:

Creating resources:

from x import resource
node1 = resource.create('node1', 'x/resources/ro_node/', 'rs/', {'ip':'10.0.0.3', 'ssh_key' : '/vagrant/tmp/keys/ssh_private', 'ssh_user':'vagrant'})

node2 = resource.create('node2', 'x/resources/ro_node/', 'rs/', {'ip':'10.0.0.4', 'ssh_key' : '/vagrant/tmp/keys/ssh_private', 'ssh_user':'vagrant'})

keystone_db_data = resource.create('mariadb_keystone_data', 'x/resources/data_container/', 'rs/', {'image' : 'mariadb', 'export_volumes' : ['/var/lib/mysql'], 'ip': '', 'ssh_user': '', 'ssh_key': ''}, connections={'ip' : 'node2.ip', 'ssh_key':'node2.ssh_key', 'ssh_user':'node2.ssh_user'})

nova_db_data = resource.create('mariadb_nova_data', 'x/resources/data_container/', 'rs/', {'image' : 'mariadb', 'export_volumes' : ['/var/lib/mysql'], 'ip': '', 'ssh_user': '', 'ssh_key': ''}, connections={'ip' : 'node1.ip', 'ssh_key':'node1.ssh_key', 'ssh_user':'node1.ssh_user'})

to make connection after resource is created use signal.connect

To test notifications:

keystone_db_data.args    # displays node2 IP

node2.update({'ip': '10.0.0.5'})

keystone_db_data.args   # updated IP

If you close the Python shell you can load the resources like this:

from x import resource
node1 = resource.load('rs/node1')

node2 = resource.load('rs/node2')

keystone_db_data = resource.load('rs/mariadn_keystone_data')

nova_db_data = resource.load('rs/mariadb_nova_data')

Connections are loaded automatically.

You can also load all resources at once:

from x import resource
all_resources = resource.load_all('rs')

CLI

You can do the above from the command-line client:

cd /vagrant

python cli.py resource create node1 x/resources/ro_node/ rs/ '{"ip":"10.0.0.3", "ssh_key" : "/vagrant/tmp/keys/ssh_private", "ssh_user":"vagrant"}'

python cli.py resource create node2 x/resources/ro_node/ rs/ '{"ip":"10.0.0.4", "ssh_key" : "/vagrant/tmp/keys/ssh_private", "ssh_user":"vagrant"}'

python cli.py resource create mariadb_keystone_data x/resources/data_container/ rs/ '{"image": "mariadb", "export_volumes" : ["/var/lib/mysql"], "ip": "", "ssh_user": "", "ssh_key": ""}'

python cli.py resource create mariadb_nova_data x/resources/data_container/ rs/ '{"image" : "mariadb", "export_volumes" : ["/var/lib/mysql"], "ip": "", "ssh_user": "", "ssh_key": ""}'

# View resourcespython cli.py resource show rs/mariadb_keystone_data
# Show all resources at location rs/
python cli.py resource show rs/ --all

# Show resources with specific tagspython cli.py resources show rs/ --tag test

# Connect resourcespython cli.py connect rs/node2 rs/mariadb_keystone_data
python cli.py connect rs/node1 rs/mariadb_nova_data
# Test updatepython cli.py update rs/node2 '{"ip": "1.1.1.1"}'
python cli.py resource show rs/mariadb_keystone_data  # --> IP is 1.1.1.1

# View connections
python cli.py connections show

# Outputs graph to 'graph.png' file, please note that arrows don't have "normal" pointers, but just the line is thicker
# please see http://networkx.lanl.gov/_modules/networkx/drawing/nx_pylab.html
python cli.py connections graph

# Disconnect
python cli.py disconnect rs/mariadb_nova_data rs/node1

# Tag a resource:
python cli.py resource tag rs/node1 test-tags# Remove tagspython cli.py resource tag rs/node1 test-tag --delete