You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by re...@apache.org on 2015/03/01 19:35:43 UTC
[22/50] [abbrv] stratos git commit: fixing group-cartridges sample
fixing group-cartridges sample
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/530880a6
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/530880a6
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/530880a6
Branch: refs/heads/docker-grouping-merge
Commit: 530880a6d96c32c81eea6d4d01bb89b51c87d9c1
Parents: 16a8ef5
Author: R-Rajkumar <rr...@gmail.com>
Authored: Sat Feb 28 00:58:20 2015 +0530
Committer: R-Rajkumar <rr...@gmail.com>
Committed: Sat Feb 28 00:58:20 2015 +0530
----------------------------------------------------------------------
.../artifacts/application-policy.json | 12 +++++
.../group-cartridges/artifacts/application.json | 14 ++---
.../artifacts/autoscaling-policy.json | 14 -----
.../artifacts/deployment-policy.json | 15 ------
.../artifacts/ec2/deployment-policy.json | 41 --------------
.../artifacts/kubernetes/deployment-policy.json | 42 ---------------
.../kubernetes/kubernetes-cluster.json | 56 --------------------
.../artifacts/mock/deployment-policy.json | 56 --------------------
.../artifacts/openstack/deployment-policy.json | 41 --------------
.../group-cartridges/scripts/common/deploy.sh | 17 ++++--
.../group-cartridges/scripts/common/undeploy.sh | 15 ++++--
11 files changed, 46 insertions(+), 277 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/530880a6/samples/applications/group-cartridges/artifacts/application-policy.json
----------------------------------------------------------------------
diff --git a/samples/applications/group-cartridges/artifacts/application-policy.json b/samples/applications/group-cartridges/artifacts/application-policy.json
new file mode 100644
index 0000000..239d6d9
--- /dev/null
+++ b/samples/applications/group-cartridges/artifacts/application-policy.json
@@ -0,0 +1,12 @@
+{
+ "networkPartition":[
+ {
+ "id":"network-partition-1",
+ "activeByDefault":"false"
+ },
+ {
+ "id":"network-partition-2",
+ "activeByDefault":"true"
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/530880a6/samples/applications/group-cartridges/artifacts/application.json
----------------------------------------------------------------------
diff --git a/samples/applications/group-cartridges/artifacts/application.json b/samples/applications/group-cartridges/artifacts/application.json
index 77fd774..8a82371 100644
--- a/samples/applications/group-cartridges/artifacts/application.json
+++ b/samples/applications/group-cartridges/artifacts/application.json
@@ -1,6 +1,6 @@
{
- "applicationId": "single_group_v3",
- "alias": "single_group_v3",
+ "applicationId": "group-cartridges",
+ "alias": "my-group-cartridges",
"components": {
"cartridges":[
{
@@ -8,8 +8,9 @@
"cartridgeMin": 1,
"cartridgeMax": 2,
"subscribableInfo": {
- "alias": "mytomcat",
+ "alias": "my-tomcat1",
"autoscalingPolicy": "autoscaling-policy-1",
+ "deploymentPolicy":"deployment-policy-2",
"artifactRepository":{
"privateRepo":false,
"repoUrl":"https://github.com/imesh/stratos-tomcat1-applications.git",
@@ -22,9 +23,10 @@
"type":"mysql",
"cartridgeMin": 1,
"cartridgeMax": 10,
- "subscribableInfo":{
- "alias":"mymysql",
+ "subscribableInfo":{
+ "alias":"my-mysql",
"autoscalingPolicy":"autoscaling-policy-1",
+ "deploymentPolicy":"deployment-policy-2",
"artifactRepository":{
"privateRepo":false,
"repoUrl":"",
@@ -37,7 +39,7 @@
],
"dependencies": {
"startupOrders": [
- "cartridge.mysql,cartridge.tomcat1"
+ "cartridge.my-mysql,cartridge.my-tomcat1"
],
"terminationBehaviour": "terminate-all"
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/530880a6/samples/applications/group-cartridges/artifacts/autoscaling-policy.json
----------------------------------------------------------------------
diff --git a/samples/applications/group-cartridges/artifacts/autoscaling-policy.json b/samples/applications/group-cartridges/artifacts/autoscaling-policy.json
deleted file mode 100755
index 830ae17..0000000
--- a/samples/applications/group-cartridges/artifacts/autoscaling-policy.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "id": "autoscaling-policy-1",
- "loadThresholds": {
- "requestsInFlight": {
- "upperLimit": 80
- },
- "memoryConsumption": {
- "upperLimit": 90
- },
- "loadAverage": {
- "upperLimit": 50
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/530880a6/samples/applications/group-cartridges/artifacts/deployment-policy.json
----------------------------------------------------------------------
diff --git a/samples/applications/group-cartridges/artifacts/deployment-policy.json b/samples/applications/group-cartridges/artifacts/deployment-policy.json
deleted file mode 100644
index d858aed..0000000
--- a/samples/applications/group-cartridges/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
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/530880a6/samples/applications/group-cartridges/artifacts/ec2/deployment-policy.json
----------------------------------------------------------------------
diff --git a/samples/applications/group-cartridges/artifacts/ec2/deployment-policy.json b/samples/applications/group-cartridges/artifacts/ec2/deployment-policy.json
deleted file mode 100644
index 2665e2e..0000000
--- a/samples/applications/group-cartridges/artifacts/ec2/deployment-policy.json
+++ /dev/null
@@ -1,41 +0,0 @@
-{
- "applicationId": "single_group_v3",
- "applicationPolicy": {
- "networkPartition": [
- {
- "id": "network-partition-1",
- "activeByDefault": "true",
- "partitions": [
- {
- "id": "partition-1",
- "provider": "ec2",
- "property": [
- {
- "name": "region",
- "value": "ap-southeast-1"
- }
- ]
- }
- ]
- }
- ]
- },
- "childPolicies": [
- {
- "alias": "mygroup6",
- "networkPartition": [
- {
- "id": "network-partition-1",
- "partitionAlgo": "one-after-another",
- "partitions": [
- {
- "id": "partition-1",
- "max": 5
- }
- ]
- }
- ]
- }
- ]
-}
-
http://git-wip-us.apache.org/repos/asf/stratos/blob/530880a6/samples/applications/group-cartridges/artifacts/kubernetes/deployment-policy.json
----------------------------------------------------------------------
diff --git a/samples/applications/group-cartridges/artifacts/kubernetes/deployment-policy.json b/samples/applications/group-cartridges/artifacts/kubernetes/deployment-policy.json
deleted file mode 100644
index c12e444..0000000
--- a/samples/applications/group-cartridges/artifacts/kubernetes/deployment-policy.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "applicationId": "single_group_v3",
- "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": "mygroup6",
- "networkPartition": [
- {
- "id": "network-partition-1",
- "partitionAlgo": "one-after-another",
- "partitions": [
- {
- "id": "partition-1",
- "max": 5
- }
- ]
- }
- ]
- }
- ]
-}
-
http://git-wip-us.apache.org/repos/asf/stratos/blob/530880a6/samples/applications/group-cartridges/artifacts/kubernetes/kubernetes-cluster.json
----------------------------------------------------------------------
diff --git a/samples/applications/group-cartridges/artifacts/kubernetes/kubernetes-cluster.json b/samples/applications/group-cartridges/artifacts/kubernetes/kubernetes-cluster.json
deleted file mode 100644
index 2988ed1..0000000
--- a/samples/applications/group-cartridges/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"
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/530880a6/samples/applications/group-cartridges/artifacts/mock/deployment-policy.json
----------------------------------------------------------------------
diff --git a/samples/applications/group-cartridges/artifacts/mock/deployment-policy.json b/samples/applications/group-cartridges/artifacts/mock/deployment-policy.json
deleted file mode 100644
index 26c684a..0000000
--- a/samples/applications/group-cartridges/artifacts/mock/deployment-policy.json
+++ /dev/null
@@ -1,56 +0,0 @@
-{
- "applicationId": "single_group_v3",
- "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": "mymysql",
- "networkPartition": [
- {
- "id": "network-partition-1",
- "partitionAlgo": "one-after-another",
- "partitions": [
- {
- "id": "partition-1",
- "max": 5
- }
- ]
- }
- ]
- }
- ]
-}
-
http://git-wip-us.apache.org/repos/asf/stratos/blob/530880a6/samples/applications/group-cartridges/artifacts/openstack/deployment-policy.json
----------------------------------------------------------------------
diff --git a/samples/applications/group-cartridges/artifacts/openstack/deployment-policy.json b/samples/applications/group-cartridges/artifacts/openstack/deployment-policy.json
deleted file mode 100644
index 13df308..0000000
--- a/samples/applications/group-cartridges/artifacts/openstack/deployment-policy.json
+++ /dev/null
@@ -1,41 +0,0 @@
-{
- "applicationId": "single_group_v3",
- "applicationPolicy": {
- "networkPartition": [
- {
- "id": "network-partition-1",
- "activeByDefault": "true",
- "partitions": [
- {
- "id": "partition-1",
- "provider": "openstack",
- "property": [
- {
- "name": "region",
- "value": "RegionOne"
- }
- ]
- }
- ]
- }
- ]
- },
- "childPolicies": [
- {
- "alias": "mygroup6",
- "networkPartition": [
- {
- "id": "network-partition-1",
- "partitionAlgo": "one-after-another",
- "partitions": [
- {
- "id": "partition-1",
- "max": 5
- }
- ]
- }
- ]
- }
- ]
-}
-
http://git-wip-us.apache.org/repos/asf/stratos/blob/530880a6/samples/applications/group-cartridges/scripts/common/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/group-cartridges/scripts/common/deploy.sh b/samples/applications/group-cartridges/scripts/common/deploy.sh
index 8bef5fc..74be5ec 100755
--- a/samples/applications/group-cartridges/scripts/common/deploy.sh
+++ b/samples/applications/group-cartridges/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,9 +22,17 @@ 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 network partitions..."
+curl -X POST -H "Content-Type: application/json" -d "@${network_partitions_path}/network-partition-1.json" -k -v -u admin:admin https://${host_ip}:9443/api/networkPartitions
+curl -X POST -H "Content-Type: application/json" -d "@${network_partitions_path}/network-partition-2.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-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/deploymentPolicies
+curl -X POST -H "Content-Type: application/json" -d "@${deployment_policies_path}/deployment-policy-2.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/deploymentPolicies
echo "Adding tomcat cartridge..."
curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/mysql.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges
@@ -43,4 +54,4 @@ curl -X POST -H "Content-Type: application/json" -d "@${artifacts_path}/applicat
sleep 1
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_v3/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/group-cartridges/deploy
http://git-wip-us.apache.org/repos/asf/stratos/blob/530880a6/samples/applications/group-cartridges/scripts/common/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/group-cartridges/scripts/common/undeploy.sh b/samples/applications/group-cartridges/scripts/common/undeploy.sh
index 3ad5810..d7e24d6 100644
--- a/samples/applications/group-cartridges/scripts/common/undeploy.sh
+++ b/samples/applications/group-cartridges/scripts/common/undeploy.sh
@@ -6,12 +6,12 @@ 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_v3/undeploy
+curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/group-cartridges/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_v3
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/group-cartridges
echo "Removing groups..."
curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups/group8
@@ -23,4 +23,13 @@ curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://
curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/tomcat2
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-1
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/deploymentPolicies/deployment-policy-2
+
+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-1
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions/network-partition-2
+