danhan / hcat-savi

0 stars 0 forks source link

[LOW] Get MySQL URL dynamically via deployment pattern #16

Open danhan opened 11 years ago

danhan commented 11 years ago

The PDS is what keeps track of cloud deployments. It will keep track of the HCA deployment, and all of the nodes. The documentation is all linked from the github page, http://github.com/ceraslabs/pattern-deployer

Here's the nutshell version of the data structure. There is currently a live instance here: http://142.150.208.147:81/

Login (admin@test.com, mypass) and click API Doc. Click on /topology, then GET /topologies/{id}. Enter '3' for the ID, then click "try it now". Look at the JSON that is returned; there is a "deployment" key that would be filled with all of the defined nodes and their IP addresses and other information. There is a subkey 'databases' that will focus on DB details (password, etc.). Unfortunately with the testbed acting up I can't do a deployment to show you what that would look like. (PUT /topologies{id} will allow you to select id '3' and 'deploy' to try it yourself, if you want to).

Now, that web page is just a basic front end to a RESTful service. You can query this service programmatically as well; we also have a Java API that handles the service connection itself we can provide.

danhan commented 11 years ago

The returned result is like this: admin@test.com:mypass@http://142.150.208.147:81/api/topologies/3

{ "description": null, "pattern": "<topology id=\"hca4nodes2\"> <template id=\"core_small_instance\"> 2 CORE mike OpenStack 43b37071-898a-4a78-ab01-5275ba33b621 ubuntu <template id=\"edge_small_instance\"> 2 EDGE-TR-1 mike OpenStack 43b37071-898a-4a78-ab01-5275ba33b621 ubuntu <container num_of_copies=\"1\" id=\"web_host_core_container\"> <node id=\"web_host_core\"> <use_template name=\"core_small_instance\"/> <service name=\"web_server\"> <database_connection node=\"data_host\"/> hca.war jdbc/mysql <container num_of_copies=\"1\" id=\"web_host_edge_container\"> <node id=\"web_host_edge\"> <use_template name=\"edge_small_instance\"/> <service name=\"web_server\"> <database_connection node=\"data_host\"/> hca.war jdbc/mysql <node id=\"data_host\"> <use_template name=\"core_small_instance\"/> <service name=\"database_server\"> hcaschedule hca hcadb <node id=\"web_balancer\"> <use_template name=\"edge_small_instance\"/> <service name=\"web_balancer\"> <member node=\"web_host_edge\"/> <member node=\"web_host_core\"/> ", "link": "http://142.150.208.147:81/api/topologies/3", "templates": [ { "link": "http://142.150.208.147:81/api/topologies/3/templates/5", "pattern": "<template id=\"core_small_instance\"> 2 CORE mike OpenStack 43b37071-898a-4a78-ab01-5275ba33b621 ubuntu ", "name": "core_small_instance", "id": 5, "services": [] }, { "link": "http://142.150.208.147:81/api/topologies/3/templates/6", "pattern": "<template id=\"edge_small_instance\"> 2 EDGE-TR-1 mike OpenStack 43b37071-898a-4a78-ab01-5275ba33b621 ubuntu ", "name": "edge_small_instance", "id": 6, "services": [] } ], "nodes": [ { "link": "http://142.150.208.147:81/api/topologies/3/nodes/11", "pattern": "<node id=\"data_host\"> <use_template name=\"core_small_instance\"/> <service name=\"database_server\"> hcaschedule hca hcadb ", "name": "data_host", "id": 11, "services": [ { "pattern": "<service name=\"database_server\"> hcaschedule hca hcadb ", "link": "http://142.150.208.147:81/api/topologies/3/nodes/11/services/11", "name": "database_server", "id": 11 } ] }, { "link": "http://142.150.208.147:81/api/topologies/3/nodes/12", "pattern": "<node id=\"web_balancer\"> <use_template name=\"edge_small_instance\"/> <service name=\"web_balancer\"> <member node=\"web_host_edge\"/> <member node=\"web_host_core\"/> ", "name": "web_balancer", "id": 12, "services": [ { "pattern": "<service name=\"web_balancer\"> <member node=\"web_host_edge\"/> <member node=\"web_host_core\"/> ", "link": "http://142.150.208.147:81/api/topologies/3/nodes/12/services/12", "name": "web_balancer", "id": 12 } ] } ], "deployment": { "status": "undeployed", "servers": [], "applications": [], "message": null, "error": null, "databases": [], "monitoring_servers": [] }, "name": "hca4nodes2", "containers": [ { "pattern": "<container num_of_copies=\"1\" id=\"web_host_core_container\"> <node id=\"web_host_core\"> <use_template name=\"core_small_instance\"/> <service name=\"web_server\"> <database_connection node=\"data_host\"/> hca.war jdbc/mysql ", "link": "http://142.150.208.147:81/api/topologies/3/containers/5", "numOfCopies": 1, "nodes": [ { "link": "http://142.150.208.147:81/api/topologies/3/containers/5/nodes/9", "pattern": "<node id=\"web_host_core\"> <use_template name=\"core_small_instance\"/> <service name=\"web_server\"> <database_connection node=\"data_host\"/> hca.war jdbc/mysql ", "name": "web_host_core", "id": 9, "services": [ { "pattern": "<service name=\"web_server\"> <database_connection node=\"data_host\"/> hca.war jdbc/mysql ", "link": "http://142.150.208.147:81/api/topologies/3/containers/5/nodes/9/services/9", "name": "web_server", "id": 9 } ] } ], "name": "web_host_core_container", "id": 5 }, { "pattern": "<container num_of_copies=\"1\" id=\"web_host_edge_container\"> <node id=\"web_host_edge\"> <use_template name=\"edge_small_instance\"/> <service name=\"web_server\"> <database_connection node=\"data_host\"/> hca.war jdbc/mysql ", "link": "http://142.150.208.147:81/api/topologies/3/containers/6", "numOfCopies": 1, "nodes": [ { "link": "http://142.150.208.147:81/api/topologies/3/containers/6/nodes/10", "pattern": "<node id=\"web_host_edge\"> <use_template name=\"edge_small_instance\"/> <service name=\"web_server\"> <database_connection node=\"data_host\"/> hca.war jdbc/mysql ", "name": "web_host_edge", "id": 10, "services": [ { "pattern": "<service name=\"web_server\"> <database_connection node=\"data_host\"/> hca.war jdbc/mysql ", "link": "http://142.150.208.147:81/api/topologies/3/containers/6/nodes/10/services/10", "name": "web_server", "id": 10 } ] } ], "name": "web_host_edge_container", "id": 6 } ], "id": 3 }