Skip to content

Host Pool

Vlastimil Holer edited this page Jul 24, 2018 · 13 revisions

The Host Pool is an inventory service with a configured list of pre-deployed running hosts available for the Cloudify deployments, and a deployment plugin for the standalone Cloudify and Cloudify Manager, which allocates the hosts from the inventory and returns back for the future reuse.

Use of the Host Pool with the Cloudified Gromacs is experimental. Service is used only to provide hostnames from the pool for the deployment, no other real connection parameters (user, password, SSH key) shouldn't be stored in the service and also aren't taken from the service. Except the allocated host IP address, all the connection parameters are provided in the inputs for the Cloudified Gromacs blueprint.

Service is deployed using the Cloudify blueprint.

Download

mkdir cfy-hostpool
wget -O hostpool.tar.gz \
    'https://github.com/cloudify-cosmo/cloudify-host-pool-service/archive/1.2.tar.gz'
tar -xvf hostpool.tar.gz -C cfy-hostpool/ --strip-components=1

Configure

You need to configure an initial pool of hosts, the service will be deployed with. You still can manage the pool during the runtime, but it's a little more complicated. To set the initial pool, edit the pool.yaml:

cd cfy-hostpool/examples/local-blueprint/
vim pool.yaml

with your content following this YAML structure:

default:
  os: linux
  credentials:
    username: dummy    # needs to be present, but not respected
  endpoint:
    port: 22
    protocol: ssh

hosts:
  - name: server0      # unique server name in the host pool
    endpoint:
      ip: 1.2.3.4      # host IP address
    tags: ['olin']     # list tags with suitable host roles ('olin' and/or 'worker')

  - name: server1
    endpoint:
      ip: 1.2.3.5
    tags: ['olin','worker']

Deploy

virtualenv /opt/host-pool-service
source /opt/host-pool-service/bin/activate
cfy profiles use local
cfy init local-blueprint.yaml 
PYTHONPATH=../../ cfy executions start -b local-blueprint install

Service listens on port 8080 on all IP addresses. If used only locally (standalone Cloudify, or deployed on the same host as Cloudify Manager), it's better to bind the service only on the local address. You need to modify the service script /etc/init.d/cloudify-hostpool, and replace the occurrence of 0.0.0.0 with 127.0.0.1. Then restart the service by calling /etc/init.d/cloudify-hostpool restart.

Runtime pool management

For the service running on localhost, check following examples how to manage the pool on runtime.

List hosts

curl http://localhost:8080/hosts

Add host

curl -X POST -H "Content-Type: application/json" \
    http://localhost:8080/hosts \
    -d '{"hosts":[{"name": "example_host", "endpoint":{"ip": "1.2.3.4", "port":22, "protocol":"ssh"},"credentials":{"username":"dummy"}, "tags":["olin", "worker"], "os":"linux"}]}'

Delete host

curl -X DELETE http://localhost:8080/host/12
Clone this wiki locally