README.md 2.54 KB
Newer Older
1 2
# Core python library

Ioannis Tsafaras's avatar
Ioannis Tsafaras committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28

## Description

The libraries contained in the core package are responsible for creating a cluster of VMs and installing all the required packages and configs to have a complete lambda instance. A description of the libraries follows:

### provisioner

The library is responsible for creating a VM cluster, using the Kamaki python API. It reads the authentication info from the .kamakirc, and accepts the cluster specs as arguments.

### ansible_manager

The library is responsible for managing the ansible, that will run on the cluster. Its tasks are:
* It reads a dictionary, containing the necessary info about the cluster and its nodes
* It creates an ansible inventory object, using the dictionary
* It creates the necessary group and host vars, required for ansible to run on all the nodes and configure them properly
* It sets some ansible constants, required eg for SSH tunnelling through the master node
* It runs ansible playbooks using the previously mentioned inventory and constants

### cluster_creator

The script is responsible for creating the entire lambda instance.
* It sets the provisioner arguments (cluster specs), then calls the provisioner to create the cluster.
* After that, it gets the output dictionary of the provisioner and adds some more values to it, which are obtained using the provisioner, after the cluster creation.
* It calls the ansible_manager, to create the inventory, using the dictionary as input.
* Finally, it uses the created manager object (containing the inventory and constants), to run the required playbooks in the correct order, to create the lambda instance.

29
## Prerequisites
Ioannis Tsafaras's avatar
Ioannis Tsafaras committed
30

31 32 33 34 35 36
* kamaki 0.13.4 or later
* ansible 1.9.2 or later
* crypto 1.4.1 or later


## Installation
37

38 39 40 41 42 43 44 45 46 47 48 49 50
- Create a .kamakirc configuration in your home folder and add all the required configurations.
 Here is an example configuration
```
[global]
default_cloud = lambda
ca_certs = /path/to/certs

[cloud "lambda"]
url = https://accounts.okeanos.grnet.gr/identity/v2.0
token = your-okeanos-token
```


51 52 53
- Install required packages `pip install -r requirements.txt`
- Install package using `python setup.py install`

Ioannis Tsafaras's avatar
Ioannis Tsafaras committed
54 55
## Usage

56

Ioannis Tsafaras's avatar
Ioannis Tsafaras committed
57 58 59 60
To create a lambda instance, one must edit the cluster_creator script, to set the requested cluster specs. Then, one must run `python cluster_creator.py`, and the lambda instance will be created automatically



61 62 63 64 65 66 67 68
## Testing

To test the library we use `tox`. In order to run the tests:

- Make sure you have tox installed `pip install tox`
- Run `tox`

This will automatically create the testing environments required and run the tests