You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ra...@apache.org on 2015/03/09 07:40:25 UTC
[3/3] stratos git commit: implementing app-bursting-pattern sample
application
implementing app-bursting-pattern sample application
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/f2f888b7
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/f2f888b7
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/f2f888b7
Branch: refs/heads/master
Commit: f2f888b7ff8e2f7ed0c7da00aac32c6232391277
Parents: b4c76b0
Author: R-Rajkumar <rr...@gmail.com>
Authored: Mon Mar 9 12:09:59 2015 +0530
Committer: R-Rajkumar <rr...@gmail.com>
Committed: Mon Mar 9 12:09:59 2015 +0530
----------------------------------------------------------------------
.../application-policy-4.json | 20 ++++++++
.../applications/app-bursting-pattern/README.md | 8 +++
.../artifacts/application-signup.json | 18 +++++++
.../artifacts/application.json | 25 ++++++++++
.../artifacts/domain-mappings.json | 9 ++++
.../scripts/common/deploy.sh | 51 ++++++++++++++++++++
.../scripts/common/undeploy.sh | 33 +++++++++++++
.../app-bursting-pattern/scripts/ec2/deploy.sh | 9 ++++
.../scripts/ec2/undeploy.sh | 7 +++
.../scripts/kubernetes/deploy.sh | 16 ++++++
.../scripts/kubernetes/undeploy.sh | 13 +++++
.../app-bursting-pattern/scripts/mock/deploy.sh | 9 ++++
.../scripts/mock/undeploy.sh | 7 +++
.../scripts/openstack/deploy.sh | 9 ++++
.../scripts/openstack/undeploy.sh | 7 +++
.../deployment-policy-4.json | 20 ++++++++
.../mock/network-partition-4.json | 15 ++++++
17 files changed, 276 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/f2f888b7/samples/application-policies/application-policy-4.json
----------------------------------------------------------------------
diff --git a/samples/application-policies/application-policy-4.json b/samples/application-policies/application-policy-4.json
new file mode 100644
index 0000000..701aec1
--- /dev/null
+++ b/samples/application-policies/application-policy-4.json
@@ -0,0 +1,20 @@
+{
+ "id": "application-policy-4",
+ "algorithm":"one-after-another",
+ "networkPartitions":[
+ "network-partition-1",
+ "network-partition-2",
+ "network-partition-3",
+ "network-partition-4"
+ ],
+ "properties":[
+ {
+ "name": "networkPartitionGroups",
+ "value": "network-partition-1|network-partition-2,network-partition-3|network-partition-4"
+ },
+ {
+ "name": "key-2",
+ "value": "value-2"
+ },
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/f2f888b7/samples/applications/app-bursting-pattern/README.md
----------------------------------------------------------------------
diff --git a/samples/applications/app-bursting-pattern/README.md b/samples/applications/app-bursting-pattern/README.md
new file mode 100644
index 0000000..7025dff
--- /dev/null
+++ b/samples/applications/app-bursting-pattern/README.md
@@ -0,0 +1,8 @@
+single_cartridge
+================
+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/f2f888b7/samples/applications/app-bursting-pattern/artifacts/application-signup.json
----------------------------------------------------------------------
diff --git a/samples/applications/app-bursting-pattern/artifacts/application-signup.json b/samples/applications/app-bursting-pattern/artifacts/application-signup.json
new file mode 100644
index 0000000..138648e
--- /dev/null
+++ b/samples/applications/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/f2f888b7/samples/applications/app-bursting-pattern/artifacts/application.json
----------------------------------------------------------------------
diff --git a/samples/applications/app-bursting-pattern/artifacts/application.json b/samples/applications/app-bursting-pattern/artifacts/application.json
new file mode 100644
index 0000000..1cb3e57
--- /dev/null
+++ b/samples/applications/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/f2f888b7/samples/applications/app-bursting-pattern/artifacts/domain-mappings.json
----------------------------------------------------------------------
diff --git a/samples/applications/app-bursting-pattern/artifacts/domain-mappings.json b/samples/applications/app-bursting-pattern/artifacts/domain-mappings.json
new file mode 100644
index 0000000..17ee4f6
--- /dev/null
+++ b/samples/applications/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/f2f888b7/samples/applications/app-bursting-pattern/scripts/common/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/app-bursting-pattern/scripts/common/deploy.sh b/samples/applications/app-bursting-pattern/scripts/common/deploy.sh
new file mode 100755
index 0000000..7155c52
--- /dev/null
+++ b/samples/applications/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}: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
+curl -X POST -H "Content-Type: application/json" -d "@${network_partitions_path}/network-partition-3.json" -k -v -u admin:admin https://${host_ip}:9443/api/networkPartitions
+curl -X POST -H "Content-Type: application/json" -d "@${network_partitions_path}/network-partition-4.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-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/f2f888b7/samples/applications/app-bursting-pattern/scripts/common/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/app-bursting-pattern/scripts/common/undeploy.sh b/samples/applications/app-bursting-pattern/scripts/common/undeploy.sh
new file mode 100644
index 0000000..1e7be1a
--- /dev/null
+++ b/samples/applications/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-1
+
+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/f2f888b7/samples/applications/app-bursting-pattern/scripts/ec2/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/app-bursting-pattern/scripts/ec2/deploy.sh b/samples/applications/app-bursting-pattern/scripts/ec2/deploy.sh
new file mode 100755
index 0000000..1370667
--- /dev/null
+++ b/samples/applications/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/f2f888b7/samples/applications/app-bursting-pattern/scripts/ec2/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/app-bursting-pattern/scripts/ec2/undeploy.sh b/samples/applications/app-bursting-pattern/scripts/ec2/undeploy.sh
new file mode 100644
index 0000000..17d8c71
--- /dev/null
+++ b/samples/applications/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/f2f888b7/samples/applications/app-bursting-pattern/scripts/kubernetes/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/app-bursting-pattern/scripts/kubernetes/deploy.sh b/samples/applications/app-bursting-pattern/scripts/kubernetes/deploy.sh
new file mode 100755
index 0000000..d6c47c1
--- /dev/null
+++ b/samples/applications/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/f2f888b7/samples/applications/app-bursting-pattern/scripts/kubernetes/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/app-bursting-pattern/scripts/kubernetes/undeploy.sh b/samples/applications/app-bursting-pattern/scripts/kubernetes/undeploy.sh
new file mode 100755
index 0000000..0054670
--- /dev/null
+++ b/samples/applications/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/f2f888b7/samples/applications/app-bursting-pattern/scripts/mock/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/app-bursting-pattern/scripts/mock/deploy.sh b/samples/applications/app-bursting-pattern/scripts/mock/deploy.sh
new file mode 100755
index 0000000..93f8517
--- /dev/null
+++ b/samples/applications/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/f2f888b7/samples/applications/app-bursting-pattern/scripts/mock/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/app-bursting-pattern/scripts/mock/undeploy.sh b/samples/applications/app-bursting-pattern/scripts/mock/undeploy.sh
new file mode 100755
index 0000000..17d8c71
--- /dev/null
+++ b/samples/applications/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/f2f888b7/samples/applications/app-bursting-pattern/scripts/openstack/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/app-bursting-pattern/scripts/openstack/deploy.sh b/samples/applications/app-bursting-pattern/scripts/openstack/deploy.sh
new file mode 100755
index 0000000..4c39959
--- /dev/null
+++ b/samples/applications/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/f2f888b7/samples/applications/app-bursting-pattern/scripts/openstack/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/app-bursting-pattern/scripts/openstack/undeploy.sh b/samples/applications/app-bursting-pattern/scripts/openstack/undeploy.sh
new file mode 100644
index 0000000..17d8c71
--- /dev/null
+++ b/samples/applications/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/f2f888b7/samples/deployment-policies/deployment-policy-4.json
----------------------------------------------------------------------
diff --git a/samples/deployment-policies/deployment-policy-4.json b/samples/deployment-policies/deployment-policy-4.json
index dd4ca0c..60c2952 100644
--- a/samples/deployment-policies/deployment-policy-4.json
+++ b/samples/deployment-policies/deployment-policy-4.json
@@ -24,6 +24,26 @@
"partitionMax": 20
}
]
+ },
+ {
+ "id": "network-partition-3",
+ "partitionAlgo": "one-after-another",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "partitionMax": 20
+ }
+ ]
+ },
+ {
+ "id": "network-partition-4",
+ "partitionAlgo": "one-after-another",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "partitionMax": 20
+ }
+ ]
}
]
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/f2f888b7/samples/network-partitions/mock/network-partition-4.json
----------------------------------------------------------------------
diff --git a/samples/network-partitions/mock/network-partition-4.json b/samples/network-partitions/mock/network-partition-4.json
new file mode 100644
index 0000000..fb0cb9c
--- /dev/null
+++ b/samples/network-partitions/mock/network-partition-4.json
@@ -0,0 +1,15 @@
+{
+ "id": "network-partition-4",
+ "provider": "mock",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ }
+ ]
+}