From 526095b509407510daaad24250e2d28c168f76b0 Mon Sep 17 00:00:00 2001 From: Dinithi Date: Mon, 2 Mar 2015 17:05:21 +0530 Subject: [PATCH] Fixing issues in the single-group-v1 sample application. --- .../artifacts/application-policy.json | 8 +++ .../artifacts/application.json | 16 +++--- .../artifacts/deployment-policy.json | 15 ----- .../artifacts/ec2/deployment-policy.json | 56 ------------------ .../kubernetes/deployment-policy.json | 57 ------------------- .../kubernetes/kubernetes-cluster.json | 56 ------------------ .../artifacts/mock/deployment-policy.json | 56 ------------------ .../openstack/deployment-policy.json | 56 ------------------ .../single-group-v1/scripts/common/deploy.sh | 22 ++++--- .../scripts/common/undeploy.sh | 16 ++++-- 10 files changed, 42 insertions(+), 316 deletions(-) create mode 100644 samples/applications/single-group-v1/artifacts/application-policy.json delete mode 100644 samples/applications/single-group-v1/artifacts/deployment-policy.json delete mode 100644 samples/applications/single-group-v1/artifacts/ec2/deployment-policy.json delete mode 100644 samples/applications/single-group-v1/artifacts/kubernetes/deployment-policy.json delete mode 100644 samples/applications/single-group-v1/artifacts/kubernetes/kubernetes-cluster.json delete mode 100644 samples/applications/single-group-v1/artifacts/mock/deployment-policy.json delete mode 100644 samples/applications/single-group-v1/artifacts/openstack/deployment-policy.json diff --git a/samples/applications/single-group-v1/artifacts/application-policy.json b/samples/applications/single-group-v1/artifacts/application-policy.json new file mode 100644 index 0000000000..2c73f9a26e --- /dev/null +++ b/samples/applications/single-group-v1/artifacts/application-policy.json @@ -0,0 +1,8 @@ +{ + "networkPartition":[ + { + "id":"network-partition-3", + "activeByDefault":"true" + } + ] +} diff --git a/samples/applications/single-group-v1/artifacts/application.json b/samples/applications/single-group-v1/artifacts/application.json index f8e9bd42e7..25b4aad615 100644 --- a/samples/applications/single-group-v1/artifacts/application.json +++ b/samples/applications/single-group-v1/artifacts/application.json @@ -1,20 +1,21 @@ { - "applicationId": "single_group_v1", - "alias": "single_group_v1", + "applicationId": "single-group-v1", + "alias": "my-single-group-v1", "components": { "groups": [ { "name": "group6", - "alias": "mygroup6", + "alias": "my-group6", "groupMinInstances": 2, "groupMaxInstances": 3, + "deploymentPolicy":"deployment-policy-3", "cartridges": [ { - "type": "tomcat2", + "type": "tomcat1", "cartridgeMin": 1, "cartridgeMax": 1, "subscribableInfo": { - "alias": "tom2group6", + "alias": "my-tomcat1", "autoscalingPolicy": "autoscaling-policy-1", "artifactRepository":{ "privateRepo":false, @@ -33,8 +34,9 @@ "cartridgeMin": 1, "cartridgeMax": 1, "subscribableInfo": { - "alias": "mytomcat", + "alias": "my-tomcat", "autoscalingPolicy": "autoscaling-policy-1", + "deploymentPolicy":"deployment-policy-3", "artifactRepository":{ "privateRepo":false, "repoUrl":"https://github.com/imesh/stratos-tomcat-applications.git", @@ -46,7 +48,7 @@ ], "dependencies": { "startupOrders": [ - "group.group6,cartridge.tomcat" + "group.my-group6,cartridge.my-tomcat" ], "terminationBehaviour": "terminate-none" } diff --git a/samples/applications/single-group-v1/artifacts/deployment-policy.json b/samples/applications/single-group-v1/artifacts/deployment-policy.json deleted file mode 100644 index d858aed9d7..0000000000 --- a/samples/applications/single-group-v1/artifacts/deployment-policy.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "id": "deployment-policy-2", - "networkPartition": [ - { - "id": "network-partition-1", - "partitionAlgo": "one-after-another", - "partitions": [ - { - "id": "partition-1", - "max": 5 - } - ] - } - ] -} diff --git a/samples/applications/single-group-v1/artifacts/ec2/deployment-policy.json b/samples/applications/single-group-v1/artifacts/ec2/deployment-policy.json deleted file mode 100644 index 2b05288d0b..0000000000 --- a/samples/applications/single-group-v1/artifacts/ec2/deployment-policy.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "applicationId": "single_group_v1", - "applicationPolicy": { - "networkPartition": [ - { - "id": "network-partition-1", - "activeByDefault": "true", - "partitions": [ - { - "id": "partition-1", - "provider": "ec2", - "property": [ - { - "name": "region", - "value": "ap-southeast-1" - } - ] - } - ] - } - ] - }, - "childPolicies": [ - { - "alias": "mytomcat", - "networkPartition": [ - { - "id": "network-partition-1", - "partitionAlgo": "one-after-another", - "partitions": [ - { - "id": "partition-1", - "max": 5 - } - ] - } - ] - }, - { - "alias": "mygroup6", - "networkPartition": [ - { - "id": "network-partition-1", - "partitionAlgo": "one-after-another", - "partitions": [ - { - "id": "partition-1", - "max": 5 - } - ] - } - ] - } - ] -} - diff --git a/samples/applications/single-group-v1/artifacts/kubernetes/deployment-policy.json b/samples/applications/single-group-v1/artifacts/kubernetes/deployment-policy.json deleted file mode 100644 index 6686bea8d2..0000000000 --- a/samples/applications/single-group-v1/artifacts/kubernetes/deployment-policy.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "applicationId": "single_group_v1", - "applicationPolicy": { - "networkPartition": [ - { - "id":"network-partition-1", - "kubernetesClusterId":"kubernetes-cluster-1", - "activeByDefault": "true", - "partitions": [ - { - "id": "partition-1", - "provider": "kubernetes", - "property": [ - { - "name": "region", - "value": "default" - } - ] - } - ] - } - ] - }, - "childPolicies": [ - { - "alias": "mytomcat", - "networkPartition": [ - { - "id": "network-partition-1", - "partitionAlgo": "one-after-another", - "partitions": [ - { - "id": "partition-1", - "max": 5 - } - ] - } - ] - }, - { - "alias": "mygroup6", - "networkPartition": [ - { - "id": "network-partition-1", - "partitionAlgo": "one-after-another", - "partitions": [ - { - "id": "partition-1", - "max": 5 - } - ] - } - ] - } - ] -} - diff --git a/samples/applications/single-group-v1/artifacts/kubernetes/kubernetes-cluster.json b/samples/applications/single-group-v1/artifacts/kubernetes/kubernetes-cluster.json deleted file mode 100644 index 2988ed1e91..0000000000 --- a/samples/applications/single-group-v1/artifacts/kubernetes/kubernetes-cluster.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "clusterId": "kubernetes-cluster-1", - "description": "Kubernetes CoreOS cluster", - "kubernetesMaster": { - "hostId": "KubHostMaster1", - "hostname": "master.dev.kubernetes.example.org", - "privateIPAddress": "172.17.8.100", - "publicIPAddress": "172.17.8.100", - "property": [ - ] - }, - "portRange": { - "upper": "5000", - "lower": "4500" - }, - "kubernetesHosts": [ - { - "hostId": "KubHostSlave1", - "hostname": "slave1.dev.kubernetes.example.org", - "privateIPAddress": "172.17.8.101", - "publicIPAddress": "172.17.8.101", - "property": [ - ] - }, - { - "hostId": "KubHostSlave2", - "hostname": "slave2.dev.kubernetes.example.org", - "privateIPAddress": "172.17.8.102", - "publicIPAddress": "172.17.8.102", - "property": [ - ] - } - ], - "property": [ - { - "name": "payload_parameter.MB_IP", - "value": "172.17.8.1" - }, - { - "name": "payload_parameter.MB_PORT", - "value": "1883" - }, - { - "name": "payload_parameter.CEP_IP", - "value": "172.17.8.1" - }, - { - "name": "payload_parameter.CEP_PORT", - "value": "7711" - }, - { - "name": "payload_parameter.LOG_LEVEL", - "value": "DEBUG" - } - ] -} diff --git a/samples/applications/single-group-v1/artifacts/mock/deployment-policy.json b/samples/applications/single-group-v1/artifacts/mock/deployment-policy.json deleted file mode 100644 index 27df0d1689..0000000000 --- a/samples/applications/single-group-v1/artifacts/mock/deployment-policy.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "applicationId": "single_group_v1", - "applicationPolicy": { - "networkPartition": [ - { - "id": "network-partition-1", - "activeByDefault": "true", - "partitions": [ - { - "id": "partition-1", - "provider": "mock", - "property": [ - { - "name": "region", - "value": "RegionOne" - } - ] - } - ] - } - ] - }, - "childPolicies": [ - { - "alias": "mytomcat", - "networkPartition": [ - { - "id": "network-partition-1", - "partitionAlgo": "one-after-another", - "partitions": [ - { - "id": "partition-1", - "max": 5 - } - ] - } - ] - }, - { - "alias": "mygroup6", - "networkPartition": [ - { - "id": "network-partition-1", - "partitionAlgo": "one-after-another", - "partitions": [ - { - "id": "partition-1", - "max": 5 - } - ] - } - ] - } - ] -} - diff --git a/samples/applications/single-group-v1/artifacts/openstack/deployment-policy.json b/samples/applications/single-group-v1/artifacts/openstack/deployment-policy.json deleted file mode 100644 index fe64e8d8fe..0000000000 --- a/samples/applications/single-group-v1/artifacts/openstack/deployment-policy.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "applicationId": "single_group_v1", - "applicationPolicy": { - "networkPartition": [ - { - "id": "network-partition-1", - "activeByDefault": "true", - "partitions": [ - { - "id": "partition-1", - "provider": "openstack", - "property": [ - { - "name": "region", - "value": "RegionOne" - } - ] - } - ] - } - ] - }, - "childPolicies": [ - { - "alias": "mytomcat", - "networkPartition": [ - { - "id": "network-partition-1", - "partitionAlgo": "one-after-another", - "partitions": [ - { - "id": "partition-1", - "max": 5 - } - ] - } - ] - }, - { - "alias": "mygroup6", - "networkPartition": [ - { - "id": "network-partition-1", - "partitionAlgo": "one-after-another", - "partitions": [ - { - "id": "partition-1", - "max": 5 - } - ] - } - ] - } - ] -} - diff --git a/samples/applications/single-group-v1/scripts/common/deploy.sh b/samples/applications/single-group-v1/scripts/common/deploy.sh index ec5bd376dd..29371c030c 100755 --- a/samples/applications/single-group-v1/scripts/common/deploy.sh +++ b/samples/applications/single-group-v1/scripts/common/deploy.sh @@ -11,6 +11,9 @@ artifacts_path=`cd "${script_path}/../../artifacts"; pwd` iaas_artifacts_path=`cd "${script_path}/../../artifacts/${iaas}"; pwd` cartridges_path=`cd "${script_path}/../../../../cartridges/${iaas}"; pwd` cartridges_groups_path=`cd "${script_path}/../../../../cartridges-groups"; pwd` +autoscaling_policies_path=`cd "${script_path}/../../../../autoscaling-policies"; pwd` +network_partitions_path=`cd "${script_path}/../../../../network-partitions/${iaas}"; pwd` +deployment_policies_path=`cd "${script_path}/../../../../deployment-policies"; pwd` set -e @@ -19,20 +22,23 @@ if [[ -z "${iaas}" ]]; then exit fi -echo ${artifacts_path}/autoscaling-policy.json +echo ${autoscaling_policies_path}/autoscaling-policy-1.json echo "Adding autoscale policy..." -curl -X POST -H "Content-Type: application/json" -d "@${artifacts_path}/autoscaling-policy.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies +curl -X POST -H "Content-Type: application/json" -d "@${autoscaling_policies_path}/autoscaling-policy-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies -echo "Adding tomcat cartridge..." -curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/tomcat.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges +echo "Adding network partitions..." +curl -X POST -H "Content-Type: application/json" -d "@${network_partitions_path}/network-partition-3.json" -k -v -u admin:admin https://${host_ip}:9443/api/networkPartitions + +echo "Adding deployment policies..." +curl -X POST -H "Content-Type: application/json" -d "@${deployment_policies_path}/deployment-policy-3.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/deploymentPolicies echo "Adding tomcat1 cartridge..." curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/tomcat1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges -echo "Adding tomcat2 cartridge..." -curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/tomcat2.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges +echo "Adding tomcat cartridge..." +curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/tomcat.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges -echo "Adding group6c5 group..." +echo "Adding group6 group..." curl -X POST -H "Content-Type: application/json" -d "@${cartridges_groups_path}/group6c5.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups sleep 1 @@ -41,5 +47,5 @@ echo "Creating application..." curl -X POST -H "Content-Type: application/json" -d "@${artifacts_path}/application.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications echo "Deploying application..." -curl -X POST -H "Content-Type: application/json" -d "@${iaas_artifacts_path}/deployment-policy.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/single_group_v1/deploy +curl -X POST -H "Content-Type: application/json" -d "@${artifacts_path}/application-policy.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/single-group-v1/deploy diff --git a/samples/applications/single-group-v1/scripts/common/undeploy.sh b/samples/applications/single-group-v1/scripts/common/undeploy.sh index 940c994ad1..856b5214d8 100644 --- a/samples/applications/single-group-v1/scripts/common/undeploy.sh +++ b/samples/applications/single-group-v1/scripts/common/undeploy.sh @@ -6,20 +6,26 @@ host_port=9443 set -e echo "Undeploying application..." -curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/single_group_v1/undeploy +curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/single-group-v1/undeploy sleep 10 echo "Deleting application..." -curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/single_group_v1 +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/single-group-v1 echo "Removing groups..." curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups/group6 echo "Removing cartridges..." -curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/tomcat curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/tomcat1 -curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/tomcat2 +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/tomcat echo "Removing autoscale policies..." -curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies/autoscaling-policy-1 \ No newline at end of file +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies/autoscaling-policy-1 + +echo "Removing deployment policies..." +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/deploymentPolicies/deployment-policy-3 + +echo "Removing network partitions..." +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions/network-partition-3 +