http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/deploy.sh b/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/deploy.sh deleted file mode 100755 index 07d84e8..0000000 --- a/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/deploy.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash - -iaas=$1 -host_ip="localhost" -host_port=9443 - -prgdir=`dirname "$0"` -script_path=`cd "$prgdir"; pwd` - -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` -application_policies_path=`cd "${script_path}/../../../../application-policies"; pwd` - -set -e - -if [[ -z "${iaas}" ]]; then - echo "Usage: deploy.sh [iaas]" - exit -fi - -echo ${autoscaling_policies_path}/autoscaling-policy-1.json -echo "Adding autoscale policy..." -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}:${host_port}/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}:${host_port}/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 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 -curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/postgres.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges -curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/esb.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges -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 php cartridge..." -curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/php.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges - -echo "Adding mysql-php-group group..." -curl -X POST -H "Content-Type: application/json" -d "@${cartridges_groups_path}/app-group.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups -curl -X POST -H "Content-Type: application/json" -d "@${cartridges_groups_path}/db-group.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups - -sleep 1 - -echo "Adding application policy..." -curl -X POST -H "Content-Type: application/json" -d "@${application_policies_path}/application-policy-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applicationPolicies - -sleep 1 - -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 - -sleep 1 - -echo "Deploying application..." -curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/my-compositeapp/deploy/application-policy-1 -
http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/get-application-runtime.sh ---------------------------------------------------------------------- diff --git a/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/get-application-runtime.sh b/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/get-application-runtime.sh deleted file mode 100755 index ed80688..0000000 --- a/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/get-application-runtime.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -iaas=$1 -host_ip="localhost" -host_port=9443 - -set -e - -echo "Getting application runtime..." -curl -X GET -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/single-cartridge-app/runtime http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/list-domain-mappings.sh ---------------------------------------------------------------------- diff --git a/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/list-domain-mappings.sh b/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/list-domain-mappings.sh deleted file mode 100755 index 0b49f6f..0000000 --- a/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/list-domain-mappings.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -echo "Listing domain mappings..." -curl -X GET -H "Content-Type: application/json" -k -u admin:admin https://localhost:9443/api/applications/single-cartridge-app/domainMappings \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/list-network-partition.sh ---------------------------------------------------------------------- diff --git a/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/list-network-partition.sh b/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/list-network-partition.sh deleted file mode 100755 index 6e3812d..0000000 --- a/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/list-network-partition.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -echo "Listing network partitions..." -curl -X GET -H "Content-Type: application/json" -k -u admin:admin https://localhost:9443/api/networkPartitions \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/undeploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/undeploy.sh b/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/undeploy.sh deleted file mode 100644 index 54613ed..0000000 --- a/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/undeploy.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -host_ip="localhost" -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/my-compositeapp/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/my-compositeapp - -echo "Removing cartridges..." -curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/php -curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/postgres -curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/mysql -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/esb - - -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 - -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 - -echo "Removing application policies..." -curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applicationPolicies/application-policy-1 - http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/update-deployment-policy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/update-deployment-policy.sh b/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/update-deployment-policy.sh deleted file mode 100755 index f0bd8fb..0000000 --- a/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/update-deployment-policy.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -iaas=$1 -host_ip="localhost" -host_port=9443 - -script_path=`cd "$prgdir"; pwd` - -deployment_policies_path=`cd "${script_path}/../../../../deployment-policies"; pwd` - -curl -X PUT -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 - http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/mock/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/mock/deploy.sh b/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/mock/deploy.sh deleted file mode 100755 index 93f8517..0000000 --- a/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/mock/deploy.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -iaas="mock" - -prgdir=`dirname "$0"` -script_path=`cd "$prgdir"; pwd` -common_folder=`cd "${script_path}/../common"; pwd` - -bash ${common_folder}/deploy.sh ${iaas} http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/mock/undeploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/mock/undeploy.sh b/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/mock/undeploy.sh deleted file mode 100755 index 17d8c71..0000000 --- a/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/mock/undeploy.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -prgdir=`dirname "$0"` -script_path=`cd "$prgdir"; pwd` -common_folder=`cd "${script_path}/../common"; pwd` - -bash ${common_folder}/undeploy.sh http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/app-bursting-pattern/README.md ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/app-bursting-pattern/README.md b/samples/applications/scaling/app-bursting-pattern/README.md new file mode 100644 index 0000000..8e18c5c --- /dev/null +++ b/samples/applications/scaling/app-bursting-pattern/README.md @@ -0,0 +1,8 @@ +app-bursting-pattern +================ +i) In this artifact sample you can find we have listed them as mock and openstack. + +ii) In this sample artifact, it deployed simple tomcat cartridge and start it. + +iii) You can choose the IaaS and navigate to it and simply run the single_cartridge.sh file. It'll deploy the relevant artifacts and start the application. + http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/app-bursting-pattern/artifacts/application-signup.json ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/app-bursting-pattern/artifacts/application-signup.json b/samples/applications/scaling/app-bursting-pattern/artifacts/application-signup.json new file mode 100644 index 0000000..138648e --- /dev/null +++ b/samples/applications/scaling/app-bursting-pattern/artifacts/application-signup.json @@ -0,0 +1,18 @@ +{ + "artifactRepositories":[ + { + "alias":"php", + "privateRepo":false, + "repoUrl":"https://github.com/imesh/stratos-php-applications.git", + "repoUsername":"", + "repoPassword":"" + }, + { + "alias":"tomcat", + "privateRepo":false, + "repoUrl":"https://github.com/imesh/stratos-tomcat-applications.git", + "repoUsername":"", + "repoPassword":"" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/app-bursting-pattern/artifacts/application.json ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/app-bursting-pattern/artifacts/application.json b/samples/applications/scaling/app-bursting-pattern/artifacts/application.json new file mode 100644 index 0000000..1cb3e57 --- /dev/null +++ b/samples/applications/scaling/app-bursting-pattern/artifacts/application.json @@ -0,0 +1,25 @@ +{ + "applicationId":"app-bursting-pattern-app", + "alias":"app-bursting-pattern-app", + "multiTenant":false, + "components":{ + "cartridges":[ + { + "type":"php", + "cartridgeMin": 1, + "cartridgeMax": 10, + "subscribableInfo":{ + "alias":"my-php", + "autoscalingPolicy":"autoscaling-policy-1", + "deploymentPolicy":"deployment-policy-4", + "artifactRepository":{ + "privateRepo":false, + "repoUrl":"https://github.com/imesh/stratos-php-applications.git", + "repoUsername":"", + "repoPassword":"" + } + } + } + ] + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/app-bursting-pattern/artifacts/domain-mappings.json ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/app-bursting-pattern/artifacts/domain-mappings.json b/samples/applications/scaling/app-bursting-pattern/artifacts/domain-mappings.json new file mode 100644 index 0000000..17ee4f6 --- /dev/null +++ b/samples/applications/scaling/app-bursting-pattern/artifacts/domain-mappings.json @@ -0,0 +1,9 @@ +{ + "domainMappings": [ + { + "cartridgeAlias":"php1", + "domainName":"abc.com", + "contextPath":"/abc/app" + } + ] +} http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/app-bursting-pattern/scripts/common/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/app-bursting-pattern/scripts/common/deploy.sh b/samples/applications/scaling/app-bursting-pattern/scripts/common/deploy.sh new file mode 100755 index 0000000..41d4d3e --- /dev/null +++ b/samples/applications/scaling/app-bursting-pattern/scripts/common/deploy.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +iaas=$1 +host_ip="localhost" +host_port=9443 + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` + +artifacts_path=`cd "${script_path}/../../artifacts"; pwd` +iaas_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` +application_policies_path=`cd "${script_path}/../../../../../application-policies"; pwd` + +set -e + +if [[ -z "${iaas}" ]]; then + echo "Usage: deploy.sh [iaas]" + exit +fi + +echo ${autoscaling_policies_path}/autoscaling-policy-1.json +echo "Adding autoscale policy..." +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}:${host_port}/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}:${host_port}/api/networkPartitions +curl -X POST -H "Content-Type: application/json" -d "@${network_partitions_path}/network-partition-3.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions +curl -X POST -H "Content-Type: application/json" -d "@${network_partitions_path}/network-partition-4.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions +echo "Adding deployment policy..." +curl -X POST -H "Content-Type: application/json" -d "@${deployment_policies_path}/deployment-policy-4.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/deploymentPolicies + +echo "Adding php cartridge..." +curl -X POST -H "Content-Type: application/json" -d "@${iaas_cartridges_path}/php.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges + +sleep 1 + +echo "Adding application policy..." +curl -X POST -H "Content-Type: application/json" -d "@${application_policies_path}/application-policy-4.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applicationPolicies + +echo "Adding 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 + +sleep 1 + +echo "Deploying application..." +curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/app-bursting-pattern-app/deploy/application-policy-4 http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/app-bursting-pattern/scripts/common/undeploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/app-bursting-pattern/scripts/common/undeploy.sh b/samples/applications/scaling/app-bursting-pattern/scripts/common/undeploy.sh new file mode 100644 index 0000000..2a05ba5 --- /dev/null +++ b/samples/applications/scaling/app-bursting-pattern/scripts/common/undeploy.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +host_ip="localhost" +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/app-bursting-pattern-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/app-bursting-pattern-app + +echo "Removing cartridges..." +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/php + +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 + +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-4 + +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 +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions/network-partition-3 +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions/network-partition-4 + +echo "Removing application policies..." +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applicationPolicies/application-policy-4 + http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/app-bursting-pattern/scripts/ec2/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/app-bursting-pattern/scripts/ec2/deploy.sh b/samples/applications/scaling/app-bursting-pattern/scripts/ec2/deploy.sh new file mode 100755 index 0000000..1370667 --- /dev/null +++ b/samples/applications/scaling/app-bursting-pattern/scripts/ec2/deploy.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +iaas="ec2" + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/deploy.sh ${iaas} http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/app-bursting-pattern/scripts/ec2/undeploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/app-bursting-pattern/scripts/ec2/undeploy.sh b/samples/applications/scaling/app-bursting-pattern/scripts/ec2/undeploy.sh new file mode 100644 index 0000000..17d8c71 --- /dev/null +++ b/samples/applications/scaling/app-bursting-pattern/scripts/ec2/undeploy.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/undeploy.sh http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/app-bursting-pattern/scripts/kubernetes/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/app-bursting-pattern/scripts/kubernetes/deploy.sh b/samples/applications/scaling/app-bursting-pattern/scripts/kubernetes/deploy.sh new file mode 100755 index 0000000..eab754c --- /dev/null +++ b/samples/applications/scaling/app-bursting-pattern/scripts/kubernetes/deploy.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +host_ip="localhost" +host_port=9443 +iaas="kubernetes" + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` +kubernetes_clusters_path=`cd "${script_path}/../../../../../kubernetes-clusters"; pwd` + + +echo "Adding kubernetes cluster..." +curl -X POST -H "Content-Type: application/json" -d "@${kubernetes_clusters_path}/kubernetes-cluster-1.json" -k -u admin:admin https://${host_ip}:${host_port}/api/kubernetesClusters + +bash ${common_folder}/deploy.sh ${iaas} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/app-bursting-pattern/scripts/kubernetes/undeploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/app-bursting-pattern/scripts/kubernetes/undeploy.sh b/samples/applications/scaling/app-bursting-pattern/scripts/kubernetes/undeploy.sh new file mode 100755 index 0000000..0054670 --- /dev/null +++ b/samples/applications/scaling/app-bursting-pattern/scripts/kubernetes/undeploy.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +host_ip="localhost" +host_port=9443 + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/undeploy.sh + +echo "Removing kubernetes cluster..." +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/kubernetesClusters/kubernetes-cluster-1 http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/app-bursting-pattern/scripts/mock/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/app-bursting-pattern/scripts/mock/deploy.sh b/samples/applications/scaling/app-bursting-pattern/scripts/mock/deploy.sh new file mode 100755 index 0000000..93f8517 --- /dev/null +++ b/samples/applications/scaling/app-bursting-pattern/scripts/mock/deploy.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +iaas="mock" + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/deploy.sh ${iaas} http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/app-bursting-pattern/scripts/mock/undeploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/app-bursting-pattern/scripts/mock/undeploy.sh b/samples/applications/scaling/app-bursting-pattern/scripts/mock/undeploy.sh new file mode 100755 index 0000000..17d8c71 --- /dev/null +++ b/samples/applications/scaling/app-bursting-pattern/scripts/mock/undeploy.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/undeploy.sh http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/app-bursting-pattern/scripts/openstack/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/app-bursting-pattern/scripts/openstack/deploy.sh b/samples/applications/scaling/app-bursting-pattern/scripts/openstack/deploy.sh new file mode 100755 index 0000000..4c39959 --- /dev/null +++ b/samples/applications/scaling/app-bursting-pattern/scripts/openstack/deploy.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +iaas="openstack" + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/deploy.sh ${iaas} http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/app-bursting-pattern/scripts/openstack/undeploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/app-bursting-pattern/scripts/openstack/undeploy.sh b/samples/applications/scaling/app-bursting-pattern/scripts/openstack/undeploy.sh new file mode 100644 index 0000000..17d8c71 --- /dev/null +++ b/samples/applications/scaling/app-bursting-pattern/scripts/openstack/undeploy.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/undeploy.sh http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/dependent-scaling/sample-cartridges/README.md ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/dependent-scaling/sample-cartridges/README.md b/samples/applications/scaling/dependent-scaling/sample-cartridges/README.md new file mode 100644 index 0000000..34feba2 --- /dev/null +++ b/samples/applications/scaling/dependent-scaling/sample-cartridges/README.md @@ -0,0 +1,13 @@ +sample-cartridges +================= + +Application folder structure +---------------------------- +-- artifacts/<iaas>/ IaaS specific artifacts +-- scripts/common/ Common scripts for all iaases +-- scripts/<iaas> IaaS specific scripts + +How to run +---------- +cd scripts/<iaas>/ +./deploy.sh http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/dependent-scaling/sample-cartridges/artifacts/application.json ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/dependent-scaling/sample-cartridges/artifacts/application.json b/samples/applications/scaling/dependent-scaling/sample-cartridges/artifacts/application.json new file mode 100644 index 0000000..03fe033 --- /dev/null +++ b/samples/applications/scaling/dependent-scaling/sample-cartridges/artifacts/application.json @@ -0,0 +1,46 @@ +{ + "applicationId": "dependency-scaling-cartridges-app", + "alias": "my-dependency-scaling-cartridges-app", + "components": { + "cartridges": [ + { + "type": "tomcat", + "cartridgeMin": 1, + "cartridgeMax": 2, + "subscribableInfo": { + "alias": "my-tomcat", + "autoscalingPolicy": "autoscaling-policy-1", + "deploymentPolicy":"deployment-policy-1", + "artifactRepository":{ + "privateRepo":false, + "repoUrl":"https://github.com/imesh/stratos-tomcat-applications.git", + "repoUsername":"", + "repoPassword":"" + } + } + }, + { + "type": "php", + "cartridgeMin": 2, + "cartridgeMax": 4, + "subscribableInfo": { + "alias": "my-php", + "autoscalingPolicy": "autoscaling-policy-1", + "deploymentPolicy":"deployment-policy-1", + "artifactRepository":{ + "privateRepo":false, + "repoUrl":"https://github.com/imesh/stratos-php-applications.git", + "repoUsername":"", + "repoPassword":"" + } + } + } + ], + "dependencies": { + "scalingDependants": [ + "cartridge.my-tomcat, cartridge.my-php" + ], + "terminationBehaviour": "terminate-none" + } + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/common/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/common/deploy.sh b/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/common/deploy.sh new file mode 100755 index 0000000..d0c5dbb --- /dev/null +++ b/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/common/deploy.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +iaas=$1 +host_ip="localhost" +host_port=9443 + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` + +artifacts_path=`cd "${script_path}/../../artifacts"; pwd` +cartridges_path=`cd "${script_path}/../../../../../../cartridges/${iaas}"; 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` +application_policies_path=`cd "${script_path}/../../../../../../application-policies"; pwd` + +set -e + +if [[ -z "${iaas}" ]]; then + echo "Usage: deploy.sh [iaas]" + exit +fi + +echo ${autoscaling_policies_path}/autoscaling-policy-1.json +echo "Adding autoscale policy..." +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}:${host_port}/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 + +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 php cartridge..." +curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/php.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges + +sleep 1 +echo "Adding application policy..." +curl -X POST -H "Content-Type: application/json" -d "@${application_policies_path}/application-policy-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applicationPolicies + + +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 + +sleep 1 + +echo "Deploying application..." + +curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/dependency-scaling-cartridges-app/deploy/application-policy-1 + http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/common/undeploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/common/undeploy.sh b/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/common/undeploy.sh new file mode 100644 index 0000000..79ce013 --- /dev/null +++ b/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/common/undeploy.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +host_ip="localhost" +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/sample-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/sample-cartridges-app + +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/php + +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 http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/ec2/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/ec2/deploy.sh b/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/ec2/deploy.sh new file mode 100755 index 0000000..1370667 --- /dev/null +++ b/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/ec2/deploy.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +iaas="ec2" + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/deploy.sh ${iaas} http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/ec2/undeploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/ec2/undeploy.sh b/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/ec2/undeploy.sh new file mode 100644 index 0000000..17d8c71 --- /dev/null +++ b/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/ec2/undeploy.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/undeploy.sh http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/kubernetes/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/kubernetes/deploy.sh b/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/kubernetes/deploy.sh new file mode 100755 index 0000000..32eff3c --- /dev/null +++ b/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/kubernetes/deploy.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +host_ip="localhost" +host_port=9443 +iaas="kubernetes" + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` +iaas_artifacts_path=`cd "${script_path}/../../artifacts/${iaas}"; pwd` + +echo "Adding kubernetes cluster..." +curl -X POST -H "Content-Type: application/json" -d "@${iaas_artifacts_path}/kubernetes-cluster.json" -k -u admin:admin https://${host_ip}:${host_port}/api/kubernetesClusters + +bash ${common_folder}/deploy.sh ${iaas} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/kubernetes/undeploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/kubernetes/undeploy.sh b/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/kubernetes/undeploy.sh new file mode 100644 index 0000000..0054670 --- /dev/null +++ b/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/kubernetes/undeploy.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +host_ip="localhost" +host_port=9443 + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/undeploy.sh + +echo "Removing kubernetes cluster..." +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/kubernetesClusters/kubernetes-cluster-1 http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/mock/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/mock/deploy.sh b/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/mock/deploy.sh new file mode 100755 index 0000000..93f8517 --- /dev/null +++ b/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/mock/deploy.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +iaas="mock" + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/deploy.sh ${iaas} http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/mock/undeploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/mock/undeploy.sh b/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/mock/undeploy.sh new file mode 100755 index 0000000..17d8c71 --- /dev/null +++ b/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/mock/undeploy.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/undeploy.sh http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/openstack/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/openstack/deploy.sh b/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/openstack/deploy.sh new file mode 100755 index 0000000..4c39959 --- /dev/null +++ b/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/openstack/deploy.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +iaas="openstack" + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/deploy.sh ${iaas} http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/openstack/undeploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/openstack/undeploy.sh b/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/openstack/undeploy.sh new file mode 100644 index 0000000..17d8c71 --- /dev/null +++ b/samples/applications/scaling/dependent-scaling/sample-cartridges/scripts/openstack/undeploy.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/undeploy.sh http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/dependent-scaling/sample-groups/README.md ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/dependent-scaling/sample-groups/README.md b/samples/applications/scaling/dependent-scaling/sample-groups/README.md new file mode 100644 index 0000000..d1adf79 --- /dev/null +++ b/samples/applications/scaling/dependent-scaling/sample-groups/README.md @@ -0,0 +1,13 @@ +sample-groups +============= + +Application folder structure +---------------------------- +-- artifacts/<iaas>/ IaaS specific artifacts +-- scripts/common/ Common scripts for all iaases +-- scripts/<iaas> IaaS specific scripts + +How to run +---------- +cd scripts/<iaas>/ +./deploy.sh http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/dependent-scaling/sample-groups/artifacts/application.json ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/dependent-scaling/sample-groups/artifacts/application.json b/samples/applications/scaling/dependent-scaling/sample-groups/artifacts/application.json new file mode 100644 index 0000000..f261596 --- /dev/null +++ b/samples/applications/scaling/dependent-scaling/sample-groups/artifacts/application.json @@ -0,0 +1,74 @@ +{ + "applicationId": "dependency-scaling-groups-app", + "alias": "my-dependency-scaling-groups-app", + "components": { + "groups": [ + { + "name": "esb-php-group", + "alias": "my-esb-php-group", + "groupMinInstances": 1, + "groupMaxInstances": 2, + "deploymentPolicy": "deployment-policy-1", + "cartridges": [ + { + "type": "esb", + "cartridgeMin": 1, + "cartridgeMax": 2, + "subscribableInfo": { + "alias": "my-esb", + "autoscalingPolicy": "autoscaling-policy-1", + "deploymentPolicy":"deployment-policy-1", + "artifactRepository":{ + "privateRepo":false, + "repoUrl":"https://github.com/imesh/stratos-esb-applications.git", + "repoUsername":"", + "repoPassword":"" + } + } + }, + { + "type": "php", + "cartridgeMin": 1, + "cartridgeMax": 2, + "subscribableInfo": { + "alias": "my-php", + "autoscalingPolicy": "autoscaling-policy-1", + "deploymentPolicy":"deployment-policy-1", + "artifactRepository":{ + "privateRepo":false, + "repoUrl":"https://github.com/imesh/stratos-php-applications.git", + "repoUsername":"", + "repoPassword":"" + } + } + } + ] + } + ], + "cartridges": [ + { + "type": "tomcat", + "cartridgeMin": 2, + "cartridgeMax": 4, + "subscribableInfo": { + "alias": "my-tomcat", + "autoscalingPolicy": "autoscaling-policy-1", + "deploymentPolicy":"deployment-policy-1", + "artifactRepository":{ + "privateRepo":false, + "repoUrl":"https://github.com/imesh/stratos-tomcat-applications.git", + "repoUsername":"", + "repoPassword":"" + } + } + } + ], + "dependencies": { + "scalingDependants": [ + "group.my-esb-php-group, cartridge.my-tomcat" + ], + "terminationBehaviour": "terminate-none" + } + } +} + http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/dependent-scaling/sample-groups/scripts/common/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/dependent-scaling/sample-groups/scripts/common/deploy.sh b/samples/applications/scaling/dependent-scaling/sample-groups/scripts/common/deploy.sh new file mode 100755 index 0000000..7f093d0 --- /dev/null +++ b/samples/applications/scaling/dependent-scaling/sample-groups/scripts/common/deploy.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +iaas=$1 +host_ip="localhost" +host_port=9443 + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` + +artifacts_path=`cd "${script_path}/../../artifacts"; 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` +application_policies_path=`cd "${script_path}/../../../../../../application-policies"; pwd` + +set -e + +if [[ -z "${iaas}" ]]; then + echo "Usage: deploy.sh [iaas]" + exit +fi + +echo ${autoscaling_policies_path}/autoscaling-policy-1.json +echo "Adding autoscale policy..." +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 + +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 + +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 esb cartridge..." +curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/esb.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges + +echo "Adding php cartridge..." +curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/php.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges + +echo "Adding esb-php-group group..." +curl -X POST -H "Content-Type: application/json" -d "@${cartridges_groups_path}/esb-php-group.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups + +sleep 1 +echo "Adding application policy..." +curl -X POST -H "Content-Type: application/json" -d "@${application_policies_path}/application-policy-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applicationPolicies + +sleep 1 +echo "Adding 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 + +sleep 1 +echo "Deploying application..." +curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/dependency-scaling-groups-app/deploy/application-policy-1 + http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/dependent-scaling/sample-groups/scripts/common/undeploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/dependent-scaling/sample-groups/scripts/common/undeploy.sh b/samples/applications/scaling/dependent-scaling/sample-groups/scripts/common/undeploy.sh new file mode 100644 index 0000000..a69d60d --- /dev/null +++ b/samples/applications/scaling/dependent-scaling/sample-groups/scripts/common/undeploy.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +host_ip="localhost" +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/dependency-scaling-groups-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/dependency-scaling-groups-app + +echo "Removing groups..." +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups/esb-php-group + +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/esb +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/php + +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 http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/dependent-scaling/sample-groups/scripts/ec2/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/dependent-scaling/sample-groups/scripts/ec2/deploy.sh b/samples/applications/scaling/dependent-scaling/sample-groups/scripts/ec2/deploy.sh new file mode 100755 index 0000000..1370667 --- /dev/null +++ b/samples/applications/scaling/dependent-scaling/sample-groups/scripts/ec2/deploy.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +iaas="ec2" + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/deploy.sh ${iaas} http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/dependent-scaling/sample-groups/scripts/ec2/undeploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/dependent-scaling/sample-groups/scripts/ec2/undeploy.sh b/samples/applications/scaling/dependent-scaling/sample-groups/scripts/ec2/undeploy.sh new file mode 100644 index 0000000..17d8c71 --- /dev/null +++ b/samples/applications/scaling/dependent-scaling/sample-groups/scripts/ec2/undeploy.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/undeploy.sh http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/dependent-scaling/sample-groups/scripts/kubernetes/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/dependent-scaling/sample-groups/scripts/kubernetes/deploy.sh b/samples/applications/scaling/dependent-scaling/sample-groups/scripts/kubernetes/deploy.sh new file mode 100755 index 0000000..32eff3c --- /dev/null +++ b/samples/applications/scaling/dependent-scaling/sample-groups/scripts/kubernetes/deploy.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +host_ip="localhost" +host_port=9443 +iaas="kubernetes" + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` +iaas_artifacts_path=`cd "${script_path}/../../artifacts/${iaas}"; pwd` + +echo "Adding kubernetes cluster..." +curl -X POST -H "Content-Type: application/json" -d "@${iaas_artifacts_path}/kubernetes-cluster.json" -k -u admin:admin https://${host_ip}:${host_port}/api/kubernetesClusters + +bash ${common_folder}/deploy.sh ${iaas} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/dependent-scaling/sample-groups/scripts/kubernetes/undeploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/dependent-scaling/sample-groups/scripts/kubernetes/undeploy.sh b/samples/applications/scaling/dependent-scaling/sample-groups/scripts/kubernetes/undeploy.sh new file mode 100644 index 0000000..0054670 --- /dev/null +++ b/samples/applications/scaling/dependent-scaling/sample-groups/scripts/kubernetes/undeploy.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +host_ip="localhost" +host_port=9443 + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/undeploy.sh + +echo "Removing kubernetes cluster..." +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/kubernetesClusters/kubernetes-cluster-1 http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/dependent-scaling/sample-groups/scripts/mock/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/dependent-scaling/sample-groups/scripts/mock/deploy.sh b/samples/applications/scaling/dependent-scaling/sample-groups/scripts/mock/deploy.sh new file mode 100755 index 0000000..93f8517 --- /dev/null +++ b/samples/applications/scaling/dependent-scaling/sample-groups/scripts/mock/deploy.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +iaas="mock" + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/deploy.sh ${iaas} http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/dependent-scaling/sample-groups/scripts/mock/undeploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/dependent-scaling/sample-groups/scripts/mock/undeploy.sh b/samples/applications/scaling/dependent-scaling/sample-groups/scripts/mock/undeploy.sh new file mode 100755 index 0000000..17d8c71 --- /dev/null +++ b/samples/applications/scaling/dependent-scaling/sample-groups/scripts/mock/undeploy.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/undeploy.sh http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/dependent-scaling/sample-groups/scripts/openstack/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/dependent-scaling/sample-groups/scripts/openstack/deploy.sh b/samples/applications/scaling/dependent-scaling/sample-groups/scripts/openstack/deploy.sh new file mode 100755 index 0000000..4c39959 --- /dev/null +++ b/samples/applications/scaling/dependent-scaling/sample-groups/scripts/openstack/deploy.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +iaas="openstack" + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/deploy.sh ${iaas} http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/dependent-scaling/sample-groups/scripts/openstack/undeploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/dependent-scaling/sample-groups/scripts/openstack/undeploy.sh b/samples/applications/scaling/dependent-scaling/sample-groups/scripts/openstack/undeploy.sh new file mode 100644 index 0000000..17d8c71 --- /dev/null +++ b/samples/applications/scaling/dependent-scaling/sample-groups/scripts/openstack/undeploy.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/undeploy.sh http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/group-scaling/group-scaling-app/README.md ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/group-scaling/group-scaling-app/README.md b/samples/applications/scaling/group-scaling/group-scaling-app/README.md new file mode 100644 index 0000000..1443d02 --- /dev/null +++ b/samples/applications/scaling/group-scaling/group-scaling-app/README.md @@ -0,0 +1,18 @@ +Group Scaling +=========== + +Application folder structure +---------------------------- +-- artifacts/<iaas>/ IaaS specific artifacts +-- scripts/common/ Common scripts for all iaases +-- scripts/<iaas> IaaS specific scripts + +How to run +---------- +cd scripts/<iaas>/ +./deploy.sh + +How to undeploy +--------------- +cd scripts/<iaas>/ +./undeploy.sh \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/group-scaling/group-scaling-app/artifacts/application.json ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/group-scaling/group-scaling-app/artifacts/application.json b/samples/applications/scaling/group-scaling/group-scaling-app/artifacts/application.json new file mode 100644 index 0000000..c2b3f3c --- /dev/null +++ b/samples/applications/scaling/group-scaling/group-scaling-app/artifacts/application.json @@ -0,0 +1,97 @@ +{ + "applicationId": "group-scaling", + "alias": "my-group-scaling", + "components": { + "groups": [ + { + "name": "group1", + "alias": "my-group1", + "groupMinInstances": 1, + "groupMaxInstances": 1, + "deploymentPolicy":"deployment-policy-1", + "groups": [ + { + "name": "group2", + "alias": "my-group2", + "groupMinInstances": 1, + "groupMaxInstances": 2, + "cartridges": [ + { + "type": "c2", + "cartridgeMin": 2, + "cartridgeMax": 4, + "subscribableInfo": { + "alias": "my-c2-group2", + "autoscalingPolicy": "autoscaling-policy-c2", + "artifactRepository":{ + "privateRepo":false, + "repoUrl":"https://github.com/imesh/stratos-c2-applications.git", + "repoUsername":"", + "repoPassword":"" + } + } + }, + { + "type": "c3", + "cartridgeMin": 1, + "cartridgeMax": 2, + "subscribableInfo": { + "alias": "my-c3-group2", + "autoscalingPolicy": "autoscaling-policy-c3", + "artifactRepository":{ + "privateRepo":false, + "repoUrl":"https://github.com/imesh/stratos-c3-applications.git", + "repoUsername":"", + "repoPassword":"" + } + } + } + ] + } + ], + "cartridges": [ + { + "type": "c1", + "cartridgeMin": 2, + "cartridgeMax": 4, + "subscribableInfo": { + "alias": "my-c1-group1", + "autoscalingPolicy": "autoscaling-policy-c1", + "artifactRepository":{ + "privateRepo":false, + "repoUrl":"https://github.com/imesh/stratos-c1-applications.git", + "repoUsername":"", + "repoPassword":"" + } + } + } + ] + } + ], + "cartridges": [ + { + "type": "c4", + "cartridgeMin": 1, + "cartridgeMax": 2, + "subscribableInfo": { + "alias": "my-c4", + "autoscalingPolicy": "autoscaling-policy-c4", + "deploymentPolicy":"deployment-policy-1", + "artifactRepository":{ + "privateRepo":false, + "repoUrl":"https://github.com/imesh/stratos-c4-applications.git", + "repoUsername":"", + "repoPassword":"" + } + } + } + ], + "dependencies": { + "startupOrders": [ + "group.my-group1,cartridge.my-c4" + ], + "terminationBehaviour": "terminate-dependents" + } + } +} + http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/group-scaling/group-scaling-app/scripts/common/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/group-scaling/group-scaling-app/scripts/common/deploy.sh b/samples/applications/scaling/group-scaling/group-scaling-app/scripts/common/deploy.sh new file mode 100644 index 0000000..9a10248 --- /dev/null +++ b/samples/applications/scaling/group-scaling/group-scaling-app/scripts/common/deploy.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +iaas=$1 +host_ip="localhost" +host_port=9443 + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` + +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` +application_policies_path=`cd "${script_path}/../../../../../application-policies"; pwd` + +set -e + +if [[ -z "${iaas}" ]]; then + echo "Usage: deploy.sh [iaas]" + exit +fi + +echo "Adding autoscaling policy c1..." +curl -X POST -H "Content-Type: application/json" -d "@${autoscaling_policies_path}/autoscaling-policy-c1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies + +echo "Adding autoscaling policy c2..." +curl -X POST -H "Content-Type: application/json" -d "@${autoscaling_policies_path}/autoscaling-policy-c2.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies + +echo "Adding autoscaling policy c3..." +curl -X POST -H "Content-Type: application/json" -d "@${autoscaling_policies_path}/autoscaling-policy-c3.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies + +echo "Adding autoscaling policy c4..." +curl -X POST -H "Content-Type: application/json" -d "@${autoscaling_policies_path}/autoscaling-policy-c4.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}:${host_port}/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 + +echo "Adding c1 cartridge..." +curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/c1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges + +echo "Adding c2 cartridge..." +curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/c2.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges + +echo "Adding c3 cartridge..." +curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/c3.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges + +echo "Adding c4 cartridge..." +curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/c4.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges + +echo "Adding group1 group..." +curl -X POST -H "Content-Type: application/json" -d "@${cartridges_groups_path}/group1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups + +sleep 1 + +echo "Adding application policy..." +curl -X POST -H "Content-Type: application/json" -d "@${application_policies_path}/application-policy-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applicationPolicies + +sleep 1 + +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 + +sleep 1 + +echo "Deploying application..." +curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/group-scaling/deploy/application-policy-1 http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/group-scaling/group-scaling-app/scripts/common/undeploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/group-scaling/group-scaling-app/scripts/common/undeploy.sh b/samples/applications/scaling/group-scaling/group-scaling-app/scripts/common/undeploy.sh new file mode 100644 index 0000000..599e6d7 --- /dev/null +++ b/samples/applications/scaling/group-scaling/group-scaling-app/scripts/common/undeploy.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +host_ip="localhost" +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/group-scaling/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/group-scaling + +echo "Removing groups..." +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups/group1 + +echo "Removing cartridges..." +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/c1 +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/c2 +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/c3 +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/c4 + +echo "Removing autoscaling policies..." +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies/autoscaling-policy-c1 +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies/autoscaling-policy-c2 +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies/autoscaling-policy-c3 +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies/autoscaling-policy-c4 + +echo "Removing application policies..." +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applicationPolicies/application-policy-1 + http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/group-scaling/group-scaling-app/scripts/ec2/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/group-scaling/group-scaling-app/scripts/ec2/deploy.sh b/samples/applications/scaling/group-scaling/group-scaling-app/scripts/ec2/deploy.sh new file mode 100755 index 0000000..1370667 --- /dev/null +++ b/samples/applications/scaling/group-scaling/group-scaling-app/scripts/ec2/deploy.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +iaas="ec2" + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/deploy.sh ${iaas} http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/group-scaling/group-scaling-app/scripts/ec2/undeploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/group-scaling/group-scaling-app/scripts/ec2/undeploy.sh b/samples/applications/scaling/group-scaling/group-scaling-app/scripts/ec2/undeploy.sh new file mode 100644 index 0000000..17d8c71 --- /dev/null +++ b/samples/applications/scaling/group-scaling/group-scaling-app/scripts/ec2/undeploy.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/undeploy.sh http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/group-scaling/group-scaling-app/scripts/kubernetes/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/group-scaling/group-scaling-app/scripts/kubernetes/deploy.sh b/samples/applications/scaling/group-scaling/group-scaling-app/scripts/kubernetes/deploy.sh new file mode 100755 index 0000000..32eff3c --- /dev/null +++ b/samples/applications/scaling/group-scaling/group-scaling-app/scripts/kubernetes/deploy.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +host_ip="localhost" +host_port=9443 +iaas="kubernetes" + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` +iaas_artifacts_path=`cd "${script_path}/../../artifacts/${iaas}"; pwd` + +echo "Adding kubernetes cluster..." +curl -X POST -H "Content-Type: application/json" -d "@${iaas_artifacts_path}/kubernetes-cluster.json" -k -u admin:admin https://${host_ip}:${host_port}/api/kubernetesClusters + +bash ${common_folder}/deploy.sh ${iaas} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/group-scaling/group-scaling-app/scripts/kubernetes/undeploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/group-scaling/group-scaling-app/scripts/kubernetes/undeploy.sh b/samples/applications/scaling/group-scaling/group-scaling-app/scripts/kubernetes/undeploy.sh new file mode 100644 index 0000000..0054670 --- /dev/null +++ b/samples/applications/scaling/group-scaling/group-scaling-app/scripts/kubernetes/undeploy.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +host_ip="localhost" +host_port=9443 + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/undeploy.sh + +echo "Removing kubernetes cluster..." +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/kubernetesClusters/kubernetes-cluster-1 http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/group-scaling/group-scaling-app/scripts/mock/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/group-scaling/group-scaling-app/scripts/mock/deploy.sh b/samples/applications/scaling/group-scaling/group-scaling-app/scripts/mock/deploy.sh new file mode 100755 index 0000000..93f8517 --- /dev/null +++ b/samples/applications/scaling/group-scaling/group-scaling-app/scripts/mock/deploy.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +iaas="mock" + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/deploy.sh ${iaas} http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/group-scaling/group-scaling-app/scripts/mock/undeploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/group-scaling/group-scaling-app/scripts/mock/undeploy.sh b/samples/applications/scaling/group-scaling/group-scaling-app/scripts/mock/undeploy.sh new file mode 100755 index 0000000..17d8c71 --- /dev/null +++ b/samples/applications/scaling/group-scaling/group-scaling-app/scripts/mock/undeploy.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/undeploy.sh http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/group-scaling/group-scaling-app/scripts/openstack/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/group-scaling/group-scaling-app/scripts/openstack/deploy.sh b/samples/applications/scaling/group-scaling/group-scaling-app/scripts/openstack/deploy.sh new file mode 100755 index 0000000..4c39959 --- /dev/null +++ b/samples/applications/scaling/group-scaling/group-scaling-app/scripts/openstack/deploy.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +iaas="openstack" + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/deploy.sh ${iaas} http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/group-scaling/group-scaling-app/scripts/openstack/undeploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/group-scaling/group-scaling-app/scripts/openstack/undeploy.sh b/samples/applications/scaling/group-scaling/group-scaling-app/scripts/openstack/undeploy.sh new file mode 100644 index 0000000..17d8c71 --- /dev/null +++ b/samples/applications/scaling/group-scaling/group-scaling-app/scripts/openstack/undeploy.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/undeploy.sh http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/group-scaling/group-scaling-v1/README.md ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/group-scaling/group-scaling-v1/README.md b/samples/applications/scaling/group-scaling/group-scaling-v1/README.md new file mode 100644 index 0000000..7b09b98 --- /dev/null +++ b/samples/applications/scaling/group-scaling/group-scaling-v1/README.md @@ -0,0 +1,18 @@ +Group Scaling v1 +================ + +Application folder structure +---------------------------- +-- artifacts/<iaas>/ IaaS specific artifacts +-- scripts/common/ Common scripts for all iaases +-- scripts/<iaas> IaaS specific scripts + +How to run +---------- +cd scripts/<iaas>/ +./deploy.sh + +How to undeploy +--------------- +cd scripts/<iaas>/ +./undeploy.sh \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/group-scaling/group-scaling-v1/artifacts/application.json ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/group-scaling/group-scaling-v1/artifacts/application.json b/samples/applications/scaling/group-scaling/group-scaling-v1/artifacts/application.json new file mode 100644 index 0000000..c486e93 --- /dev/null +++ b/samples/applications/scaling/group-scaling/group-scaling-v1/artifacts/application.json @@ -0,0 +1,48 @@ +{ + "applicationId": "group-scaling-v1", + "alias": "my-group-scaling-v1", + "components": { + "groups": [ + { + "name": "group2", + "alias": "my-group2", + "groupMinInstances": 1, + "groupMaxInstances": 2, + "deploymentPolicy":"deployment-policy-1", + "cartridges": [ + { + "type": "c2", + "cartridgeMin": 2, + "cartridgeMax": 4, + "subscribableInfo": { + "alias": "my-c2", + "autoscalingPolicy": "autoscaling-policy-c2", + "artifactRepository":{ + "privateRepo":false, + "repoUrl":"https://github.com/imesh/stratos-c2-applications.git", + "repoUsername":"", + "repoPassword":"" + } + } + }, + { + "type": "c3", + "cartridgeMin": 1, + "cartridgeMax": 2, + "subscribableInfo": { + "alias": "my-c3", + "autoscalingPolicy": "autoscaling-policy-c3", + "artifactRepository":{ + "privateRepo":false, + "repoUrl":"https://github.com/imesh/stratos-c3-applications.git", + "repoUsername":"", + "repoPassword":"" + } + } + } + ] + } + ] + } +} + http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/group-scaling/group-scaling-v1/scripts/common/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/group-scaling/group-scaling-v1/scripts/common/deploy.sh b/samples/applications/scaling/group-scaling/group-scaling-v1/scripts/common/deploy.sh new file mode 100644 index 0000000..f6424b5 --- /dev/null +++ b/samples/applications/scaling/group-scaling/group-scaling-v1/scripts/common/deploy.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +iaas=$1 +host_ip="localhost" +host_port=9443 + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` + +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` +application_policies_path=`cd "${script_path}/../../../../../application-policies"; pwd` + +set -e + +if [[ -z "${iaas}" ]]; then + echo "Usage: deploy.sh [iaas]" + exit +fi + +echo "Adding autoscaling policy c2..." +curl -X POST -H "Content-Type: application/json" -d "@${autoscaling_policies_path}/autoscaling-policy-c2.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies + +echo "Adding autoscaling policy c3..." +curl -X POST -H "Content-Type: application/json" -d "@${autoscaling_policies_path}/autoscaling-policy-c3.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}:${host_port}/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 + +echo "Adding c2 cartridge..." +curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/c2.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges + +echo "Adding c3 cartridge..." +curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/c3.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges + +echo "Adding group1b group..." +curl -X POST -H "Content-Type: application/json" -d "@${cartridges_groups_path}/group1b.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups + +sleep 1 + +echo "Adding application policy..." +curl -X POST -H "Content-Type: application/json" -d "@${application_policies_path}/application-policy-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applicationPolicies + +sleep 1 + +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" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/group-scaling-v1/deploy/application-policy-1 http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/group-scaling/group-scaling-v1/scripts/common/undeploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/group-scaling/group-scaling-v1/scripts/common/undeploy.sh b/samples/applications/scaling/group-scaling/group-scaling-v1/scripts/common/undeploy.sh new file mode 100644 index 0000000..cbca5a0 --- /dev/null +++ b/samples/applications/scaling/group-scaling/group-scaling-v1/scripts/common/undeploy.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +host_ip="localhost" +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/group-scaling-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/group-scaling-v1 + +echo "Removing groups..." +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups/group2 + +echo "Removing cartridges..." +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/c2 +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/c3 + +echo "Removing autoscaling policies..." +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies/autoscaling-policy-c2 +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies/autoscaling-policy-c3 + +echo "Removing application policies..." +curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applicationPolicies/application-policy-1 + http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/group-scaling/group-scaling-v1/scripts/ec2/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/group-scaling/group-scaling-v1/scripts/ec2/deploy.sh b/samples/applications/scaling/group-scaling/group-scaling-v1/scripts/ec2/deploy.sh new file mode 100755 index 0000000..1370667 --- /dev/null +++ b/samples/applications/scaling/group-scaling/group-scaling-v1/scripts/ec2/deploy.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +iaas="ec2" + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/deploy.sh ${iaas} http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/group-scaling/group-scaling-v1/scripts/ec2/undeploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/group-scaling/group-scaling-v1/scripts/ec2/undeploy.sh b/samples/applications/scaling/group-scaling/group-scaling-v1/scripts/ec2/undeploy.sh new file mode 100644 index 0000000..17d8c71 --- /dev/null +++ b/samples/applications/scaling/group-scaling/group-scaling-v1/scripts/ec2/undeploy.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` + +bash ${common_folder}/undeploy.sh http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/scaling/group-scaling/group-scaling-v1/scripts/kubernetes/deploy.sh ---------------------------------------------------------------------- diff --git a/samples/applications/scaling/group-scaling/group-scaling-v1/scripts/kubernetes/deploy.sh b/samples/applications/scaling/group-scaling/group-scaling-v1/scripts/kubernetes/deploy.sh new file mode 100755 index 0000000..32eff3c --- /dev/null +++ b/samples/applications/scaling/group-scaling/group-scaling-v1/scripts/kubernetes/deploy.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +host_ip="localhost" +host_port=9443 +iaas="kubernetes" + +prgdir=`dirname "$0"` +script_path=`cd "$prgdir"; pwd` +common_folder=`cd "${script_path}/../common"; pwd` +iaas_artifacts_path=`cd "${script_path}/../../artifacts/${iaas}"; pwd` + +echo "Adding kubernetes cluster..." +curl -X POST -H "Content-Type: application/json" -d "@${iaas_artifacts_path}/kubernetes-cluster.json" -k -u admin:admin https://${host_ip}:${host_port}/api/kubernetesClusters + +bash ${common_folder}/deploy.sh ${iaas} \ No newline at end of file
