Repository: stratos Updated Branches: refs/heads/master a37337d05 -> d8443ac36
add initial puppetmaster docker image Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/d8443ac3 Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/d8443ac3 Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/d8443ac3 Branch: refs/heads/master Commit: d8443ac360bb52debca0c9b962b841c7888fd209 Parents: a37337d Author: Chris Snow <[email protected]> Authored: Mon Aug 25 19:32:24 2014 +0000 Committer: Chris Snow <[email protected]> Committed: Mon Aug 25 19:32:24 2014 +0000 ---------------------------------------------------------------------- tools/stratos-docker-images/build-all.sh | 4 ++ .../puppetmaster/Dockerfile | 51 +++++++++++++++++ .../puppetmaster/addpuppetdomain.txt | 5 ++ .../puppetmaster/docker-build.sh | 60 ++++++++++++++++++++ .../puppetmaster/files/.gitignore | 25 ++++++++ tools/stratos-docker-images/puppetmaster/run | 58 +++++++++++++++++++ .../puppetmaster/run-example.sh | 42 ++++++++++++++ tools/stratos-docker-images/push-all.sh | 4 ++ 8 files changed, 249 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/d8443ac3/tools/stratos-docker-images/build-all.sh ---------------------------------------------------------------------- diff --git a/tools/stratos-docker-images/build-all.sh b/tools/stratos-docker-images/build-all.sh index 0c12c32..5e9cf3a 100755 --- a/tools/stratos-docker-images/build-all.sh +++ b/tools/stratos-docker-images/build-all.sh @@ -28,6 +28,10 @@ cd bind ./docker-build.sh cd .. +cd puppetmaster +./docker-build.sh +cd .. + cd mysql ./docker-build.sh cd .. http://git-wip-us.apache.org/repos/asf/stratos/blob/d8443ac3/tools/stratos-docker-images/puppetmaster/Dockerfile ---------------------------------------------------------------------- diff --git a/tools/stratos-docker-images/puppetmaster/Dockerfile b/tools/stratos-docker-images/puppetmaster/Dockerfile new file mode 100755 index 0000000..2fbd4d5 --- /dev/null +++ b/tools/stratos-docker-images/puppetmaster/Dockerfile @@ -0,0 +1,51 @@ +# ---------------------------------------------------------------------------- +# +# 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. +# +# ---------------------------------------------------------------------------- + +FROM ubuntu:14.04 + +RUN apt-get update -qq +RUN apt-get install -y wget + +RUN wget http://apt.puppetlabs.com/puppetlabs-release-precise.deb +RUN dpkg -i puppetlabs-release-precise.deb +RUN apt-get update -qq +RUN apt-get install -y puppetmaster + +RUN mkdir -p /etc/puppet/modules/agent/files +RUN mkdir -p /etc/puppet/modules/java/files +RUN mkdir -p /etc/puppet/modules/tomcat/files + +COPY files/manifests /etc/puppet/manifests +COPY files/modules /etc/puppet/modules + +ADD files/jdk-7u51-linux-x64.tar.gz /etc/puppet/modules/java/files/ +ADD files/apache-tomcat-7.0.52.tar.gz /etc/puppet/modules/tomcat/files/ + +ADD files/agentfiles.tgz /tmp/ + +RUN mv /tmp/apache-stratos-cartridge-agent-*.zip /etc/puppet/modules/agent/files/ +RUN mv /tmp/apache-stratos-load-balancer-*.zip /etc/puppet/modules/agent/files/ + +ADD run /usr/local/bin/run +RUN chmod +x /usr/local/bin/run + +CMD ["/usr/local/bin/run"] + http://git-wip-us.apache.org/repos/asf/stratos/blob/d8443ac3/tools/stratos-docker-images/puppetmaster/addpuppetdomain.txt ---------------------------------------------------------------------- diff --git a/tools/stratos-docker-images/puppetmaster/addpuppetdomain.txt b/tools/stratos-docker-images/puppetmaster/addpuppetdomain.txt new file mode 100644 index 0000000..90112eb --- /dev/null +++ b/tools/stratos-docker-images/puppetmaster/addpuppetdomain.txt @@ -0,0 +1,5 @@ +server 127.0.0.1 +zone example.com +prereq nxdomain puppetmaster.example.com. +update add puppetmaster.example.com. 10 A 192.168.56.10 +send http://git-wip-us.apache.org/repos/asf/stratos/blob/d8443ac3/tools/stratos-docker-images/puppetmaster/docker-build.sh ---------------------------------------------------------------------- diff --git a/tools/stratos-docker-images/puppetmaster/docker-build.sh b/tools/stratos-docker-images/puppetmaster/docker-build.sh new file mode 100755 index 0000000..62be759 --- /dev/null +++ b/tools/stratos-docker-images/puppetmaster/docker-build.sh @@ -0,0 +1,60 @@ +#!/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. +# +# ---------------------------------------------------------------------------- + +set -e # exit on error + +if [[ -z $STRATOS_SOURCE ]]; then + echo "STRATOS_SOURCE environment variable must be set" + exit 1 +fi + +ACTIVEMQ_URL="http://archive.apache.org/dist/activemq/5.9.1/apache-activemq-5.9.1-bin.tar.gz" + +MYSQLJ_URL="http://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.29/mysql-connector-java-5.1.29.jar" + +# if you change the tomcat version, you will need to change the version in the Dockerfile too +TOMCAT_URL="http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.52/bin/apache-tomcat-7.0.52.tar.gz" + +HAWTBUF_URL="http://repo1.maven.org/maven2/org/fusesource/hawtbuf/hawtbuf/1.2/hawtbuf-1.2.jar" + +# if you change the JDK version, you will need to change the version in the Dockerfile too +JDK_URL="http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.tar.gz" + +wget -N -c -P files $TOMCAT_URL + +wget -N -c -P files \ + --no-cookies --no-check-certificate \ + --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" \ + ${JDK_URL} + +cp -rf $STRATOS_SOURCE/tools/puppet3/manifests files/ +cp -rf $STRATOS_SOURCE/tools/puppet3/modules files/ + +cp -f $STRATOS_SOURCE/products/cartridge-agent/modules/distribution/target/apache-stratos-cartridge-agent-*.zip files/ + +cp -f $STRATOS_SOURCE/products/load-balancer/modules/distribution/target/apache-stratos-load-balancer-*.zip files/ + +cd files/ +tar -cvzf agentfiles.tgz apache-stratos-cartridge-agent-*.zip apache-stratos-load-balancer-*.zip +cd .. + +docker build -t=apachestratos/puppetmaster . http://git-wip-us.apache.org/repos/asf/stratos/blob/d8443ac3/tools/stratos-docker-images/puppetmaster/files/.gitignore ---------------------------------------------------------------------- diff --git a/tools/stratos-docker-images/puppetmaster/files/.gitignore b/tools/stratos-docker-images/puppetmaster/files/.gitignore new file mode 100755 index 0000000..9fcfe3a --- /dev/null +++ b/tools/stratos-docker-images/puppetmaster/files/.gitignore @@ -0,0 +1,25 @@ +# ---------------------------------------------------------------------------- +# +# 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. +# +# ---------------------------------------------------------------------------- + +# Ignore everything in this directory +* +# Except this file +!.gitignore http://git-wip-us.apache.org/repos/asf/stratos/blob/d8443ac3/tools/stratos-docker-images/puppetmaster/run ---------------------------------------------------------------------- diff --git a/tools/stratos-docker-images/puppetmaster/run b/tools/stratos-docker-images/puppetmaster/run new file mode 100755 index 0000000..80a4840 --- /dev/null +++ b/tools/stratos-docker-images/puppetmaster/run @@ -0,0 +1,58 @@ +#!/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. +# +# ---------------------------------------------------------------------------- + +set -e + +TIMEZONE=${TIMEZONE:-"Etc/UTC"} + +echo ============================= +echo Environment Variable Settings +echo ============================= +echo Setting DOMAIN=${DOMAIN} +echo Setting MASTERHOSTNAME=${MASTERHOSTNAME} +echo Setting TIMEZONE=${TIMEZONE} +echo Setting MB_HOSTNAME=${MB_HOSTNAME} +echo Setting MB_PORT=${MB_PORT} +echo Setting TRUSTSTORE_PASSWORD=${TRUSTSTORE_PASSWORD} +echo ============================= + +echo "${TIMEZONE}" > /etc/timezone +dpkg-reconfigure --frontend noninteractive tzdata + +sed -i 's/START=no/START=yes/' /etc/default/puppetmaster +echo -e "*.${DOMAIN}" > /etc/puppet/autosign.conf +sed -i "2i server=${MASTERHOSTNAME}" /etc/puppet/puppet.conf +sed -i "3i dns_alt_names=${MASTERHOSTNAME}" /etc/puppet/puppet.conf + + +PUPPET_FILE=/etc/puppet/manifests/nodes/base.pp + +# TODO java version is hard coded +sed -i -E "s:(\s*[$]java_name.*=).*$:\1 \"jdk1.7.0_51\":g" $PUPPET_FILE +sed -i -E "s:(\s*[$]java_distribution.*=).*$:\1 \"jdk-7u51-linux-x64.tar.gz\":g" $PUPPET_FILE + +sed -i -E "s:(\s*[$]local_package_dir.*=).*$:\1 \"/mnt/packs\":g" $PUPPET_FILE +sed -i -E "s:(\s*[$]mb_ip.*=).*$:\1 \"$MB_HOSTNAME\":g" $PUPPET_FILE +sed -i -E "s:(\s*[$]mb_port.*=).*$:\1 \"$MB_PORT\":g" $PUPPET_FILE +sed -i -E "s:(\s*[$]truststore_password.*=).*$:\1 \"$TRUSTSTORE_PASSWORD\":g" $PUPPET_FILE + +puppet master --no-daemonize --logdest console http://git-wip-us.apache.org/repos/asf/stratos/blob/d8443ac3/tools/stratos-docker-images/puppetmaster/run-example.sh ---------------------------------------------------------------------- diff --git a/tools/stratos-docker-images/puppetmaster/run-example.sh b/tools/stratos-docker-images/puppetmaster/run-example.sh new file mode 100755 index 0000000..b7dc3fc --- /dev/null +++ b/tools/stratos-docker-images/puppetmaster/run-example.sh @@ -0,0 +1,42 @@ +#!/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. +# +# ---------------------------------------------------------------------------- + +DOMAIN=example.com +MASTERHOSTNAME=puppet.example.com + +MB_HOSTNAME= +MB_PORT= +TRUSTSTORE_PASSWORD=wso2carbon + + +# To run interactively: +# docker run -i -t -e "DOMAIN=${DOMAIN}" -e "MASTERHOSTNAME=${MASTERHOSTNAME}" -p 8140 apachestratos/puppet /bin/bash + +PUPPET_ID=$(docker run -d --dns=${IP_ADDR} -e "DOMAIN=${DOMAIN}" -e "MASTERHOSTNAME=${MASTERHOSTNAME}" -p 8140 apachestratos/puppet) +PUPPET_IP_ADDR=$(docker inspect --format '{{ .NetworkSettings.Gateway }}' $PUPPET_ID) +PUPPET_PORT=$(docker port $PUPPET_ID 8140 | awk -F':' '{ print $2 }') + +# TODO create a docker cartridge +# add dns record for cartridge, e.g. cartridge1.$DOMAIN +# start puppet agent in cartridge to test puppetmaster: +# puppet agent --server ${MASTERHOSTNAME} --masterport ${PUPPET_PORT} --test --verbose --debug + http://git-wip-us.apache.org/repos/asf/stratos/blob/d8443ac3/tools/stratos-docker-images/push-all.sh ---------------------------------------------------------------------- diff --git a/tools/stratos-docker-images/push-all.sh b/tools/stratos-docker-images/push-all.sh index 7048f25..706e75b 100755 --- a/tools/stratos-docker-images/push-all.sh +++ b/tools/stratos-docker-images/push-all.sh @@ -26,6 +26,10 @@ cd bind docker push apachestratos/bind cd .. +cd puppetmaster +docker push apachestratos/puppetmaster +cd .. + cd mysql docker push apachestratos/mysql cd ..
