You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by la...@apache.org on 2015/06/19 11:03:22 UTC
stratos git commit: Adding common scripts to multi-cloud sample,
that were missing
Repository: stratos
Updated Branches:
refs/heads/master e14351e77 -> 3a6d76c78
Adding common scripts to multi-cloud sample, that were missing
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/3a6d76c7
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/3a6d76c7
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/3a6d76c7
Branch: refs/heads/master
Commit: 3a6d76c785127621777462c7fc795180b944016f
Parents: e14351e
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Fri Jun 19 14:32:49 2015 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Fri Jun 19 14:32:49 2015 +0530
----------------------------------------------------------------------
.../scripts/common/deploy.sh | 70 ++++++++++++++++++++
.../scripts/common/undeploy.sh | 53 +++++++++++++++
2 files changed, 123 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/3a6d76c7/samples/applications/simple/single-cartridge-app-multi-cloud/scripts/common/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/simple/single-cartridge-app-multi-cloud/scripts/common/deploy.sh b/samples/applications/simple/single-cartridge-app-multi-cloud/scripts/common/deploy.sh
new file mode 100755
index 0000000..a79679c
--- /dev/null
+++ b/samples/applications/simple/single-cartridge-app-multi-cloud/scripts/common/deploy.sh
@@ -0,0 +1,70 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# --------------------------------------------------------------
+#
+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/multi"; pwd`
+cartridges_groups_path=`cd "${script_path}/../../../../../cartridge-groups"; pwd`
+autoscaling_policies_path=`cd "${script_path}/../../../../../autoscaling-policies"; pwd`
+network_partitions_path=`cd "${script_path}/../../../../../network-partitions/multi"; 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}/ap-southeast-1-nw-partition.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}/ap-southeast-2-nw-partition.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}/openstack-nw-partition.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}/multi-cloud-deployment-policy.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}/php2.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}/multi-cloud-application-policy.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/single-cartridge-multi-cloud-app/deploy/multi-cloud-application-policy
http://git-wip-us.apache.org/repos/asf/stratos/blob/3a6d76c7/samples/applications/simple/single-cartridge-app-multi-cloud/scripts/common/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/simple/single-cartridge-app-multi-cloud/scripts/common/undeploy.sh b/samples/applications/simple/single-cartridge-app-multi-cloud/scripts/common/undeploy.sh
new file mode 100644
index 0000000..7fd68f7
--- /dev/null
+++ b/samples/applications/simple/single-cartridge-app-multi-cloud/scripts/common/undeploy.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# --------------------------------------------------------------
+#
+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/single-cartridge-multi-cloud-app/undeploy
+
+sleep 10
+
+echo "Deleting application..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/single-cartridge-multi-cloud-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/multi-cloud-deployment-policy
+
+echo "Removing appliation policies"
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applicationPolicies/multi-cloud-application-policy
+
+echo "Removing network partitions..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions/ap-southeast-1-nw-partition
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions/ap-southeast-2-nw-partition
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions/openstack-nw-partition
+
+