Updated Branches: refs/heads/master 664c09845 -> c01173ce3
renaming cartridge-create tool scripts fixing STRATOS-81 Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/c01173ce Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/c01173ce Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/c01173ce Branch: refs/heads/master Commit: c01173ce3b4f9bbfd92c8baa9a55e5067b9c3116 Parents: 664c098 Author: Udara Liyanage <[email protected]> Authored: Tue Dec 17 09:47:08 2013 -0500 Committer: Udara Liyanage <[email protected]> Committed: Tue Dec 17 09:47:08 2013 -0500 ---------------------------------------------------------------------- tools/cartridge-create/configure-software | 383 +++++++++++++++++++ tools/cartridge-create/configure_software | 383 ------------------- tools/cartridge-create/create-kvm-image.sh | 24 ++ tools/cartridge-create/create_kvm_image.sh | 24 -- tools/cartridge-create/image-action.sh | 165 ++++++++ tools/cartridge-create/image_action.sh | 165 -------- .../php/cartridge-data-publisher-1.0.2.zip | Bin 0 -> 2832200 bytes .../php/cartridge_data_publisher_1.0.2.zip | Bin 2832200 -> 0 bytes 8 files changed, 572 insertions(+), 572 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c01173ce/tools/cartridge-create/configure-software ---------------------------------------------------------------------- diff --git a/tools/cartridge-create/configure-software b/tools/cartridge-create/configure-software new file mode 100755 index 0000000..251a1ac --- /dev/null +++ b/tools/cartridge-create/configure-software @@ -0,0 +1,383 @@ +#!/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. +# ---------------------------------------------------------------------------- + + +ROOTFS=$1 +TEMPLATE=$2 + +# +# Locale settings (en_GB for Redcoats, en_US for Yanks): +# +LANG="en_US.UTF-8" +LANGUAGE="en_US.UTF-8" +LC_ALL="en_US.UTF-8" +LC_CTYPE="C" + +# +# Ubuntu mirror to use: +# +###DEBMIRROR="http://archive.ubuntu.com/ubuntu/" +#DEBMIRROR="http://us.archive.ubuntu.com/ubuntu/" +DEBMIRROR="http://lk.archive.ubuntu.com/ubuntu/" + + +mysql() { + + # MySQL still prompts. Bug. + #DEBCONF_FRONTEND='noninteractive' + + chroot $ROOTFS apt-get update + # Next, all the LAMP packages. We must first pre-save the password + # for MySQL to use: + #chroot $ROOTFS echo "mysql-server mysql-server/root_password select ubuntu" | chroot $ROOTFS debconf-set-selections + #chroot $ROOTFS echo "mysql-server mysql-server/root_password_again select ubuntu" | chroot $ROOTFS debconf-set-selections + + chroot $ROOTFS apt-get install -y \ + nano zip mysql-server git \ + apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common dbconfig-common fontconfig-config libapache2-mod-php5 \ + libaprutil1-dbd-sqlite3 libaprutil1-ldap libcap2 libfontconfig1 libgd2-xpm libjpeg-turbo8 libjpeg8 libmcrypt4 \ + libt1-5 libxpm4 php5-cli php5-common php5-gd php5-mcrypt php5-mysql phpmyadmin ssl-cert ttf-dejavu-core ruby + + # Be sure to have a new SSL cert for this new LXC host: + rm -f $ROOTFS/etc/ssl/private/ssl-cert-snakeoil.key + cp -f ./init_scripts/mysql/cc/ssl-cert-snakeoil.pem $ROOTFS/etc/ssl/certs/ + cp -f ./init_scripts/mysql/cc/ssl-cert-snakeoil.key $ROOTFS/etc/ssl/private/ + #chroot $ROOTFS dpkg-reconfigure ssl-cert + + # Enable HTTPS: + chroot $ROOTFS a2enmod ssl + chroot $ROOTFS a2ensite default-ssl + # Desable HTTP + chroot $ROOTFS a2dissite default + + # set mysql to listen to all network + chroot $ROOTFS cp /etc/mysql/my.cnf /etc/mysql/my.cnf.org + chroot $ROOTFS cat /etc/mysql/my.cnf.org | sed -e 's/127.0.0.1/0.0.0.0/' > $ROOTFS/etc/mysql/my.cnf + + # See http://blog.bodhizazen.net/linux/lxc-configure-ubuntu-lucid-containers/ + # This requirement is confirmed on 10.04.1 LTS. Within LXC, the + # upstart "startup" signal is sent, but not "network-interface", etc. + pushd $ROOTFS/etc/init/ + cp -a ufw.conf ufw.conf-dist + sed ' +s/start on (starting network-interface/start on startup\n#start on (starting network-interface/ +s/ or starting network-manager/# or starting network-manager/ +s/ or starting networking)/# or starting network-manager/ +' < ufw.conf-dist > ufw.conf + + popd + +} + +php() { + + cp -f ./init_scripts/php/wso2-openstack-init.sh $ROOTFS/opt/ + cp -f ./init_scripts/php/get-launch-params.rb $ROOTFS/opt/ + cp -f ./init_scripts/php/cc/ssl-cert-snakeoil.pem $ROOTFS/etc/ssl/certs/ + cp -f ./init_scripts/php/cc/ssl-cert-snakeoil.key $ROOTFS/etc/ssl/private/ + + chroot $ROOTFS apt-get update + # Next, all the packages. + + chroot $ROOTFS apt-get install -y \ + nano zip build-essential mysql-client apache2 php5 php5-cli libapache2-mod-php5 php5-gd php5-mysql php-db php-pear \ + php5-curl curl wget php5-ldap php5-adodb mailutils php5-imap php5-ldap \ + openssl ssl-cert ldap-utils php5-mcrypt mcrypt ufw fail2ban git libboost-all-dev ruby + + # Install the thrift library + tar -zxf ./init_scripts/php/thrift-0.8.0.tar.gz -C$ROOTFS/opt + chroot $ROOTFS cd /opt/thrift-0.8.0;./configure --libdir=/usr/lib;make;make install + tar -zxf ./init_scripts/php/cartridge_data_publisher_1.0.0.tar.gz -C$ROOTFS/opt + chroot $ROOTFS cd /opt/cartridge_data_publisher_1.0.0;make + + # install gitpython + # chroot $ROOTFS easy_install GitPython + + + # configure apache log write to syslog TODO : Need generic solution + chroot $ROOTFS cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.org + chroot $ROOTFS cat /etc/apache2/apache2.conf.org | sed -e 's/^ErrorLog.*/ErrorLog syslog:local2/' > $ROOTFS/etc/apache2/apache2.conf + + # configure rsyslog TODO : Need generic solution + chroot $ROOTFS cp /etc/rsyslog.conf /etc/rsyslog.conf.org + chroot $ROOTFS cat /etc/rsyslog.conf.org | sed -e 's/^#$ModLoad\simtcp.*/$ModLoad imtcp/' | sed -e 's/^\#\$ModLoad\simtcp.*/\$ModLoad imtcp/' | sed -e 's/^\#\$InputTCPServerRun\s514.*/\$InputTCPServerRun 514\nlocal2\.\* \@\@localhost\:32000/' > $ROOTFS/etc/rsyslog.conf + + +# adding simplesaml alias to apache +chroot $ROOTFS cp /etc/apache2/sites-available/default /etc/apache2/sites-available/default-org +chroot $ROOTFS cp /etc/apache2/sites-available/default-ssl /etc/apache2/sites-available/default-ssl-org +chroot $ROOTFS cat /etc/apache2/sites-available/default-org | sed -e 's@DocumentRoot \/var\/www@DocumentRoot \/var\/www\/public\n\tAlias \/simplesaml \/var\/www\/simplesamlphp\/www@' > $ROOTFS/etc/apache2/sites-available/default +chroot $ROOTFS cat /etc/apache2/sites-available/default-ssl-org | sed -e 's@DocumentRoot \/var\/www@DocumentRoot \/var\/www\/public\n\tAlias \/simplesaml \/var\/www\/simplesamlphp\/www@' > $ROOTFS/etc/apache2/sites-available/default-ssl + # Enable HTTPS: + chroot $ROOTFS a2enmod ssl + chroot $ROOTFS a2ensite default-ssl + + + # See http://blog.bodhizazen.net/linux/lxc-configure-ubuntu-lucid-containers/ + # This requirement is confirmed on 10.04.1 LTS. Within LXC, the + # upstart "startup" signal is sent, but not "network-interface", etc. + pushd $ROOTFS/etc/init/ + cp -a ufw.conf ufw.conf-dist + sed ' +s/start on (starting network-interface/start on startup\n#start on (starting network-interface/ +s/ or starting network-manager/# or starting network-manager/ +s/ or starting networking)/# or starting network-manager/ +' < ufw.conf-dist > ufw.conf + popd + + pushd $ROOTFS/etc + echo "#!/bin/bash -e +mkdir -p /etc/agent/conf +chmod 755 /opt/wso2-openstack-init.sh +/opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log +exit 0 + " > rc.local + popd + +} + +lamp() { + + cp -f ./init_scripts/lamp/wso2-openstack-init.sh $ROOTFS/opt/ + cp -f ./init_scripts/lamp/get-launch-params.rb $ROOTFS/opt/ + cp -f ./init_scripts/lamp/server $ROOTFS/opt/ + cp -f ./init_scripts/lamp/svn_client.sh $ROOTFS/opt/ + cp -f ./init_scripts/lamp/svn_client_y.sh $ROOTFS/opt/ + cp -f ./init_scripts/lamp/deployer.sh $ROOTFS/opt/ + + # Copy software + arr=$(echo $SOFTWARE | tr ":" "\n") + for x in $arr + do + cp -rf $x $ROOTFS/opt/ + done + + + # MySQL still prompts. Bug. + #DEBCONF_FRONTEND='noninteractive' + + chroot $ROOTFS apt-get update + # Next, all the LAMP packages. We must first pre-save the password + # for MySQL to use: + chroot $ROOTFS echo "mysql-server mysql-server/root_password select ubuntu" | chroot $ROOTFS debconf-set-selections + chroot $ROOTFS echo "mysql-server mysql-server/root_password_again select ubuntu" | chroot $ROOTFS debconf-set-selections + + chroot $ROOTFS apt-get install -y \ + nano zip mysql-server mysql-client \ + apache2 php5 php5-cli libapache2-mod-php5 php5-gd php5-mysql php-db php-pear php5-curl curl wget php5-ldap php5-adodb mailutils \ + php5-imap php5-ldap \ + openssl ssl-cert ldap-utils \ + php5-mcrypt mcrypt ufw fail2ban ruby subversion + + # Be sure to have a new SSL cert for this new LXC host: + #rm -f $ROOTFS/etc/ssl/private/ssl-cert-snakeoil.key + #chroot $ROOTFS dpkg-reconfigure ssl-cert + + # Enable HTTPS: + #chroot $ROOTFS a2enmod ssl + #chroot $ROOTFS a2ensite default-ssl + + # Turn on MySQL replication logs by default. (Necessary for + # incremental backups, even if you're not doing replication.) + pushd $ROOTFS/etc/mysql/conf.d + echo "[mysqld] +log-bin=mysqld-bin +server-id = 1 + +# For an SSH Tunneled slave: +# See also: /etc/rc.local for the SSH Tunnel that makes this work. +#[mysqld] +#master-host = 127.0.0.1 +#master-user = root +#master-password = ubuntu +#master-port = 13306 +#server-id = 2 + " >> replication.cnf + popd + +pushd $ROOTFS/etc + echo "#!/bin/bash -e +/opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log +exit 0 + " > rc.local + popd + + # Next, fix a couple of Debian gotchas: + + # Comment out these two lines. (Don't expire, + # and use the 1G default file size. + pushd $ROOTFS/etc/mysql + cp -a my.cnf my.cnf-dist + sed ' +s/expire_logs_days/#expire_logs_days/ +s/max_binlog_size/#max_binlog_size/ +' < my.cnf-dist > my.cnf + popd + + # See http://blog.bodhizazen.net/linux/lxc-configure-ubuntu-lucid-containers/ + # This requirement is confirmed on 10.04.1 LTS. Within LXC, the + # upstart "startup" signal is sent, but not "network-interface", etc. + pushd $ROOTFS/etc/init/ + cp -a ufw.conf ufw.conf-dist + sed ' +s/start on (starting network-interface/start on startup\n#start on (starting network-interface/ +s/ or starting network-manager/# or starting network-manager/ +s/ or starting networking)/# or starting network-manager/ +' < ufw.conf-dist > ufw.conf + + cp -a mysql.conf mysql.conf-dist + sed --posix -e ' +s/start on (net-device-up/start on startup\n#start on (net-device-up/ +s/ and local-filesystems/# and local-filesystems/ +s/\t and runlevel \[2345\])/#\t and runlevel \[2345\])/ +' < mysql.conf-dist > mysql.conf + popd + +} + +wso2_carbon_server() { + + cp -f ./init_scripts/carbon/wso2-openstack-init.sh $ROOTFS/opt/ + cp -f ./init_scripts/carbon/get-launch-params.rb $ROOTFS/opt/ + # Copy software + arr=$(echo $SOFTWARE | tr ":" "\n") + for x in $arr + do + cp -rf $x $ROOTFS/opt/ + done + + #chroot $ROOTFS apt-get update + + chroot $ROOTFS apt-get install -y \ + nano zip \ + wget \ + openssl ssl-cert ldap-utils ruby git + + # TODO install puppet agent + + # Be sure to have a new SSL cert for this new LXC host: + #rm -f $ROOTFS/etc/ssl/private/ssl-cert-snakeoil.key + #chroot $ROOTFS dpkg-reconfigure ssl-cert + +pushd $ROOTFS/etc + echo "#!/bin/bash -e +/opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log +exit 0 + " > rc.local + popd + +} + +jetty() { + + cp -f ./init_scripts/jetty/wso2-openstack-init.sh $ROOTFS/opt/ + cp -f ./init_scripts/jetty/get-launch-params.rb $ROOTFS/opt/ + cp -f ./init_scripts/jetty/server $ROOTFS/opt/ + cp -f ./init_scripts/jetty/svn_client.sh $ROOTFS/opt/ + cp -f ./init_scripts/jetty/svn_client_y.sh $ROOTFS/opt/ + cp -f ./init_scripts/jetty/deployer.sh $ROOTFS/opt/ + # Copy software + arr=$(echo $SOFTWARE | tr ":" "\n") + for x in $arr + do + cp -rf $x $ROOTFS/opt/ + done + + #chroot $ROOTFS apt-get update + + chroot $ROOTFS apt-get install -y \ + nano zip \ + wget \ + openssl ssl-cert ldap-utils ruby subversion + +pushd $ROOTFS/etc + echo "#!/bin/bash -e +/opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log +exit 0 + " > rc.local + popd + +} + + +tomcat7() { + + #chroot $ROOTFS echo "nameserver 8.8.8.8" >> $ROOTFS/etc/resolvconf/resolv.conf.d/base + echo "Please fix the resolve conf file" + read + #chroot $ROOTFS mkdir -p /run/resolveconf + #chroot $ROORFS touch /run/resolveconf/resolv.conf + #chroot echo "nameserver 8.8.8.8" > /run/resolveconf/resolv.conf + + echo "------------------------------------------" + chroot $ROOTFS cat /etc/resolv.conf + echo "------------------------------------------" + + + mount -o bind /dev $ROOTFS/dev + + + mount -t proc none $ROOTFS/proc + + + cp -f ./init_scripts/tomcat7/wso2-openstack-init.sh $ROOTFS/opt/ + cp -f ./init_scripts/tomcat7/get-launch-params.rb $ROOTFS/opt/ + + + chroot $ROOTFS apt-get update + # Next, all the packages. + + chroot $ROOTFS apt-get install -y \ + nano zip git\ + ruby curl wget tomcat7 + + # See http://blog.bodhizazen.net/linux/lxc-configure-ubuntu-lucid-containers/ + # This requirement is confirmed on 10.04.1 LTS. Within LXC, the + # upstart "startup" signal is sent, but not "network-interface", etc. + pushd $ROOTFS/etc/init/ + cp -a ufw.conf ufw.conf-dist + sed ' +s/start on (starting network-interface/start on startup\n#start on (starting network-interface/ +s/ or starting network-manager/# or starting network-manager/ +s/ or starting networking)/# or starting network-manager/ +' < ufw.conf-dist > ufw.conf + popd + + pushd $ROOTFS/etc + echo "#!/bin/bash -e +mkdir -p /etc/agent/conf +chmod 755 /opt/wso2-openstack-init.sh +/opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log +exit 0 + " > rc.local + popd + + umount $ROOTFS/dev + umount $ROOTFS/proc +} + + +# Don't prompt when running apt-get: +export DEBCONF_FRONTEND='noninteractive' + +# Run the config function with given $TEMPLATE name (if it exists): +$TEMPLATE + http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c01173ce/tools/cartridge-create/configure_software ---------------------------------------------------------------------- diff --git a/tools/cartridge-create/configure_software b/tools/cartridge-create/configure_software deleted file mode 100755 index 251a1ac..0000000 --- a/tools/cartridge-create/configure_software +++ /dev/null @@ -1,383 +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. -# ---------------------------------------------------------------------------- - - -ROOTFS=$1 -TEMPLATE=$2 - -# -# Locale settings (en_GB for Redcoats, en_US for Yanks): -# -LANG="en_US.UTF-8" -LANGUAGE="en_US.UTF-8" -LC_ALL="en_US.UTF-8" -LC_CTYPE="C" - -# -# Ubuntu mirror to use: -# -###DEBMIRROR="http://archive.ubuntu.com/ubuntu/" -#DEBMIRROR="http://us.archive.ubuntu.com/ubuntu/" -DEBMIRROR="http://lk.archive.ubuntu.com/ubuntu/" - - -mysql() { - - # MySQL still prompts. Bug. - #DEBCONF_FRONTEND='noninteractive' - - chroot $ROOTFS apt-get update - # Next, all the LAMP packages. We must first pre-save the password - # for MySQL to use: - #chroot $ROOTFS echo "mysql-server mysql-server/root_password select ubuntu" | chroot $ROOTFS debconf-set-selections - #chroot $ROOTFS echo "mysql-server mysql-server/root_password_again select ubuntu" | chroot $ROOTFS debconf-set-selections - - chroot $ROOTFS apt-get install -y \ - nano zip mysql-server git \ - apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common dbconfig-common fontconfig-config libapache2-mod-php5 \ - libaprutil1-dbd-sqlite3 libaprutil1-ldap libcap2 libfontconfig1 libgd2-xpm libjpeg-turbo8 libjpeg8 libmcrypt4 \ - libt1-5 libxpm4 php5-cli php5-common php5-gd php5-mcrypt php5-mysql phpmyadmin ssl-cert ttf-dejavu-core ruby - - # Be sure to have a new SSL cert for this new LXC host: - rm -f $ROOTFS/etc/ssl/private/ssl-cert-snakeoil.key - cp -f ./init_scripts/mysql/cc/ssl-cert-snakeoil.pem $ROOTFS/etc/ssl/certs/ - cp -f ./init_scripts/mysql/cc/ssl-cert-snakeoil.key $ROOTFS/etc/ssl/private/ - #chroot $ROOTFS dpkg-reconfigure ssl-cert - - # Enable HTTPS: - chroot $ROOTFS a2enmod ssl - chroot $ROOTFS a2ensite default-ssl - # Desable HTTP - chroot $ROOTFS a2dissite default - - # set mysql to listen to all network - chroot $ROOTFS cp /etc/mysql/my.cnf /etc/mysql/my.cnf.org - chroot $ROOTFS cat /etc/mysql/my.cnf.org | sed -e 's/127.0.0.1/0.0.0.0/' > $ROOTFS/etc/mysql/my.cnf - - # See http://blog.bodhizazen.net/linux/lxc-configure-ubuntu-lucid-containers/ - # This requirement is confirmed on 10.04.1 LTS. Within LXC, the - # upstart "startup" signal is sent, but not "network-interface", etc. - pushd $ROOTFS/etc/init/ - cp -a ufw.conf ufw.conf-dist - sed ' -s/start on (starting network-interface/start on startup\n#start on (starting network-interface/ -s/ or starting network-manager/# or starting network-manager/ -s/ or starting networking)/# or starting network-manager/ -' < ufw.conf-dist > ufw.conf - - popd - -} - -php() { - - cp -f ./init_scripts/php/wso2-openstack-init.sh $ROOTFS/opt/ - cp -f ./init_scripts/php/get-launch-params.rb $ROOTFS/opt/ - cp -f ./init_scripts/php/cc/ssl-cert-snakeoil.pem $ROOTFS/etc/ssl/certs/ - cp -f ./init_scripts/php/cc/ssl-cert-snakeoil.key $ROOTFS/etc/ssl/private/ - - chroot $ROOTFS apt-get update - # Next, all the packages. - - chroot $ROOTFS apt-get install -y \ - nano zip build-essential mysql-client apache2 php5 php5-cli libapache2-mod-php5 php5-gd php5-mysql php-db php-pear \ - php5-curl curl wget php5-ldap php5-adodb mailutils php5-imap php5-ldap \ - openssl ssl-cert ldap-utils php5-mcrypt mcrypt ufw fail2ban git libboost-all-dev ruby - - # Install the thrift library - tar -zxf ./init_scripts/php/thrift-0.8.0.tar.gz -C$ROOTFS/opt - chroot $ROOTFS cd /opt/thrift-0.8.0;./configure --libdir=/usr/lib;make;make install - tar -zxf ./init_scripts/php/cartridge_data_publisher_1.0.0.tar.gz -C$ROOTFS/opt - chroot $ROOTFS cd /opt/cartridge_data_publisher_1.0.0;make - - # install gitpython - # chroot $ROOTFS easy_install GitPython - - - # configure apache log write to syslog TODO : Need generic solution - chroot $ROOTFS cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.org - chroot $ROOTFS cat /etc/apache2/apache2.conf.org | sed -e 's/^ErrorLog.*/ErrorLog syslog:local2/' > $ROOTFS/etc/apache2/apache2.conf - - # configure rsyslog TODO : Need generic solution - chroot $ROOTFS cp /etc/rsyslog.conf /etc/rsyslog.conf.org - chroot $ROOTFS cat /etc/rsyslog.conf.org | sed -e 's/^#$ModLoad\simtcp.*/$ModLoad imtcp/' | sed -e 's/^\#\$ModLoad\simtcp.*/\$ModLoad imtcp/' | sed -e 's/^\#\$InputTCPServerRun\s514.*/\$InputTCPServerRun 514\nlocal2\.\* \@\@localhost\:32000/' > $ROOTFS/etc/rsyslog.conf - - -# adding simplesaml alias to apache -chroot $ROOTFS cp /etc/apache2/sites-available/default /etc/apache2/sites-available/default-org -chroot $ROOTFS cp /etc/apache2/sites-available/default-ssl /etc/apache2/sites-available/default-ssl-org -chroot $ROOTFS cat /etc/apache2/sites-available/default-org | sed -e 's@DocumentRoot \/var\/www@DocumentRoot \/var\/www\/public\n\tAlias \/simplesaml \/var\/www\/simplesamlphp\/www@' > $ROOTFS/etc/apache2/sites-available/default -chroot $ROOTFS cat /etc/apache2/sites-available/default-ssl-org | sed -e 's@DocumentRoot \/var\/www@DocumentRoot \/var\/www\/public\n\tAlias \/simplesaml \/var\/www\/simplesamlphp\/www@' > $ROOTFS/etc/apache2/sites-available/default-ssl - # Enable HTTPS: - chroot $ROOTFS a2enmod ssl - chroot $ROOTFS a2ensite default-ssl - - - # See http://blog.bodhizazen.net/linux/lxc-configure-ubuntu-lucid-containers/ - # This requirement is confirmed on 10.04.1 LTS. Within LXC, the - # upstart "startup" signal is sent, but not "network-interface", etc. - pushd $ROOTFS/etc/init/ - cp -a ufw.conf ufw.conf-dist - sed ' -s/start on (starting network-interface/start on startup\n#start on (starting network-interface/ -s/ or starting network-manager/# or starting network-manager/ -s/ or starting networking)/# or starting network-manager/ -' < ufw.conf-dist > ufw.conf - popd - - pushd $ROOTFS/etc - echo "#!/bin/bash -e -mkdir -p /etc/agent/conf -chmod 755 /opt/wso2-openstack-init.sh -/opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log -exit 0 - " > rc.local - popd - -} - -lamp() { - - cp -f ./init_scripts/lamp/wso2-openstack-init.sh $ROOTFS/opt/ - cp -f ./init_scripts/lamp/get-launch-params.rb $ROOTFS/opt/ - cp -f ./init_scripts/lamp/server $ROOTFS/opt/ - cp -f ./init_scripts/lamp/svn_client.sh $ROOTFS/opt/ - cp -f ./init_scripts/lamp/svn_client_y.sh $ROOTFS/opt/ - cp -f ./init_scripts/lamp/deployer.sh $ROOTFS/opt/ - - # Copy software - arr=$(echo $SOFTWARE | tr ":" "\n") - for x in $arr - do - cp -rf $x $ROOTFS/opt/ - done - - - # MySQL still prompts. Bug. - #DEBCONF_FRONTEND='noninteractive' - - chroot $ROOTFS apt-get update - # Next, all the LAMP packages. We must first pre-save the password - # for MySQL to use: - chroot $ROOTFS echo "mysql-server mysql-server/root_password select ubuntu" | chroot $ROOTFS debconf-set-selections - chroot $ROOTFS echo "mysql-server mysql-server/root_password_again select ubuntu" | chroot $ROOTFS debconf-set-selections - - chroot $ROOTFS apt-get install -y \ - nano zip mysql-server mysql-client \ - apache2 php5 php5-cli libapache2-mod-php5 php5-gd php5-mysql php-db php-pear php5-curl curl wget php5-ldap php5-adodb mailutils \ - php5-imap php5-ldap \ - openssl ssl-cert ldap-utils \ - php5-mcrypt mcrypt ufw fail2ban ruby subversion - - # Be sure to have a new SSL cert for this new LXC host: - #rm -f $ROOTFS/etc/ssl/private/ssl-cert-snakeoil.key - #chroot $ROOTFS dpkg-reconfigure ssl-cert - - # Enable HTTPS: - #chroot $ROOTFS a2enmod ssl - #chroot $ROOTFS a2ensite default-ssl - - # Turn on MySQL replication logs by default. (Necessary for - # incremental backups, even if you're not doing replication.) - pushd $ROOTFS/etc/mysql/conf.d - echo "[mysqld] -log-bin=mysqld-bin -server-id = 1 - -# For an SSH Tunneled slave: -# See also: /etc/rc.local for the SSH Tunnel that makes this work. -#[mysqld] -#master-host = 127.0.0.1 -#master-user = root -#master-password = ubuntu -#master-port = 13306 -#server-id = 2 - " >> replication.cnf - popd - -pushd $ROOTFS/etc - echo "#!/bin/bash -e -/opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log -exit 0 - " > rc.local - popd - - # Next, fix a couple of Debian gotchas: - - # Comment out these two lines. (Don't expire, - # and use the 1G default file size. - pushd $ROOTFS/etc/mysql - cp -a my.cnf my.cnf-dist - sed ' -s/expire_logs_days/#expire_logs_days/ -s/max_binlog_size/#max_binlog_size/ -' < my.cnf-dist > my.cnf - popd - - # See http://blog.bodhizazen.net/linux/lxc-configure-ubuntu-lucid-containers/ - # This requirement is confirmed on 10.04.1 LTS. Within LXC, the - # upstart "startup" signal is sent, but not "network-interface", etc. - pushd $ROOTFS/etc/init/ - cp -a ufw.conf ufw.conf-dist - sed ' -s/start on (starting network-interface/start on startup\n#start on (starting network-interface/ -s/ or starting network-manager/# or starting network-manager/ -s/ or starting networking)/# or starting network-manager/ -' < ufw.conf-dist > ufw.conf - - cp -a mysql.conf mysql.conf-dist - sed --posix -e ' -s/start on (net-device-up/start on startup\n#start on (net-device-up/ -s/ and local-filesystems/# and local-filesystems/ -s/\t and runlevel \[2345\])/#\t and runlevel \[2345\])/ -' < mysql.conf-dist > mysql.conf - popd - -} - -wso2_carbon_server() { - - cp -f ./init_scripts/carbon/wso2-openstack-init.sh $ROOTFS/opt/ - cp -f ./init_scripts/carbon/get-launch-params.rb $ROOTFS/opt/ - # Copy software - arr=$(echo $SOFTWARE | tr ":" "\n") - for x in $arr - do - cp -rf $x $ROOTFS/opt/ - done - - #chroot $ROOTFS apt-get update - - chroot $ROOTFS apt-get install -y \ - nano zip \ - wget \ - openssl ssl-cert ldap-utils ruby git - - # TODO install puppet agent - - # Be sure to have a new SSL cert for this new LXC host: - #rm -f $ROOTFS/etc/ssl/private/ssl-cert-snakeoil.key - #chroot $ROOTFS dpkg-reconfigure ssl-cert - -pushd $ROOTFS/etc - echo "#!/bin/bash -e -/opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log -exit 0 - " > rc.local - popd - -} - -jetty() { - - cp -f ./init_scripts/jetty/wso2-openstack-init.sh $ROOTFS/opt/ - cp -f ./init_scripts/jetty/get-launch-params.rb $ROOTFS/opt/ - cp -f ./init_scripts/jetty/server $ROOTFS/opt/ - cp -f ./init_scripts/jetty/svn_client.sh $ROOTFS/opt/ - cp -f ./init_scripts/jetty/svn_client_y.sh $ROOTFS/opt/ - cp -f ./init_scripts/jetty/deployer.sh $ROOTFS/opt/ - # Copy software - arr=$(echo $SOFTWARE | tr ":" "\n") - for x in $arr - do - cp -rf $x $ROOTFS/opt/ - done - - #chroot $ROOTFS apt-get update - - chroot $ROOTFS apt-get install -y \ - nano zip \ - wget \ - openssl ssl-cert ldap-utils ruby subversion - -pushd $ROOTFS/etc - echo "#!/bin/bash -e -/opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log -exit 0 - " > rc.local - popd - -} - - -tomcat7() { - - #chroot $ROOTFS echo "nameserver 8.8.8.8" >> $ROOTFS/etc/resolvconf/resolv.conf.d/base - echo "Please fix the resolve conf file" - read - #chroot $ROOTFS mkdir -p /run/resolveconf - #chroot $ROORFS touch /run/resolveconf/resolv.conf - #chroot echo "nameserver 8.8.8.8" > /run/resolveconf/resolv.conf - - echo "------------------------------------------" - chroot $ROOTFS cat /etc/resolv.conf - echo "------------------------------------------" - - - mount -o bind /dev $ROOTFS/dev - - - mount -t proc none $ROOTFS/proc - - - cp -f ./init_scripts/tomcat7/wso2-openstack-init.sh $ROOTFS/opt/ - cp -f ./init_scripts/tomcat7/get-launch-params.rb $ROOTFS/opt/ - - - chroot $ROOTFS apt-get update - # Next, all the packages. - - chroot $ROOTFS apt-get install -y \ - nano zip git\ - ruby curl wget tomcat7 - - # See http://blog.bodhizazen.net/linux/lxc-configure-ubuntu-lucid-containers/ - # This requirement is confirmed on 10.04.1 LTS. Within LXC, the - # upstart "startup" signal is sent, but not "network-interface", etc. - pushd $ROOTFS/etc/init/ - cp -a ufw.conf ufw.conf-dist - sed ' -s/start on (starting network-interface/start on startup\n#start on (starting network-interface/ -s/ or starting network-manager/# or starting network-manager/ -s/ or starting networking)/# or starting network-manager/ -' < ufw.conf-dist > ufw.conf - popd - - pushd $ROOTFS/etc - echo "#!/bin/bash -e -mkdir -p /etc/agent/conf -chmod 755 /opt/wso2-openstack-init.sh -/opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log -exit 0 - " > rc.local - popd - - umount $ROOTFS/dev - umount $ROOTFS/proc -} - - -# Don't prompt when running apt-get: -export DEBCONF_FRONTEND='noninteractive' - -# Run the config function with given $TEMPLATE name (if it exists): -$TEMPLATE - http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c01173ce/tools/cartridge-create/create-kvm-image.sh ---------------------------------------------------------------------- diff --git a/tools/cartridge-create/create-kvm-image.sh b/tools/cartridge-create/create-kvm-image.sh new file mode 100755 index 0000000..795f42c --- /dev/null +++ b/tools/cartridge-create/create-kvm-image.sh @@ -0,0 +1,24 @@ +#!/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. +# ---------------------------------------------------------------------------- + + +./stratos-image create 192.168.16.131 mysql ubuntu stratos.pem +#./stratos-image upload 192.168.16.131 precise-server-mysql-cloudimg-amd64 http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c01173ce/tools/cartridge-create/create_kvm_image.sh ---------------------------------------------------------------------- diff --git a/tools/cartridge-create/create_kvm_image.sh b/tools/cartridge-create/create_kvm_image.sh deleted file mode 100755 index 795f42c..0000000 --- a/tools/cartridge-create/create_kvm_image.sh +++ /dev/null @@ -1,24 +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. -# ---------------------------------------------------------------------------- - - -./stratos-image create 192.168.16.131 mysql ubuntu stratos.pem -#./stratos-image upload 192.168.16.131 precise-server-mysql-cloudimg-amd64 http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c01173ce/tools/cartridge-create/image-action.sh ---------------------------------------------------------------------- diff --git a/tools/cartridge-create/image-action.sh b/tools/cartridge-create/image-action.sh new file mode 100755 index 0000000..a6c8261 --- /dev/null +++ b/tools/cartridge-create/image-action.sh @@ -0,0 +1,165 @@ +#!/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. +# ---------------------------------------------------------------------------- + + +# Die on any error: +set -e + +work_dir="" +action="" +image_template="" +image_root="" +software="" +image_type="" +loopdevice="/dev/loop1" +nbddevice="/dev/nbd3" +nbdmount="/dev/nbd3p1" + +function image_validate { + if [ -z $action ]; then + echo "usage: image_action.sh action=<mount|create|unmount> <options>" + exit 1 + fi + + if [[ !($action == "mount") && !($action == "create") && !($action == "unmount") ]]; then + echo "usage: image_action.sh action=<mount|create|unmount> <options>" + exit 1 + fi + + if [[ (-n $action) && ($action == "create") && ( -z $image_template || -z $image_root ) ]]; then + echo "usage: image_action.sh action=create template=<template> image-root=<image_root>" + exit 1 + fi + + if [[ (-n $action) && ($action == "unmount") && (-z $image_template || -z $image_root) ]]; then + echo "usage: image_action.sh action=unmount image-id=<image_template> image-root=<image_root>" + exit 1 + fi + + if [[ (-n $action) && ($action == "mount") && (-z $image_template || -z $image_root || -z $image_image) ]]; then + echo "usage: image_action.sh action=mount image-template=<image_template> image-root=<image_root> image-image=<image_image>" + exit 1 + fi + +} + +for var in $@; do + set -- `echo $var | tr '=' ' '` + key=$1 + value=$2 + + if [ $key = "action" ]; then + action="$value" + echo "action:" $action + fi + + if [ $key = "image-root" ]; then + image_root="$value" + echo "image root:" $image_root + fi + + if [ $key = "image-template" ]; then + image_template="$value" + echo "template:" $image_template + fi + + if [ $key = "image-image" ]; then + image_image="$value" + echo "image-image:" $image_image + fi + + if [ $key = "software" ]; then + software="$value" + echo "software:" $software + fi + + if [ $key = "image-type" ]; then + image_type="$value" + echo "image_type:" $image_type + fi + +done + +image_validate + +work_dir="$image_root/$image_template" +if [[ (-n $action) && ($action == "unmount") ]]; then + echo "# unmount $image_template" + if [ -d $work_dir/$image_template ]; then + if [ $image_type == "qcow2" ]; then + umount $work_dir/$image_template + qemu-nbd -d $nbddevice + rmmod nbd + else + echo 'this action unmount image!' + umount $work_dir/$image_template/dev + umount $work_dir/$image_template/proc + umount $work_dir/$image_template/sys + umount $work_dir/$image_template + if [ -d $work_dir/$image_template/dev ]; then + umount -l $work_dir/$image_template + fi + losetup -d $loopdevice + fi + fi + exit 0 +fi + +if [[ (-n $action) && ($action == "mount") ]]; then + echo "# mount $image_template " + if [ ! -d "$work_dir/$image_template" ]; then + mkdir -p $work_dir/$image_template + fi + #cp -f $image_image $work_dir/ + if [ $image_type == "qcow2" ]; then + modprobe nbd max_part=8 + qemu-nbd -c $nbddevice $image_image + mount $nbdmount $work_dir/$image_template + else + #loopdevice=`losetup -f` + echo "Available loop device is $loopdevice" + losetup $loopdevice $image_image + #kpartx -av $loopdevice + mount $loopdevice $work_dir/$image_template + mount -o bind /dev $work_dir/$image_template/dev + mount -o bind /proc $work_dir/$image_template/proc + mount -o bind /sys $work_dir/$image_template/sys + fi + exit 0 +fi + +# Where to create newly-created LXC container rootfs filesystems, fstabs, and confs: +export BASEDIR=$work_dir + +# This is a list of semi-colon separated files/directories that will be needed by templates. +export SOFTWARE="$software" +export ROOTFS=$work_dir/$image_template +export TEMPLATE=$image_template + +if [ -z "$TEMPLATE" ]; then + TEMPLATE="default" +fi + +./configure_software $ROOTFS $TEMPLATE +echo + +exit + http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c01173ce/tools/cartridge-create/image_action.sh ---------------------------------------------------------------------- diff --git a/tools/cartridge-create/image_action.sh b/tools/cartridge-create/image_action.sh deleted file mode 100755 index a6c8261..0000000 --- a/tools/cartridge-create/image_action.sh +++ /dev/null @@ -1,165 +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. -# ---------------------------------------------------------------------------- - - -# Die on any error: -set -e - -work_dir="" -action="" -image_template="" -image_root="" -software="" -image_type="" -loopdevice="/dev/loop1" -nbddevice="/dev/nbd3" -nbdmount="/dev/nbd3p1" - -function image_validate { - if [ -z $action ]; then - echo "usage: image_action.sh action=<mount|create|unmount> <options>" - exit 1 - fi - - if [[ !($action == "mount") && !($action == "create") && !($action == "unmount") ]]; then - echo "usage: image_action.sh action=<mount|create|unmount> <options>" - exit 1 - fi - - if [[ (-n $action) && ($action == "create") && ( -z $image_template || -z $image_root ) ]]; then - echo "usage: image_action.sh action=create template=<template> image-root=<image_root>" - exit 1 - fi - - if [[ (-n $action) && ($action == "unmount") && (-z $image_template || -z $image_root) ]]; then - echo "usage: image_action.sh action=unmount image-id=<image_template> image-root=<image_root>" - exit 1 - fi - - if [[ (-n $action) && ($action == "mount") && (-z $image_template || -z $image_root || -z $image_image) ]]; then - echo "usage: image_action.sh action=mount image-template=<image_template> image-root=<image_root> image-image=<image_image>" - exit 1 - fi - -} - -for var in $@; do - set -- `echo $var | tr '=' ' '` - key=$1 - value=$2 - - if [ $key = "action" ]; then - action="$value" - echo "action:" $action - fi - - if [ $key = "image-root" ]; then - image_root="$value" - echo "image root:" $image_root - fi - - if [ $key = "image-template" ]; then - image_template="$value" - echo "template:" $image_template - fi - - if [ $key = "image-image" ]; then - image_image="$value" - echo "image-image:" $image_image - fi - - if [ $key = "software" ]; then - software="$value" - echo "software:" $software - fi - - if [ $key = "image-type" ]; then - image_type="$value" - echo "image_type:" $image_type - fi - -done - -image_validate - -work_dir="$image_root/$image_template" -if [[ (-n $action) && ($action == "unmount") ]]; then - echo "# unmount $image_template" - if [ -d $work_dir/$image_template ]; then - if [ $image_type == "qcow2" ]; then - umount $work_dir/$image_template - qemu-nbd -d $nbddevice - rmmod nbd - else - echo 'this action unmount image!' - umount $work_dir/$image_template/dev - umount $work_dir/$image_template/proc - umount $work_dir/$image_template/sys - umount $work_dir/$image_template - if [ -d $work_dir/$image_template/dev ]; then - umount -l $work_dir/$image_template - fi - losetup -d $loopdevice - fi - fi - exit 0 -fi - -if [[ (-n $action) && ($action == "mount") ]]; then - echo "# mount $image_template " - if [ ! -d "$work_dir/$image_template" ]; then - mkdir -p $work_dir/$image_template - fi - #cp -f $image_image $work_dir/ - if [ $image_type == "qcow2" ]; then - modprobe nbd max_part=8 - qemu-nbd -c $nbddevice $image_image - mount $nbdmount $work_dir/$image_template - else - #loopdevice=`losetup -f` - echo "Available loop device is $loopdevice" - losetup $loopdevice $image_image - #kpartx -av $loopdevice - mount $loopdevice $work_dir/$image_template - mount -o bind /dev $work_dir/$image_template/dev - mount -o bind /proc $work_dir/$image_template/proc - mount -o bind /sys $work_dir/$image_template/sys - fi - exit 0 -fi - -# Where to create newly-created LXC container rootfs filesystems, fstabs, and confs: -export BASEDIR=$work_dir - -# This is a list of semi-colon separated files/directories that will be needed by templates. -export SOFTWARE="$software" -export ROOTFS=$work_dir/$image_template -export TEMPLATE=$image_template - -if [ -z "$TEMPLATE" ]; then - TEMPLATE="default" -fi - -./configure_software $ROOTFS $TEMPLATE -echo - -exit - http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c01173ce/tools/cartridge-create/init-scripts/php/cartridge-data-publisher-1.0.2.zip ---------------------------------------------------------------------- diff --git a/tools/cartridge-create/init-scripts/php/cartridge-data-publisher-1.0.2.zip b/tools/cartridge-create/init-scripts/php/cartridge-data-publisher-1.0.2.zip new file mode 100644 index 0000000..08d8b1d Binary files /dev/null and b/tools/cartridge-create/init-scripts/php/cartridge-data-publisher-1.0.2.zip differ http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c01173ce/tools/cartridge-create/init-scripts/php/cartridge_data_publisher_1.0.2.zip ---------------------------------------------------------------------- diff --git a/tools/cartridge-create/init-scripts/php/cartridge_data_publisher_1.0.2.zip b/tools/cartridge-create/init-scripts/php/cartridge_data_publisher_1.0.2.zip deleted file mode 100644 index 08d8b1d..0000000 Binary files a/tools/cartridge-create/init-scripts/php/cartridge_data_publisher_1.0.2.zip and /dev/null differ
