Using Cloudify as a Manager of Managers
The Cloudify managers of managers (Spire) feature allows control of several managers (local managers) from one manager (Spire) via the deploy-on feature. The deploy-on feature allows users to deploy services on the discovered environments. The deploy-on feature also provides a means to deploy the same service on multiple environments using a single command. Users can group the environments based on location, tagging and filters. The following guide provides a step by step guide on how to install sub managers, add them to a central manager using a discovery mechanism, and deploy an application on multiple managers through a single command.
To install the MAIN Manager (Spire), please refer to the Cloudify official documentation.
You can also check Cloudify EC2 Provisioning. It is the package for installing the Cloudify Manager on an ec2 AWS instance.
You can install a sub-manager in the same way as the main manager (Spire). The most important thing is to make sure that your network is set up correctly (all local managers must be available for Spire Manager).
To use local managers through the central Spire manager, you need to expose information about them in Spire via discovery blueprint. The discovery blueprint automate the process of exposing the relevant configuration properties for each manager and placing them as an environment in the Spire manager.
First step is to deploy manager_discovery.yaml with proper inputs:
- endpoint - ip of sub manager
- tenant - name of submanagar tenant
- protocol - protocol used by sub manager
- port - number of port which sub manager is exposed
Upload manager_discovery.yaml to Spire Manager.
Next, click Deploy under the blueprint tile. Instead of this, you can also click on the blueprint name and next Create deployment
After that, the following window will appear:
Fill all necessary information and click Install button at the bottom of the dialog to start the Install workflow. To make sure if Environment is installed successfully, check the Verification of Installation chapter in the following part.
To use Cloudify API, you can refer to official API documentation.
curl -X PUT \
--header "Tenant: default_tenant" \
--header "Content-Type: application/json" \
-u admin:adminpw \
"http://localhost/api/v3.1/blueprints/submanager_blueprint?application_file_name=blueprint.yaml&visibility=tenant&blueprint_archive_url=https://url/to/archive/master.zip&labels=customer=EXL"
curl -X PUT \
--header "Tenant: default_tenant" \
--header "Content-Type: application/json" \
-u admin:adminpw \
-d '{"blueprint_id": "sub manager_blueprint", "inputs": {"cloudify_username": "admin", "cloudify_manager_ip": "10.0.10.10", "cloudify_port": "80", "cloudify_protocol": "http", "cloudify_tenant": "default_tenant"}, "visibility": "tenant", "site_name": "LONDON", "labels": [{"customer": "EXL"}]}' \
"http://localhost/api/v3.1/deployments/submanager1?_include=id"
curl -X POST \
--header "Tenant: default_tenant" \
--header "Content-Type: application/json" \
-u admin:admin \
-d '{"deployment_id":"sub manager1", "workflow_id":"install"}' \
"http://localhost/api/v3.1/deployments/submanager1?_include=id"
To proceed with CLI installation, refer to official documentation.
Upload the blueprint and then install it. There are two ways to install:
To verify if the sub manager Environment is created properly, go to the Environments tab and Click on created sub manager.
Execution Task Graph must contain Install completed tile. You can also check if all tasks are finished with success in Deployment Events/Logs.
Deployment Info tab contains DEPLOYMENT OUTPUTS/CAPABILITIES part with information about the sub manager. Check if the information is correct.
To perform correct management, you need to create also a proper secret about your all sub managers in Spire central manager. There are two ways to connect Spire with sub managers:
- Token - contains the proper value of Cloudify token. The token can be created with command cfy token create
- User password and username- contains the value of password and name of the user
The name of secrets must be compatible with the secrets as inputs used in “Deploy on” mechanism.
Depending on the connection type you can deploy the proper blueprint:
- authentication with token -> deploy_on_token.yaml
- authentication with user and password -> deploy_on_user_password.yaml
The current version of deploy_on_token.yaml/deploy_on_user_password.yaml supports public repo, to use private repo or local blueprint check chapter 7. Resource Config.
Upload the blueprint to SPIRE MANAGER. Filter (refer to chapter 6. Filters, Location and Labels) Environments and click the action “Deploy on” from Bulk action. The dialog appears. Select the proper blueprint and after that the inputs are visible.
Inputs description:
- Required:
- blueprint_archive - the URL to zip which contains all necessary files, the source must be available from the sub manager. You can find examples here
- blueprint_id - the name of the blueprint with which the file is to be uploaded
- main_file_name - the name of the blueprint file in zip package
- trust_all - the value of CLOUDIFY_SSL_TRUST_ALL (true if the certificate is not valid or for testing purpose)
- optional (depends on authentication type):
- cloudify_secret_token - the name of the secret which contains token value
- cloudify_password_secret_name and cloudify_user_secret_name- the name of the secret which contains value of the password and the user name of Cloudify user.
To check if deployments are deployed on local managers, follow the example below/ The examples use uploaded blueprint with id blueprint_on_sub manager. The used inputs to "Deploy on" mechanism:
- blueprint_id=blueprint_on_sub manager Must be uploaded to local!!!
- cloudify_password_secret_name=admin_password
- main_file_name=blueprint.yaml
- name_of_deployment=local_deployment1
- trust_all=true
- value_of_hello=MyWorld
Go to the Services by clicking on the button.
Verify if the install completed tile is visible in Execution Task Graph.
You can also go to the local manager and check if deployment is installed in the Services tab.
Optional [Only when inputs are exposed in Capabilities] !!!
In this blueprint, inputs are exposed. You can check the value of capabilities.
Bulk action "Deploy on" perform actions on all accesible Environments. If you would like to select only specific sub manager, you can use Filters. You can click Filter button (next to Bulk actions), and after that, the dialog appears.
The site can be set in the Deployment Metadata of Deploy dialog.
To view the location of the selected Environment, you can click Map button (next to Bulk actions and Filter), and after that the dialog appears.
The user can specify Labels in Deployment Metadata tile. Labels can be also set via blueprint. Current Labels are present in Deployment Info.
The user can add a label by clicking on Add button.
Node cloudify.nodes.Component allow to create deployment based on the blueprint which can be uploaded to the target manager (sub manager) from 3 types of resources:
- public repo - no additional step - example here
- private repo - create two secret: github_user and github_token - example here
- local blueprint - upload blueprint (from examples) to target sub manager and proceed with "Deploy on" on the main manager - example here
You can also specify inputs of deployments (example here) :
deployment:
inputs:
input0: test
input1: {get_input: value1}
input2: {get_secret: sec1}
If you use get_secret: secret1, you have to check if secret1 is created.