{"action":"created","issue":{"url":"https://api.github.com/repos/SeaCloudsEU/SeaCloudsPlatform/issues/252","repository_url":"https://api.github.com/repos/SeaCloudsEU/SeaCloudsPlatform","labels_url":"https://api.github.com/repos/SeaCloudsEU/SeaCloudsPlatform/issues/252/labels{/name}","comments_url":"https://api.github.com/repos/SeaCloudsEU/SeaCloudsPlatform/issues/252/comments","events_url":"https://api.github.com/repos/SeaCloudsEU/SeaCloudsPlatform/issues/252/events","html_url":"https://github.com/SeaCloudsEU/SeaCloudsPlatform/pull/252","id":135808942,"number":252,"title":"Feature/seaclouds initializer policy","user":{"login":"adriannieto","id":7558172,"avatar_url":"https://avatars.githubusercontent.com/u/7558172?v=3","gravatar_id":"","url":"https://api.github.com/users/adriannieto","html_url":"https://github.com/adriannieto","followers_url":"https://api.github.com/users/adriannieto/followers","following_url":"https://api.github.com/users/adriannieto/following{/other_user}","gists_url":"https://api.github.com/users/adriannieto/gists{/gist_id}","starred_url":"https://api.github.com/users/adriannieto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adriannieto/subscriptions","organizations_url":"https://api.github.com/users/adriannieto/orgs","repos_url":"https://api.github.com/users/adriannieto/repos","events_url":"https://api.github.com/users/adriannieto/events{/privacy}","received_events_url":"https://api.github.com/users/adriannieto/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/SeaCloudsEU/SeaCloudsPlatform/labels/in%20progress","name":"in progress","color":"00a7ed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-02-23T17:41:40Z","updated_at":"2016-03-02T10:07:45Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/SeaCloudsEU/SeaCloudsPlatform/pulls/252","html_url":"https://github.com/SeaCloudsEU/SeaCloudsPlatform/pull/252","diff_url":"https://github.com/SeaCloudsEU/SeaCloudsPlatform/pull/252.diff","patch_url":"https://github.com/SeaCloudsEU/SeaCloudsPlatform/pull/252.patch"},"body":"This policy is on charge to configure and clean up all the required SeaClouds Components (SLA Core, Tower4Clouds, InfluxDB observers and Grafana Dashboards)  when an application is installed/removed.\r\n\r\nThis policy is designed to be attached at root level. In order to see working examples please take a look to SeaCloudsInitializerPolicyTest.\r\n\r\nIt also remove unnecessary Java code for the dashboard.\r\n\r\nDAM EXAMPLE:\r\n\r\n```yaml\r\ntosca_definitions_version: tosca_simple_yaml_1_0_0_wd03\r\n\r\nimports:\r\n  - tosca-normative-types:1.0.0.wd06-SNAPSHOT\r\n\r\ntemplate_name: brooklyn.a4c.simple.chatApplication\r\ntemplate_version: 1.0.0-SNAPSHOT\r\n\r\ndescription: Brooklyn HelloWorld application. (ChatApplication)\r\n\r\nnode_types:\r\n  org.apache.brooklyn.entity.webapp.tomcat.TomcatServer:\r\n    derived_from: tosca.nodes.Root\r\n    description: >\r\n      A simple Tomcat server\r\n    properties:\r\n      wars.root:\r\n        type: string\r\n        required: false\r\n      http.port:\r\n        type: list\r\n        required: false\r\n        entry_schema:\r\n          type: string\r\n      java.sysprops:\r\n        type: map\r\n        required: false\r\n        entry_schema:\r\n          type: string\r\n  org.apache.brooklyn.entity.database.mysql.MySqlNode:\r\n    derived_from: tosca.nodes.Root\r\n    description: >\r\n      A MySQL server\r\n    properties:\r\n      \"datastore.creation.script.url\":\r\n        type: string\r\n        required: false\r\n    capabilities:\r\n      host:\r\n        type: tosca.capabilities.Container\r\n\r\n  seaclouds.nodes.Datacollector:\r\n    derived_from: tosca.nodes.Root\r\n    description: >\r\n      A simple DC\r\n    properties:\r\n      installLatch:\r\n        type: string\r\n        required: false\r\n      shell.env:\r\n        type: map\r\n        required: false\r\n        entry_schema:\r\n          type: string\r\n    requirements:\r\n    - host: tosca.nodes.Root\r\n      type: tosca.relationships.HostedOn\r\n\r\n  seaclouds.nodes.SlaInitializer:\r\n    derived_from: tosca.nodes.Root\r\n    description: >\r\n      A node to initialize the SLA Core for a particular app\r\n    properties:\r\n      installLatch:\r\n        type: string\r\n        required: true\r\n      shell.env:\r\n        type: map\r\n        required: true\r\n        entry_schema:\r\n          type: string\r\n    requirements:\r\n    - host: tosca.nodes.Root\r\n      type: tosca.relationships.HostedOn\r\n\r\n  seaclouds.nodes.Tower4CloudsInitializer:\r\n    derived_from: tosca.nodes.Root\r\n    description: >\r\n      A node to initialize the Tower4Clouds platform for a particular app\r\n    properties:\r\n      installLatch:\r\n        type: string\r\n        required: true\r\n      shell.env:\r\n        type: map\r\n        required: true\r\n        entry_schema:\r\n          type: string\r\n    requirements:\r\n    - host: tosca.nodes.Root\r\n      type: tosca.relationships.HostedOn\r\n\r\n  seaclouds.nodes.InfluxDbObserversInitializer:\r\n    derived_from: tosca.nodes.Root\r\n    description: >\r\n      A node to initialize the InfluxDb Observers in T4C\r\n    properties:\r\n      installLatch:\r\n        type: string\r\n        required: true\r\n      shell.env:\r\n        type: map\r\n        required: true\r\n        entry_schema:\r\n          type: string\r\n    requirements:\r\n    - host: tosca.nodes.Root\r\n      type: tosca.relationships.HostedOn\r\n\r\ntopology_template:\r\n  description: Web Server Sample with Script\r\n  node_templates:\r\n    tomcat_server:\r\n      type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer\r\n      properties:\r\n        wars.root: \"http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0/brooklyn-example-hello-world-sql-webapp-0.6.0.war\"\r\n        http.port: \"8080+\"\r\n        java.sysprops:\r\n          brooklyn.example.db.url: $brooklyn:formatString(\"jdbc:%s%s?user=%s\\\\&password=%s\", component(\"mysql_server\").attributeWhenReady(\"datastore.url\"), \"visitors\", \"brooklyn\", \"br00k11n\")\r\n\r\n    mysql_server:\r\n      type: org.apache.brooklyn.entity.database.mysql.MySqlNode\r\n      properties:\r\n        datastore.creation.script.url: \"https://raw.githubusercontent.com/apache/incubator-brooklyn/286448623c417f099a8bce1a4764d6aa4589c6ea/brooklyn-server/launcher/src/test/resources/visitors-creation-script.sql\"\r\n\r\n    dc:\r\n      type: seaclouds.nodes.Datacollector\r\n      properties:\r\n        installLatch: $brooklyn:component(\"mysql_server\").attributeWhenReady(\"service.isUp\")\r\n        shell.env:\r\n          MODACLOUDS_TOWER4CLOUDS_MANAGER_IP: \"52.48.187.2\"\r\n          MODACLOUDS_TOWER4CLOUDS_MANAGER_PORT: \"8170\"\r\n          MODACLOUDS_TOWER4CLOUDS_DC_SYNC_PERIOD: \"10\"\r\n          MODACLOUDS_TOWER4CLOUDS_RESOURCES_KEEP_ALIVE_PERIOD: \"25\"\r\n          MODACLOUDS_TOWER4CLOUDS_INTERNAL_COMPONENT_TYPE: \"mysql_server\"\r\n          MODACLOUDS_TOWER4CLOUDS_INTERNAL_COMPONENT_ID: \"mysql_server_ID\"\r\n          MODACLOUDS_TOWER4CLOUDS_VM_TYPE: \"appid_mysql_server\"\r\n          MODACLOUDS_TOWER4CLOUDS_VM_ID: \"appid_mysql_server_VM_ID\"\r\n      interfaces:\r\n          Standard:\r\n            start: \"https://s3-eu-west-1.amazonaws.com/modacloudsdc-start-script/installModacloudsDc.sh\"\r\n      requirements:\r\n      - host: mysql_server\r\n\r\n  # if you want to tell brooklyn to assign a location at deploy time, as part of the template, this is the current way.\r\n  # it can also be done with camp, referencing this topology template.\r\n  groups:\r\n    add_brooklyn_location:\r\n      members: [ mysql_server, tomcat_server ]\r\n      policies:\r\n      - brooklyn.location:\r\n          jclouds:aws-ec2:\r\n            region: us-west-2\r\n            identity: REMOVED\r\n            credential: REMOVED\r\n            hardwareId: m3.medium\r\n    seaclouds_configuration_policy:\r\n      members: [ ]\r\n      policies:\r\n      - configuration:\r\n          type: eu.seaclouds.policy.SeaCloudsInitializerPolicy\r\n          slaEndpoint: \"http://52.36.119.104:9003\"\r\n          slaAgreement: \"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pg0KPHdzYWc6QWdyZWVtZW50IHhtbG5zOnNsYT0iaHR0cDovL3NsYS5hdG9zLmV1IiB4bWxuczp3c2FnPSJodHRwOi8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NlcnZpY2VMZXZlbE9iamVjdGl2ZT4NCiAgICAgICAgICAgICAgICAgICAgPHdzYWc6S1BJVGFyZ2V0Pg0KICAgICAgICAgICAgICAgICAgICAgICAgPHdzYWc6S1BJTmFtZT5hcHBpZF9teXNxbF9zZXJ2ZXIvQ1BVVXRpbGl6YXRpb248L3dzYWc6S1BJTmFtZT4NCiAgICAgICAgICAgICAgICAgICAgICAgIDx3c2FnOkN1c3RvbVNlcnZpY2VMZXZlbD57ImNvbnN0cmFpbnQiOiAiYXBwaWRfbXlzcWxfc2VydmVyX2NwdV91dGlsaXphdGlvbiBOT1RfRVhJU1RTIiwgInFvcyI6ICJNRVRSSUMgTEUgMC41IiB9PC93c2FnOkN1c3RvbVNlcnZpY2VMZXZlbD4NCiAgICAgICAgICAgICAgICAgICAgPC93c2FnOktQSVRhcmdldD4NCiAgICAgICAgICAgICAgICA8L3dzYWc6U2VydmljZUxldmVsT2JqZWN0aXZlPg0KICAgICAgICAgICAgPC93c2FnOkd1YXJhbnRlZVRlcm0+DQogICAgICAgIDwvd3NhZzpBbGw+DQogICAgPC93c2FnOlRlcm1zPg0KPC93c2FnOkFncmVlbWVudD4NCg==\"\r\n          t4cEndpoint: \"http://52.48.187.2:8170\"\r\n          t4cRules: \"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pg0KPG1vbml0b3JpbmdSdWxlcyB4bWxucz0iaHR0cDovL3d3dy5tb2RhY2xvdWRzLmV1L3hzZC8xLjAvbW9uaXRvcmluZ19ydWxlc19zY2hlbWEiIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhzaTpzY2hlbWFMb2NhdGlvbj0iaHR0cDovL3d3dy5tb2RhY2xvdWRzLmV1L3hzZC8xLjAvbW9uaXRvcmluZ19ydWxlc19zY2hlbWEiPg0KICAgIDwhLS0gTW9uaXRvcmluZyB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KICAgIDwvbW9uaXRvcmluZ1J1bGU+DQo8L21vbml0b3JpbmdSdWxlcz4NCg==\"\r\n          influxdbEndpoint: \"http://52.48.187.2:8086\"\r\n          influxdbDatabase: \"tower4clouds\"\r\n          influxdbUsername: \"root\"\r\n          influxdbPassword: \"root\"\r\n          grafanaEndpoint:  \"http://52.48.187.2:3000\"\r\n          grafanaUsername:  \"admin\"\r\n          grafanaPassword:  \"admin\"\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/SeaCloudsEU/SeaCloudsPlatform/issues/comments/191168492","html_url":"https://github.com/SeaCloudsEU/SeaCloudsPlatform/pull/252#issuecomment-191168492","issue_url":"https://api.github.com/repos/SeaCloudsEU/SeaCloudsPlatform/issues/252","id":191168492,"user":{"login":"andreaturli","id":222887,"avatar_url":"https://avatars.githubusercontent.com/u/222887?v=3","gravatar_id":"","url":"https://api.github.com/users/andreaturli","html_url":"https://github.com/andreaturli","followers_url":"https://api.github.com/users/andreaturli/followers","following_url":"https://api.github.com/users/andreaturli/following{/other_user}","gists_url":"https://api.github.com/users/andreaturli/gists{/gist_id}","starred_url":"https://api.github.com/users/andreaturli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreaturli/subscriptions","organizations_url":"https://api.github.com/users/andreaturli/orgs","repos_url":"https://api.github.com/users/andreaturli/repos","events_url":"https://api.github.com/users/andreaturli/events{/privacy}","received_events_url":"https://api.github.com/users/andreaturli/received_events","type":"User","site_admin":false},"created_at":"2016-03-02T10:07:45Z","updated_at":"2016-03-02T10:07:45Z","body":"thanks @kiuby88, but where the `DAMGenerator` will get the value of the following configurations?\r\n```\r\n          slaEndpoint: \"http://52.36.119.104:9003\"\r\n          influxdbEndpoint: \"http://52.48.187.2:8086\"\r\n          influxdbDatabase: \"tower4clouds\"\r\n          influxdbUsername: \"root\"\r\n          influxdbPassword: \"root\"\r\n          grafanaEndpoint:  \"http://52.48.187.2:3000\"\r\n          grafanaUsername:  \"admin\"\r\n          grafanaPassword:  \"admin\"\r\n```"}}