diff --git a/samples/applications/dependent-scaling/sample-groups/scripts/common/deploy.sh b/samples/applications/dependent-scaling/sample-groups/scripts/common/deploy.sh index a4ff8e8477..b41bc58adc 100755 --- a/samples/applications/dependent-scaling/sample-groups/scripts/common/deploy.sh +++ b/samples/applications/dependent-scaling/sample-groups/scripts/common/deploy.sh @@ -51,4 +51,5 @@ 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/dependency-scaling-groups-app/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/dependency-scaling-groups-app/deploy diff --git a/samples/applications/group-cartridges/README.md b/samples/applications/group-cartridges/README.md index 34cfb83be2..8c8f030079 100644 --- a/samples/applications/group-cartridges/README.md +++ b/samples/applications/group-cartridges/README.md @@ -1,4 +1,4 @@ -single_group_v3 +group-cartridges-app =============== Application folder structure 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 0000000000..5aa91dd7a1 --- /dev/null +++ b/samples/applications/group-cartridges/artifacts/application-policy.json @@ -0,0 +1,12 @@ +{ + "networkPartition":[ + { + "id":"network-partition-1", + "activeByDefault":"true" + }, + { + "id":"network-partition-2", + "activeByDefault":"false" + } + ] +} diff --git a/samples/applications/group-cartridges/artifacts/application.json b/samples/applications/group-cartridges/artifacts/application.json index 77fd774262..c31587ecad 100644 --- a/samples/applications/group-cartridges/artifacts/application.json +++ b/samples/applications/group-cartridges/artifacts/application.json @@ -1,43 +1,52 @@ { - "applicationId": "single_group_v3", - "alias": "single_group_v3", + "applicationId": "group-cartridges-app", + "alias": "my-group-cartridges-app", "components": { - "cartridges":[ - { - "type": "tomcat1", - "cartridgeMin": 1, - "cartridgeMax": 2, - "subscribableInfo": { - "alias": "mytomcat", - "autoscalingPolicy": "autoscaling-policy-1", - "artifactRepository":{ - "privateRepo":false, - "repoUrl":"https://github.com/imesh/stratos-tomcat1-applications.git", - "repoUsername":"", - "repoPassword":"" - } - } - }, - { - "type":"mysql", - "cartridgeMin": 1, - "cartridgeMax": 10, - "subscribableInfo":{ - "alias":"mymysql", - "autoscalingPolicy":"autoscaling-policy-1", - "artifactRepository":{ - "privateRepo":false, - "repoUrl":"", - "repoUsername":"", - "repoPassword":"" - } + "groups": [ + { + "name": "tomcat1-mysql-group", + "alias": "my-tomcat1-mysql-group", + "groupMinInstances": 1, + "groupMaxInstances": 2, + "deploymentPolicy": "deployment-policy-1", + "cartridges": [ + { + "type": "tomcat1", + "cartridgeMin": 1, + "cartridgeMax": 2, + "subscribableInfo": { + "alias": "my-tomcat1", + "autoscalingPolicy": "autoscaling-policy-1", + "artifactRepository": { + "privateRepo": false, + "repoUrl": "https://github.com/imesh/stratos-tomcat1-applications.git", + "repoUsername": "", + "repoPassword": "" + } + } + }, + { + "type": "mysql", + "cartridgeMin": 1, + "cartridgeMax": 10, + "subscribableInfo": { + "alias": "my-mysql", + "autoscalingPolicy": "autoscaling-policy-1", + "artifactRepository": { + "privateRepo": false, + "repoUrl": "", + "repoUsername": "", + "repoPassword": "" + } + } + + } + ] } - - } - ], + ], "dependencies": { "startupOrders": [ - "cartridge.mysql,cartridge.tomcat1" + "cartridge.my-tomcat1,cartridge.my-mysql" ], "terminationBehaviour": "terminate-all" } diff --git a/samples/applications/group-cartridges/artifacts/deployment-policy.json b/samples/applications/group-cartridges/artifacts/deployment-policy.json index d858aed9d7..666c2997f8 100644 --- a/samples/applications/group-cartridges/artifacts/deployment-policy.json +++ b/samples/applications/group-cartridges/artifacts/deployment-policy.json @@ -1,5 +1,5 @@ { - "id": "deployment-policy-2", + "id": "deployment-policy-1", "networkPartition": [ { "id": "network-partition-1", 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 2665e2e957..0000000000 --- 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 - } - ] - } - ] - } - ] -} - 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 c12e4447a4..0000000000 --- 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 - } - ] - } - ] - } - ] -} - 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 2988ed1e91..0000000000 --- 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" - } - ] -} 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 26c684a1fb..0000000000 --- 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 - } - ] - } - ] - } - ] -} - 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 13df3085ff..0000000000 --- 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 - } - ] - } - ] - } - ] -} - diff --git a/samples/applications/group-cartridges/scripts/common/deploy.sh b/samples/applications/group-cartridges/scripts/common/deploy.sh index 8bef5fce7c..b6b8da142b 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,21 +22,25 @@ 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 -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 +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 policy..." +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 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 mysql 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 -echo "Adding group6c group..." -curl -X POST -H "Content-Type: application/json" -d "@${cartridges_groups_path}/group6c.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups +echo "Adding tomcat1-mysql-group group..." +curl -X POST -H "Content-Type: application/json" -d "@${cartridges_groups_path}/tomcat1-mysql-group.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups sleep 1 @@ -43,4 +50,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-app/deploy diff --git a/samples/applications/group-cartridges/scripts/common/undeploy.sh b/samples/applications/group-cartridges/scripts/common/undeploy.sh index 3ad581042e..6b7b7b6ead 100644 --- a/samples/applications/group-cartridges/scripts/common/undeploy.sh +++ b/samples/applications/group-cartridges/scripts/common/undeploy.sh @@ -6,15 +6,14 @@ 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-app/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-app echo "Removing groups..." -curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups/group8 curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups/group6 echo "Removing cartridges..." diff --git a/samples/cartridges-groups/tomcat1-mysql-group.json b/samples/cartridges-groups/tomcat1-mysql-group.json new file mode 100644 index 0000000000..b5c0f28365 --- /dev/null +++ b/samples/cartridges-groups/tomcat1-mysql-group.json @@ -0,0 +1,15 @@ +{ + "name": "tomcat1-mysql-group", + "groupScalingEnabled": "true", + "cartridges": [ + "tomcat1", + "mysql" + ], + "dependencies": { + "startupOrders": [ + "cartridge.my-tomcat1,cartridge.my-mysql" + ], + "terminationBehaviour": "terminate-all" + } +} +