Adding Nodes

Nodes are physical or virtual machines with a Docker installation.

Nodes can be either unmanaged, which mean that they were created manually, by provisioning a machine and installing Docker on it, in which case they have to be registered in tsuru. Or they can be automatically managed by tsuru, which will handle machine provisioning and Docker installation using your IaaS configuration.

The managed option is preferred starting with tsuru-server 0.6.0. There are advantages like automatically healing and scaling of Nodes. The sections below describe how to add managed and unmanaged nodes.

Managed nodes

First step is configuring your IaaS provider in your tsuru.conf file. Please see the details in IaaS configuration

Assuming you’re using EC2, the configuration will be something like:

iaas:
  default: ec2
  node-protocol: http
  node-port: 2375
  ec2:
    key-id: xxxxxxxxxxx
    secret-key: yyyyyyyyyyyyy

After you have everything configured, adding a new Docker node is done by calling node-add in tsuru command. This command will receive a map of key=value params which are IaaS dependent. A list of possible key params can be seen calling:

$ tsuru node-add docker iaas=ec2

EC2 IaaS required params:
  image=<image id>         Image AMI ID
  type=<instance type>     Your template uuid

Optional params:
  region=<region>          Chosen region, defaults to us-east-1
  securityGroup=<group>    Chosen security group
  keyName=<key name>       Key name for machine

Every key=value pair will be added as a metadata to the Node and you can send After registering your node, you can list it calling tsuru node-list

$ tsuru node-add docker iaas=ec2 image=ami-dc5387b4 region=us-east-1 type=m1.small securityGroup=my-sec-group keyName=my-key
Node successfully registered.
$ tsuru node-list
+-------------------------------------------------------+------------+---------+----------------------------+
| Address                                               | IaaS ID    | Status  | Metadata                   |
+-------------------------------------------------------+------------+---------+----------------------------+
| http://ec2-xxxxxxxxxxxxx.compute-1.amazonaws.com:2375 | i-xxxxxxxx | waiting | iaas=ec2                   |
|                                                       |            |         | image=ami-dc5387b4         |
|                                                       |            |         | keyName=my-key             |
|                                                       |            |         | region=us-east-1           |
|                                                       |            |         | securityGroup=my-sec-group |
|                                                       |            |         | type=m1.small              |
+-------------------------------------------------------+------------+---------+----------------------------+

Unmanaged nodes

To add a previously provisioned node you call the tsuru node-add with the --register flag and setting the address key with the URL of the Docker API in the remote node and specify the pool of the node with pool=mypoolname.

The docker API must be responding in the referenced address. To instructions about how to install docker on your node, please refer to Docker documentation.

$ tsuru node-add docker pool=mypoolname --register address=http://node.address.com:2375

To enable the new unmanaged node run this command:

$ tsuru node-update http://node.address.com:2375 --enable