Repository: stratos Updated Branches: refs/heads/master c7f56428c -> e615fb82f
http://git-wip-us.apache.org/repos/asf/stratos/blob/e615fb82/tools/stratos-installer/ec2-user-data.sh ---------------------------------------------------------------------- diff --git a/tools/stratos-installer/ec2-user-data.sh b/tools/stratos-installer/ec2-user-data.sh deleted file mode 100755 index 971a627..0000000 --- a/tools/stratos-installer/ec2-user-data.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/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. -# -# ---------------------------------------------------------------------------- -# -# This script is invoked by setup.sh for configuring Amazon EC2 user data. -# ---------------------------------------------------------------------------- - -# Die on any error: -set -e - -export LOG=$log_path/stratos-ec2-user-data.log - -source "./conf/setup.conf" - -if [[ ! -d $log_path ]]; then - mkdir -p $log_path -fi - - -# Following is helpful if you've mistakenly added data in user-data and want to recover. -read -p "Please confirm whether you want to be prompted, irrespective of the data available in user-data? [y/n] " answer -if [[ $answer = n && `curl -o /dev/null --silent --head --write-out '%{http_code}\n' http://169.254.169.254/latest/user-data` = "200" ]] ; then - echo "Trying to find values via user-data" >> $LOG - wget http://169.254.169.254/latest/user-data -O /opt/user-data.txt >> $LOG - userData=`cat /opt/user-data.txt` - echo "Extracted user-data: $userData" >> $LOG - - # Assign values obtained through user-data - for i in {1..8} - do - entry=`echo $userData | cut -d',' -f$i | sed 's/,//g'` - key=`echo $entry | cut -d'=' -f1 | sed 's/=//g'` - value=`echo $entry | cut -d'=' -f2 | sed 's/=//g'` - if [[ "$key" == *EC2_KEY_PATH* ]] ; then EC2_KEY_PATH=$value; - elif [[ "$key" == *ACCESS_KEY* ]] ; then ACCESS_KEY=$value; - elif [[ "$key" == *SECRET_KEY* ]] ; then SECRET_KEY=$value; - elif [[ "$key" == *OWNER_ID* ]] ; then OWNER_ID=$value; - elif [[ "$key" == *AVAILABILITY_ZONE* ]] ; then AVAILABILITY_ZONE=$value; - elif [[ "$key" == *SECURITY_GROUP* ]] ; then SECURITY_GROUP=$value; - elif [[ "$key" == *KEY_PAIR_NAME* ]] ; then KEY_PAIR_NAME=$value; - elif [[ "$key" == *DOMAIN* ]] ; then DOMAIN=$value; - fi - done -fi - -# Get hostname -wget http://169.254.169.254/latest/meta-data/public-hostname -O /opt/public-hostname -stratos_hostname=`cat /opt/public-hostname` - -# Prompt for the values that are not retrieved via user-data -if [[ -z $EC2_KEY_PATH ]]; then - echo -n "Please copy your EC2 public key and enter full path to it (eg: /home/ubuntu/EC2SKEY.pem):" - read EC2_KEY_PATH - if [ ! -e "$EC2_KEY_PATH" ]; then - echo "EC2 key file ($EC2_KEY_PATH) is not found. Installer cannot proceed." - exit 69 - fi -fi -if [[ -z $ACCESS_KEY ]]; then - echo -n "Access Key of EC2 account (eg: Q0IAJDWGFM842UHQP27L) :" - read ACCESS_KEY -fi -if [[ -z $SECRET_KEY ]]; then - echo -n "Secret key of EC2 account (eg: DSKidmKS620mMWMBK5DED983HJSELA) :" - read SECRET_KEY -fi -if [[ -z $OWNER_ID ]]; then - echo -n "Owner id of EC2 account (eg: 927235126122165) :" - read OWNER_ID -fi -if [[ -z $AVAILABILITY_ZONE ]]; then - echo -n "Availability zone (default value: us-east-1c) :" - read AVAILABILITY_ZONE -fi -if [[ -z $SECURITY_GROUP ]]; then - echo -n "Name of the EC2 security group (eg: stratosdemo) :" - read SECURITY_GROUP -fi -if [[ -z $KEY_PAIR_NAME ]]; then - echo -n "Name of the key pair (eg: EC2SKEY) :" - read KEY_PAIR_NAME -fi -if [[ -z $DOMAIN ]]; then - echo -n "Domain name for Stratos (default value: stratos.apache.org) :" - read DOMAIN -fi -if [ -z "$DOMAIN" ]; then - DOMAIN="stratos.apache.org" -fi -if [ -z "$AVAILABILITY_ZONE" ]; then - AVAILABILITY_ZONE="us-east-1c" - echo "Default Availability Zone $AVAILABILITY_ZONE" >> $LOG -fi -if [ ! -e "$EC2_KEY_PATH" ]; then - echo "EC2 key file ($EC2_KEY_PATH) is not found. Installer cannot proceed." - exit 69 -fi - -echo "Updating conf/setup.conf with user data" -cp -f conf/setup.conf conf/setup.conf.orig -cat conf/setup.conf.orig | sed -e "s@export stratos_domain=\"*.*\"@export stratos_domain=\"$DOMAIN\"@g" > conf/setup.conf - -cp -f conf/setup.conf conf/setup.conf.orig -cat conf/setup.conf.orig | sed -e "s@export keypair_path=\"*.*\"@export keypair_path=\"$EC2_KEY_PATH\"@g" > conf/setup.conf - -cp -f conf/setup.conf conf/setup.conf.orig -cat conf/setup.conf.orig | sed -e "s@export ec2_keypair_name=\"*.*\"@export ec2_keypair_name=\"$KEY_PAIR_NAME\"@g" > conf/setup.conf - -cp -f conf/setup.conf conf/setup.conf.orig -cat conf/setup.conf.orig | sed -e "s@export ec2_identity=\"*.*\"@export ec2_identity=\"$ACCESS_KEY\"@g" > conf/setup.conf - -cp -f conf/setup.conf conf/setup.conf.orig -cat conf/setup.conf.orig | sed -e "s@export ec2_credential=\"*.*\"@export ec2_credential=\"$SECRET_KEY\"@g" > conf/setup.conf - -cp -f conf/setup.conf conf/setup.conf.orig -cat conf/setup.conf.orig | sed -e "s@export ec2_owner_id=\"*.*\"@export ec2_owner_id=\"$OWNER_ID\"@g" > conf/setup.conf - -cp -f conf/setup.conf conf/setup.conf.orig -cat conf/setup.conf.orig | sed -e "s@export ec2_availability_zone=\"*.*\"@export ec2_availability_zone=\"$AVAILABILITY_ZONE\"@g" > conf/setup.conf - -cp -f conf/setup.conf conf/setup.conf.orig -cat conf/setup.conf.orig | sed -e "s@export ec2_security_groups=\"*.*\"@export ec2_security_groups=\"$SECURITY_GROUP\"@g" > conf/setup.conf - http://git-wip-us.apache.org/repos/asf/stratos/blob/e615fb82/tools/stratos-installer/imageupload.sh ---------------------------------------------------------------------- diff --git a/tools/stratos-installer/imageupload.sh b/tools/stratos-installer/imageupload.sh deleted file mode 100755 index 282af4d..0000000 --- a/tools/stratos-installer/imageupload.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/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. -# -# ---------------------------------------------------------------------------- -# -# This script is for publishing vm images to the cloud environment (IaaS). -# ---------------------------------------------------------------------------- - -TMPAREA=/tmp/__upload - -# Process Command Line -while getopts a:p:t:C:x:y:z:n:w: opts -do - case $opts in - a) - ADMIN=${OPTARG} - ;; - p) - PASSWORD=${OPTARG} - ;; - t) - TENANT=${OPTARG} - ;; - C) - ENDPOINT=${OPTARG} - ;; - x) - ARCH=${OPTARG} - ;; - y) - DISTRO=${OPTARG} - ;; - z) - ARCHFILE=${OPTARG} - ;; - n) - IMAGENAME=${OPTARG} - ;; - w) - VERSION=${OPTARG} - ;; - *) - echo "Syntax: $(basename $0) -u USER -p KEYSTONE -t TENANT -C CONTROLLER_IP -x ARCH -y DISTRO -w VERSION -z ARCHFILE -n IMAGENAME" - exit 1 - ;; - esac -done - -IMAGE=`basename $ARCHFILE` -EXTENSION="${IMAGE##*.}" - -# You must supply the API endpoint -if [[ ! $ENDPOINT ]] -then - echo "Syntax: $(basename $0) -a admin -p PASSWORD -t TENANT -C CONTROLLER_IP" - exit 1 -fi - - - -mkdir -p ${TMPAREA} -if [ ! -f ${TMPAREA}/${IMAGE} ] -then - cp ${ARCHFILE} ${TMPAREA}/${IMAGE} -fi - -if [ -f ${TMPAREA}/${IMAGE} ] -then - cd ${TMPAREA} - if [[ ${EXTENSION} == "gz" || ${EXTENSION} == "tgz" ]]; then - tar zxf ${IMAGE} - DISTRO_IMAGE=$(ls *.img) - elif [[ ${EXTENSION} == "img" ]]; then - DISTRO_IMAGE=${IMAGE} - fi - - AMI=$(glance -I ${ADMIN} -K ${PASSWORD} -T ${TENANT} -N http://${ENDPOINT}:5000/v2.0 add name="${IMAGENAME}" disk_format=ami container_format=ami distro="${DISTRO} ${VERSION}" kernel_id=${KERNEL} is_public=true < ${DISTRO_IMAGE} | awk '/ ID/ { print $6 }') - - echo "${DISTRO} ${VERSION} ${ARCH} now available in Glance (${AMI})" - - rm -f /tmp/__upload/*{.img,-vmlinuz-virtual,loader,floppy} -else - echo "Tarball not found!" -fi http://git-wip-us.apache.org/repos/asf/stratos/blob/e615fb82/tools/stratos-installer/openstack-cartridge.sh ---------------------------------------------------------------------- diff --git a/tools/stratos-installer/openstack-cartridge.sh b/tools/stratos-installer/openstack-cartridge.sh deleted file mode 100755 index 8d5be93..0000000 --- a/tools/stratos-installer/openstack-cartridge.sh +++ /dev/null @@ -1,131 +0,0 @@ -#!/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. -# -# ---------------------------------------------------------------------------- -# -# This script is invoked by setup.sh for configuring cartridges for OpenStack. -# ---------------------------------------------------------------------------- - -# Die on any error: -set -e - -SLEEP=60 -export LOG=$log_path/stratos-openstack-cartridge.log - -source "./conf/setup.conf" - -if [[ ! -d $log_path ]]; then - mkdir -p $log_path -fi - - -echo "Creating payload directory ... " | tee $LOG -if [[ ! -d $cc_path/repository/resources/payload ]]; then - mkdir -p $cc_path/repository/resources/payload -fi - -echo "Creating cartridges directory ... " | tee $LOG -if [[ ! -d $cc_path/repository/deployment/server/cartridges/ ]]; then - mkdir -p $cc_path/repository/deployment/server/cartridges/ -fi - - -# Copy the cartridge specific configuration files into the CC -if [ "$(find ./cartridges/openstack/ -type f)" ]; then - cp -f ./cartridges/openstack/*.xml $cc_path/repository/deployment/server/cartridges/ -fi - -pushd $cc_path -echo "Updating repository/deployment/server/cartridges/openstack-mysql.xml" | tee $LOG -# <iaasProvider type="openstack" > -# <imageId>nova/d6e5dbe9-f781-460d-b554-23a133a887cd</imageId> -# <property name="keyPair" value="stratos-demo"/> -# <property name="instanceType" value="nova/1"/> -# <property name="securityGroups" value="default"/> -# <!--<property name="payload" value="resources/as.txt"/>--> -# </iaasProvider> - - -cp -f repository/deployment/server/cartridges/openstack-mysql.xml repository/deployment/server/cartridges/openstack-mysql.xml.orig -cat repository/deployment/server/cartridges/openstack-mysql.xml.orig | sed -e "s@<property name=\"keyPair\" value=\"*.*\"/>@<property name=\"keyPair\" value=\"$openstack_keypair_name\"/>@g" > repository/deployment/server/cartridges/openstack-mysql.xml - -cp -f repository/deployment/server/cartridges/openstack-mysql.xml repository/deployment/server/cartridges/openstack-mysql.xml.orig -cat repository/deployment/server/cartridges/openstack-mysql.xml.orig | sed -e "s@<property name=\"instanceType\" value=\"*.*\"/>@<property name=\"instanceType\" value=\"$openstack_instance_type_tiny\"/>@g" > repository/deployment/server/cartridges/openstack-mysql.xml - -cp -f repository/deployment/server/cartridges/openstack-mysql.xml repository/deployment/server/cartridges/openstack-mysql.xml.orig -cat repository/deployment/server/cartridges/openstack-mysql.xml.orig | sed -e "s@<property name=\"securityGroups\" value=\"*.*\"/>@<property name=\"securityGroups\" value=\"$openstack_security_groups\"/>@g" > repository/deployment/server/cartridges/openstack-mysql.xml - -cp -f repository/deployment/server/cartridges/openstack-mysql.xml repository/deployment/server/cartridges/openstack-mysql.xml.orig -cat repository/deployment/server/cartridges/openstack-mysql.xml.orig | sed -e "s@<imageId>*.*</imageId>@<imageId>$nova_region/$openstack_mysql_cartridge_image_id</imageId>@g" > repository/deployment/server/cartridges/openstack-mysql.xml - -cp -f repository/deployment/server/cartridges/openstack-mysql.xml repository/deployment/server/cartridges/openstack-mysql.xml.orig -cat repository/deployment/server/cartridges/openstack-mysql.xml.orig | sed -e "s@STRATOS_DOMAIN@$stratos_domain@g" > repository/deployment/server/cartridges/openstack-mysql.xml - - -echo "Updating repository/deployment/server/cartridges/openstack-php.xml" | tee $LOG -# <iaasProvider type="openstack" > -# <imageId>nova/250cd0bb-96a3-4ce8-bec8-7f9c1efea1e6</imageId> -# <property name="keyPair" value="stratos-demo"/> -# <property name="instanceType" value="nova/1"/> -# <property name="securityGroups" value="default"/> -# <!--<property name="payload" value="resources/as.txt"/>--> -# </iaasProvider> - -cp -f repository/deployment/server/cartridges/openstack-php.xml repository/deployment/server/cartridges/openstack-php.xml.orig -cat repository/deployment/server/cartridges/openstack-php.xml.orig | sed -e "s@<property name=\"keyPair\" value=\"*.*\"/>@<property name=\"keyPair\" value=\"$openstack_keypair_name\"/>@g" > repository/deployment/server/cartridges/openstack-php.xml - -cp -f repository/deployment/server/cartridges/openstack-php.xml repository/deployment/server/cartridges/openstack-php.xml.orig -cat repository/deployment/server/cartridges/openstack-php.xml.orig | sed -e "s@<property name=\"instanceType\" value=\"*.*\"/>@<property name=\"instanceType\" value=\"$openstack_instance_type_tiny\"/>@g" > repository/deployment/server/cartridges/openstack-php.xml - -cp -f repository/deployment/server/cartridges/openstack-php.xml repository/deployment/server/cartridges/openstack-php.xml.orig -cat repository/deployment/server/cartridges/openstack-php.xml.orig | sed -e "s@<property name=\"securityGroups\" value=\"*.*\"/>@<property name=\"securityGroups\" value=\"$openstack_security_groups\"/>@g" > repository/deployment/server/cartridges/openstack-php.xml - -cp -f repository/deployment/server/cartridges/openstack-php.xml repository/deployment/server/cartridges/openstack-php.xml.orig -cat repository/deployment/server/cartridges/openstack-php.xml.orig | sed -e "s@<imageId>*.*</imageId>@<imageId>$nova_region/$openstack_php_cartridge_image_id</imageId>@g" > repository/deployment/server/cartridges/openstack-php.xml - -cp -f repository/deployment/server/cartridges/openstack-php.xml repository/deployment/server/cartridges/openstack-php.xml.orig -cat repository/deployment/server/cartridges/openstack-php.xml.orig | sed -e "s@STRATOS_DOMAIN@$stratos_domain@g" > repository/deployment/server/cartridges/openstack-php.xml - - -echo "Updating repository/deployment/server/cartridges/openstack-tomcat.xml" | tee $LOG -# <iaasProvider type="openstack" > -# <imageId>RegionOne/9701eb18-d7e1-4a53-a2bf-a519899d451c</imageId> -# <property name="keyPair" value="manula_openstack"/> -# <property name="instanceType" value="RegionOne/2"/> -# <property name="securityGroups" value="im-security-group1"/> -# <!--<property name="payload" value="resources/as.txt"/>--> -# </iaasProvider> - -cp -f repository/deployment/server/cartridges/openstack-tomcat.xml repository/deployment/server/cartridges/openstack-tomcat.xml.orig -cat repository/deployment/server/cartridges/openstack-tomcat.xml.orig | sed -e "s@<property name=\"keyPair\" value=\"*.*\"/>@<property name=\"keyPair\" value=\"$openstack_keypair_name\"/>@g" > repository/deployment/server/cartridges/openstack-tomcat.xml - -cp -f repository/deployment/server/cartridges/openstack-tomcat.xml repository/deployment/server/cartridges/openstack-tomcat.xml.orig -cat repository/deployment/server/cartridges/openstack-tomcat.xml.orig | sed -e "s@<property name=\"instanceType\" value=\"*.*\"/>@<property name=\"instanceType\" value=\"$openstack_instance_type_tiny\"/>@g" > repository/deployment/server/cartridges/openstack-tomcat.xml - -cp -f repository/deployment/server/cartridges/openstack-tomcat.xml repository/deployment/server/cartridges/openstack-tomcat.xml.orig -cat repository/deployment/server/cartridges/openstack-tomcat.xml.orig | sed -e "s@<property name=\"securityGroups\" value=\"*.*\"/>@<property name=\"securityGroups\" value=\"$openstack_security_groups\"/>@g" > repository/deployment/server/cartridges/openstack-tomcat.xml - -cp -f repository/deployment/server/cartridges/openstack-tomcat.xml repository/deployment/server/cartridges/openstack-tomcat.xml.orig -cat repository/deployment/server/cartridges/openstack-tomcat.xml.orig | sed -e "s@<imageId>*.*</imageId>@<imageId>$nova_region/$openstack_tomcat_cartridge_image_id</imageId>@g" > repository/deployment/server/cartridges/openstack-tomcat.xml - -cp -f repository/deployment/server/cartridges/openstack-tomcat.xml repository/deployment/server/cartridges/openstack-tomcat.xml.orig -cat repository/deployment/server/cartridges/openstack-tomcat.xml.orig | sed -e "s@STRATOS_DOMAIN@$stratos_domain@g" > repository/deployment/server/cartridges/openstack-tomcat.xml - -popd # cc_path http://git-wip-us.apache.org/repos/asf/stratos/blob/e615fb82/tools/stratos-installer/scripts/add_entry_zone_file.sh ---------------------------------------------------------------------- diff --git a/tools/stratos-installer/scripts/add_entry_zone_file.sh b/tools/stratos-installer/scripts/add_entry_zone_file.sh deleted file mode 100644 index c3432c5..0000000 --- a/tools/stratos-installer/scripts/add_entry_zone_file.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/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. -# -# -zone_file=$3 -subdomain=$1 -ip=$2 - -# General commands -if [ "$(uname)" == "Darwin" ]; then - # Do something under Mac OS X platform - SED=`which gsed` && : || (echo "Command 'gsed' is not installed."; exit 10;) -else - # Do something else under some other platform - SED=`which sed` && : || (echo "Command 'sed' is not installed."; exit 10;) -fi - -# check the file -if [ -f {$zone_file} ]; then - echo "Error: zone does not exist" - exit 1 -fi -echo "File $zone_file exists" - -#appending the zone file -echo "$subdomain IN A $ip">> $zone_file -echo "Added subdomain to the file" - -# get serial number -serial=$(grep 'Serial' $zone_file | awk '{print $1}') -echo "Serial number " $serial -# get serial number's date -serialdate=$(echo $serial | cut -b 1-8) -# get today's date in same style -date=$(date +%Y%m%d) - - -#Serial number's date -serialdate=$(echo $serial | cut -b 1-8) -echo "serial date" $serialdate -# get today's date in same style -date=$(date +%Y%m%d) -echo "Now date" $date - -# compare date and serial date -if [ $serialdate = $date ] - then - # if equal, just add 1 - newserial=$(expr $serial + 1) - echo "same date" - else - # if not equal, make a new one and add 00 - newserial=$(echo $date"00") -fi - -echo "Adding subdomain $1 and ip $2 to $3" -${SED} -i "s/.*Serial.*/ \t\t\t\t$newserial ; Serial./" $zone_file - - - -#reloading bind server -/etc/init.d/bind9 reload http://git-wip-us.apache.org/repos/asf/stratos/blob/e615fb82/tools/stratos-installer/scripts/copy-private-key.sh ---------------------------------------------------------------------- diff --git a/tools/stratos-installer/scripts/copy-private-key.sh b/tools/stratos-installer/scripts/copy-private-key.sh deleted file mode 100644 index ec41fa3..0000000 --- a/tools/stratos-installer/scripts/copy-private-key.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/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. -# -# - - -user="ubuntu" -instance_ip="" -cartridge_private_key="" - -function help { - echo "Usage: copy-private-key <mandatory arguments>" - echo " Usage:" - echo " copy-private-key <instance ip> <cartridge private key>" - echo " eg:" - echo " copy-private-key 172.17.1.2 /tmp/foo-php" - echo "" -} - -function main { - -if [[ (-z $instance_ip || -z $cartridge_private_key) ]]; then - help - exit 1 -fi - -} - -instance_ip=$1 -cartridge_private_key=$2 - -if [[ (-n $instance_ip && -n $cartridge_private_key) ]]; then - scp -i ${cartridge_private_key} ${cartridge_private_key} ${user}@${instance_ip}:/home/${user}/.ssh/id_rsa - ssh -o "BatchMode yes" -i ${cartridge_private_key} ${user}@${instance_ip} chown ${user}:${user} /home/${user}/.ssh/id_rsa - ssh -o "BatchMode yes" -i ${cartridge_private_key} ${user}@${instance_ip} chmod 0600 /home/${user}/.ssh/id_rsa -fi - -main http://git-wip-us.apache.org/repos/asf/stratos/blob/e615fb82/tools/stratos-installer/scripts/create-app.sh ---------------------------------------------------------------------- diff --git a/tools/stratos-installer/scripts/create-app.sh b/tools/stratos-installer/scripts/create-app.sh deleted file mode 100644 index 1d8b1c3..0000000 --- a/tools/stratos-installer/scripts/create-app.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/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. -# -# - -user="ubuntu" -instance_ip="" -app_path="" -repo="" -cartridge_private_key="" -ads_git_url="" - -function help { - echo "Usage: create-app <mandatory arguments>" - echo " Usage:" - echo " create-app <instance_ip> <repo> <app path> <cartridge_private_key> <ADS git URL or ADS IP>" - echo " eg:" - echo " create-app 172.17.1.1 <foo.myapp.php.git> /var/www/myapp /tmp/foo-php 172.17.1.100" - echo "" -} - -function main { - -if [[ (-z $instance_ip || -z $app_path || -z $repo || -z $cartridge_private_key ) ]]; then - help - exit 1 -fi - -} - -instance_ip=$1 -repo=$2 -app_path=$3 -cartridge_private_key=$4 -ads_git_url=$5 - -if [[ (-n $instance_ip && -n $app_path && -n $repo && -n $cartridge_private_key ) ]]; then - ssh -o "BatchMode yes" -i ${cartridge_private_key} ${user}@${instance_ip} sudo git clone git@${ads_git_url}:${repo} $app_path -fi - -main http://git-wip-us.apache.org/repos/asf/stratos/blob/e615fb82/tools/stratos-installer/scripts/git-folder-structure.sh ---------------------------------------------------------------------- diff --git a/tools/stratos-installer/scripts/git-folder-structure.sh b/tools/stratos-installer/scripts/git-folder-structure.sh deleted file mode 100644 index 40e53c2..0000000 --- a/tools/stratos-installer/scripts/git-folder-structure.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/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. -# -# - -tenant="" -cartridge="" -ads_git_url="localhost" - -function help { - echo "Usage:git-folder-structure <mandatory arguments>" - echo " Usage:" - echo " git-folder-structure <tenant> <cartridge> [webapp=readme file description with space replace with #] " - echo " eg:" - echo " git-folder-structure tenant1 as webapp=copy#war#files#here" - echo "" -} - -function main { - -if [[ (-z $tenant || -z $cartridge ) ]]; then - help - exit 1 -fi - -} - -tenant=$1 -cartridge=$2 - -if [[ (-n $tenant && -n $cartridge) ]]; then - cd /tmp/ - rm -fr ${tenant}.${cartridge} - git clone git@localhost:${tenant}.${cartridge} - cd ${tenant}.${cartridge} - git pull origin master - shift - shift - for IN in "$@"; do - IFS='=' read -ra ADDR <<< "$IN" - mkdir -p ${ADDR[0]} - echo ${ADDR[1]} | sed -e 's/#/\s/g' > ${ADDR[0]}/README.txt - git add ${ADDR[0]} - git commit -a -m 'Folder structure commit' - git push origin master - done - -fi - -main http://git-wip-us.apache.org/repos/asf/stratos/blob/e615fb82/tools/stratos-installer/scripts/keygen.sh ---------------------------------------------------------------------- diff --git a/tools/stratos-installer/scripts/keygen.sh b/tools/stratos-installer/scripts/keygen.sh deleted file mode 100644 index 11c38b3..0000000 --- a/tools/stratos-installer/scripts/keygen.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/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. -# -# - -tenant="" -cartridge="" - -function help { - echo "Usage: keygen <mandatory arguments>" - echo " Usage:" - echo " keygen <tenant> <cartridge>" - echo " eg:" - echo " keygen foo php" - echo "" -} - -function main { - -if [[ (-z $tenant || -z $cartridge ) ]]; then - help - exit 1 -fi - -} - -tenant=$1 -cartridge=$2 - -if [[ (-n $tenant && -n $cartridge) ]]; then - ssh-keygen -t rsa -N '' -f /tmp/${tenant}-${cartridge} - -fi - -main http://git-wip-us.apache.org/repos/asf/stratos/blob/e615fb82/tools/stratos-installer/scripts/manage-git-repo.sh ---------------------------------------------------------------------- diff --git a/tools/stratos-installer/scripts/manage-git-repo.sh b/tools/stratos-installer/scripts/manage-git-repo.sh deleted file mode 100644 index b37fb03..0000000 --- a/tools/stratos-installer/scripts/manage-git-repo.sh +++ /dev/null @@ -1,115 +0,0 @@ -#!/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. -# -# - -user="wso2" -action="" -username="" -tenant_domain="" -cartridge="" -tenant_key="" -cartridge_key="" -gitolite_admin="/home/wso2/gitolite-admin/" -git_domain="git.slive.com" -#gitolite_admin="/tmp/gitolite-admin/" -git_repo="/home/git/repositories/" - -function help { - echo "Usage: manage-git-repo <action> <mandatory arguments>" - echo " Action can be one of the following" - echo " create : create git repo" - echo " delete : delete git repo" - echo " Usage:" - echo " manage-git-repo create <username> <tenant domain> <cartridge>" - echo " manage-git-repo delete <tenant name> <cartridge>" - echo " eg:" - echo " manage-git-repo create foo abc.com php /tmp/foo-php.pub" - echo "" -} - -function main { - -if [[ ( -z $action || ( -n $action && $action == "help" ) ) ]]; then - help - exit 1 -fi -if [[ (( -n $action && $action == "create") && ( -z $tenant_domain || -z $username || -z $cartridge )) ]]; then - help - exit 1 -fi - -} - -action=$1 -username=$2 -tenant_domain=$3 -cartridge=$4 -if [[ $action == "create" ]]; then - echo "1233454444" > /tmp/file2 - # hack until stratos manager support key pair for every user - ssh-keygen -t rsa -N '' -f /tmp/${username} - cd ${gitolite_admin} - git pull - # set public keys - cat /tmp/${username}.pub > keydir/${username}.pub - # add repo and permission to conf - echo "" >> conf/gitolite.conf - echo "repo ${tenant_domain}.${cartridge}.git" >> conf/gitolite.conf - echo " RW+ = ${username} ${user} daemon" >> conf/gitolite.conf - echo " config gitweb.url = git@${git_domain}:${tenant_domain}.${cartridge}" >> conf/gitolite.conf - echo " config receive.denyNonFastforwards = true" >> conf/gitolite.conf - echo " config receive.denyDeletes = true" >> conf/gitolite.conf - echo "" >> conf/gitolite.conf - # git operations - git add keydir/${username}.pub - git commit -a -m "${username} keys added and ${tenant_domain}.${cartridge} repo created" - git pull - git push - - # set git push trigger - sudo -s sh -c "echo '<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://org.apache.axis2/xsd\"> - <soapenv:Header/> - <soapenv:Body> - <xsd:notifyRepoUpdate> - <xsd:tenantDomain>${tenant_domain}</xsd:tenantDomain> - <xsd:cartridgeType>${cartridge}</xsd:cartridgeType> - </xsd:notifyRepoUpdate> - </soapenv:Body> -</soapenv:Envelope>' > ${git_repo}${tenant_domain}.${cartridge}.git/hooks/request.xml" - #sudo cp -a ${git_repo}${tenant_domain}.${cartridge}.git/hooks/post-update.sample ${git_repo}${tenant_domain}.${cartridge}.git/hooks/post-update - sudo -s sh -c "echo '#!/bin/bash' > ${git_repo}${tenant_domain}.${cartridge}.git/hooks/post-update" - sudo -s sh -c "echo 'curl -X POST -H \"Content-Type: text/xml\" -d @${git_repo}${tenant_domain}.${cartridge}.git/hooks/request.xml \"https://localhost:9446/services/RepoNotificationService/\" --insecure' >> ${git_repo}${tenant_domain}.${cartridge}.git/hooks/post-update" - sudo -s sh -c "echo 'exec git update-server-info' >> ${git_repo}${tenant_domain}.${cartridge}.git/hooks/post-update" - sudo chown git:git ${git_repo}${tenant_domain}.${cartridge}.git/hooks/post-update - sudo chmod 700 ${git_repo}${tenant_domain}.${cartridge}.git/hooks/post-update - -fi -if [[ $action == "delete" ]]; then - echo 'todo - delete' -# cd ${gitolite_admin} -# git rm keydir/${tenant}.pub -# git rm keydir/${tenant}-${cartridge}.pub - - -fi - - -main http://git-wip-us.apache.org/repos/asf/stratos/blob/e615fb82/tools/stratos-installer/scripts/remove_entry_zone_file.sh ---------------------------------------------------------------------- diff --git a/tools/stratos-installer/scripts/remove_entry_zone_file.sh b/tools/stratos-installer/scripts/remove_entry_zone_file.sh deleted file mode 100644 index 9b6f0f1..0000000 --- a/tools/stratos-installer/scripts/remove_entry_zone_file.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/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. -# -# -zone_file=$2 -subdomain=$1 - -# General commands -if [ "$(uname)" == "Darwin" ]; then - # Do something under Mac OS X platform - SED=`which gsed` && : || (echo "Command 'gsed' is not installed."; exit 10;) -else - # Do something else under some other platform - SED=`which sed` && : || (echo "Command 'sed' is not installed."; exit 10;) -fi - -# check the file -if [ -f {$zone_file} ]; then - echo "Error: zone does not exist" - exit 1 -fi -echo "File $zone_file exists" - -# find entry to delete -entry=$(grep $subdomain $zone_file) -#sed "/$entry/d" $zone_file - -sed "/$entry/d" $zone_file >tmp -mv tmp $zone_file - -echo "entry to delete $entry" - - -# get serial number -serial=$(grep 'Serial' $zone_file | awk '{print $1}') -echo "Serial number " $serial -# get serial number's date -serialdate=$(echo $serial | cut -b 1-8) -# get today's date in same style -date=$(date +%Y%m%d) - - -#Serial number's date -serialdate=$(echo $serial | cut -b 1-8) -echo "serial date" $serialdate -# get today's date in same style -date=$(date +%Y%m%d) -echo "Now date" $date - -# compare date and serial date -if [ $serialdate = $date ] - then - # if equal, just add 1 - newserial=$(expr $serial + 1) - echo "same date" - else - # if not equal, make a new one and add 00 - newserial=$(echo $date"00") -fi - -echo "Adding subdomain $1 and ip $2 to $3" -${SED} -i "s/.*Serial.*/ \t\t\t\t$newserial ; Serial./" $zone_file - - - -#reloading bind server -/etc/init.d/bind9 reload http://git-wip-us.apache.org/repos/asf/stratos/blob/e615fb82/tools/stratos-installer/scripts/set-mysql-password.sh ---------------------------------------------------------------------- diff --git a/tools/stratos-installer/scripts/set-mysql-password.sh b/tools/stratos-installer/scripts/set-mysql-password.sh deleted file mode 100644 index 6e9a15e..0000000 --- a/tools/stratos-installer/scripts/set-mysql-password.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/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. -# -# - -user="ubuntu" -instance_ip="" -cartridge_private_key="" -password="" - - -function help { - echo "Usage: set-mysql-password <mandatory arguments>" - echo " Usage:" - echo " set-mysql-password <instance ip> <cartridge private key> <password>" - echo " eg:" - echo " set-mysql-password 172.17.1.2 /tmp/foo-php qazxsw" - echo "" -} - -function main { - -if [[ (-z $password || -z $instance_ip) ]]; then - help - exit 1 -fi - -} - -instance_ip=$1 -cartridge_private_key=$2 -password=$3 - -if [[ (-n $password && -n $instance_ip) ]]; then - ssh -o "BatchMode yes" -i ${cartridge_private_key} ${user}@${instance_ip} mysqladmin -u root password "${password}" -fi - -main http://git-wip-us.apache.org/repos/asf/stratos/blob/e615fb82/tools/stratos-installer/scripts/update-instance.sh ---------------------------------------------------------------------- diff --git a/tools/stratos-installer/scripts/update-instance.sh b/tools/stratos-installer/scripts/update-instance.sh deleted file mode 100644 index 55c5492..0000000 --- a/tools/stratos-installer/scripts/update-instance.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/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. -# -# - -user="ubuntu" -instance_ip="" -app_path="" -cartridge_private_key="" - -function help { - echo "Usage: update-instance <mandatory arguments>" - echo " Usage:" - echo " update-instance <instance_ip> <app path> <cartridge_private_key>" - echo " eg:" - echo " update-instance 172.17.1.1 /var/www/myapp /tmp/foo-php" - echo "" -} - -function main { - -if [[ (-z $instance_ip || -z $app_path || -z $cartridge_private_key ) ]]; then - help - exit 1 -fi - -} - -instance_ip=$1 -app_path=$2 -cartridge_private_key=$3 - -if [[ (-n $instance_ip && -n $app_path && -n $cartridge_private_key ) ]]; then - ssh -o "BatchMode yes" -i ${cartridge_private_key} ${user}@${instance_ip} sudo cd $app_path; sudo git pull -fi - -main
