Repository: stratos Updated Branches: refs/heads/master 06db39250 -> 8006ca82d
add initial bind9 docker image Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/8006ca82 Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/8006ca82 Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/8006ca82 Branch: refs/heads/master Commit: 8006ca82d5d64cf1ea93be3a1c1e59db3e89c354 Parents: 06db392 Author: Chris Snow <[email protected]> Authored: Mon Aug 25 18:07:45 2014 +0000 Committer: Chris Snow <[email protected]> Committed: Mon Aug 25 18:07:45 2014 +0000 ---------------------------------------------------------------------- tools/stratos-docker-images/bind/Dockerfile | 37 ++++++++++ tools/stratos-docker-images/bind/README | 22 ++++++ .../stratos-docker-images/bind/docker-build.sh | 23 ++++++ .../stratos-docker-images/bind/inaddr_template | 13 ++++ tools/stratos-docker-images/bind/run | 77 ++++++++++++++++++++ tools/stratos-docker-images/bind/run-example.sh | 35 +++++++++ tools/stratos-docker-images/bind/zone_template | 14 ++++ tools/stratos-docker-images/build-all.sh | 4 + tools/stratos-docker-images/push-all.sh | 10 ++- 9 files changed, 232 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/8006ca82/tools/stratos-docker-images/bind/Dockerfile ---------------------------------------------------------------------- diff --git a/tools/stratos-docker-images/bind/Dockerfile b/tools/stratos-docker-images/bind/Dockerfile new file mode 100755 index 0000000..eb25bd4 --- /dev/null +++ b/tools/stratos-docker-images/bind/Dockerfile @@ -0,0 +1,37 @@ +# ---------------------------------------------------------------------------- +# +# 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 +RUN apt-get install -y bind9 + +COPY zone_template /etc/bind/zone_template + +# disable reverse address lookups - this may not be possible without ISP delegating the reverse done +#COPY inaddr_template /etc/bind/inaddr_template + +EXPOSE 53/udp + +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/8006ca82/tools/stratos-docker-images/bind/README ---------------------------------------------------------------------- diff --git a/tools/stratos-docker-images/bind/README b/tools/stratos-docker-images/bind/README new file mode 100644 index 0000000..1dc8374 --- /dev/null +++ b/tools/stratos-docker-images/bind/README @@ -0,0 +1,22 @@ +Usage: +------ + +See run-example.sh for an example docker run script. + +Update A records: +----------------- + +To add a 'A' record to the dns server (e.g. for the puppetmaster): + +cat >> addpuppetdomain.txt <<EOF +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 +EOF + +nsupdate addpuppetdomain.txt + +dig @localhost ANY puppetmaster.example.com + http://git-wip-us.apache.org/repos/asf/stratos/blob/8006ca82/tools/stratos-docker-images/bind/docker-build.sh ---------------------------------------------------------------------- diff --git a/tools/stratos-docker-images/bind/docker-build.sh b/tools/stratos-docker-images/bind/docker-build.sh new file mode 100755 index 0000000..0edb9e7 --- /dev/null +++ b/tools/stratos-docker-images/bind/docker-build.sh @@ -0,0 +1,23 @@ +#!/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. +# +# ---------------------------------------------------------------------------- + +docker build -t=apachestratos/bind . http://git-wip-us.apache.org/repos/asf/stratos/blob/8006ca82/tools/stratos-docker-images/bind/inaddr_template ---------------------------------------------------------------------- diff --git a/tools/stratos-docker-images/bind/inaddr_template b/tools/stratos-docker-images/bind/inaddr_template new file mode 100644 index 0000000..7f30a53 --- /dev/null +++ b/tools/stratos-docker-images/bind/inaddr_template @@ -0,0 +1,13 @@ +$TTL 10 ; +; $TTL used for all RRs without explicit TTL value +$ORIGIN @[email protected]. +@ 1D IN SOA ns.@DOMAIN@. hostmaster.@DOMAIN@. ( + 2002022401 ; serial + 10 ; refresh + 15 ; retry + 10 ; expire + 10 ; minimum + ) + +@[email protected]. IN NS ns.@DOMAIN@. + http://git-wip-us.apache.org/repos/asf/stratos/blob/8006ca82/tools/stratos-docker-images/bind/run ---------------------------------------------------------------------- diff --git a/tools/stratos-docker-images/bind/run b/tools/stratos-docker-images/bind/run new file mode 100755 index 0000000..757b2d1 --- /dev/null +++ b/tools/stratos-docker-images/bind/run @@ -0,0 +1,77 @@ +#!/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 + +# See http://www.zytrax.com/books/dns/ch7/address_match_list.html +UPDATE_ADDR_LIST=${UPDATE_ADDR_LIST:-none} + +export REV_IP_ADDR=$(echo $IP_ADDR | awk -F . '{print $4 "." $3 "." $2 "." $1}') + +# disable reverse address lookups - this may not be possible without ISP delegating the reverse done +#export REV_SUBNET_ADDR=$(echo $SUBNET_ADDR | awk -F . '{print $4 "." $3 "." $2 "." $1}' | sed 's/^\.*//g') + +echo ============================= +echo Environment Variable Settings +echo ============================= +echo Setting DOMAIN=$DOMAIN +echo Setting IP_ADDR=$IP_ADDR +#echo Setting REV_IP_ADDR=$REV_IP_ADDR +#echo Setting SUBNET_ADDR=$SUBNET_ADDR +#echo Setting REV_SUBNET_ADDR=$REV_SUBNET_ADDR +echo Setting UPDATE_ADDR_LIST=$UPDATE_ADDR_LIST +echo ========================= + +cp /etc/bind/zone_template /var/cache/bind/db.$DOMAIN + +# disable reverse address lookup +#cp /etc/bind/inaddr_template /var/cache/bind/db.$SUBNET_ADDR + +sed -i "s/@DOMAIN@/$DOMAIN/g" /var/cache/bind/db.$DOMAIN +sed -i "s/@IP_ADDR@/$IP_ADDR/g" /var/cache/bind/db.$DOMAIN + +# disable reverse address lookup +#sed -i "s/@REV_IP_ADDR@/$REV_IP_ADDR/g" /var/cache/bind/db.$SUBNET_ADDR +#sed -i "s/@REV_SUBNET_ADDR@/$REV_SUBNET_ADDR/g" /var/cache/bind/db.$SUBNET_ADDR +#sed -i "s/@DOMAIN@/$DOMAIN/g" /var/cache/bind/db.$SUBNET_ADDR + +cat > /etc/bind/named.conf.local <<EOF +zone "$DOMAIN" in { + type master; + file "db.$DOMAIN"; + allow-update {$UPDATE_ADDR_LIST;}; +}; +EOF + +# disable reverse address lookup +#cat >> /etc/bind/named.conf.local <<EOF +#zone "$REV_SUBNET_ADDR.in-addr.arpa" in { +# type master; +# notify no; +# file "db.$SUBNET_ADDR"; +#}; +#EOF + +# server will not start with IPV6 enabled +#sed -i 's/OPTIONS="-u bind"/OPTIONS="-u bind -4"/g' /etc/default/bind9 + +exec /usr/sbin/named -u bind -g http://git-wip-us.apache.org/repos/asf/stratos/blob/8006ca82/tools/stratos-docker-images/bind/run-example.sh ---------------------------------------------------------------------- diff --git a/tools/stratos-docker-images/bind/run-example.sh b/tools/stratos-docker-images/bind/run-example.sh new file mode 100755 index 0000000..85d618f --- /dev/null +++ b/tools/stratos-docker-images/bind/run-example.sh @@ -0,0 +1,35 @@ +#!/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 is the domain name for the stratos environment +DOMAIN=example.com + +# IP_ADDR is the IP address of the host running the DNS docker image +IP_ADDR=192.168.56.5 + +# UPDATE_ADDR_LIST is the list of addresses that can dynamically update the DNS server (see http://www.zytrax.com/books/dns/ch7/address_match_list.html) +UPDATE_ADDR_LIST=any + + +BIND_ID=$(docker run -d -p 53:53/udp -e "DOMAIN=$DOMAIN" -e "IP_ADDR=$IP_ADDR" -e "UPDATE_ADDR_LIST=$UPDATE_ADDR_LIST" apachestratos/bind) +BIND_IP_ADDR=$(docker inspect --format '{{ .NetworkSettings.Gateway }}' $BIND_ID) + http://git-wip-us.apache.org/repos/asf/stratos/blob/8006ca82/tools/stratos-docker-images/bind/zone_template ---------------------------------------------------------------------- diff --git a/tools/stratos-docker-images/bind/zone_template b/tools/stratos-docker-images/bind/zone_template new file mode 100644 index 0000000..995268b --- /dev/null +++ b/tools/stratos-docker-images/bind/zone_template @@ -0,0 +1,14 @@ +$TTL 10 ; +; $TTL used for all RRs without explicit TTL value +$ORIGIN @DOMAIN@. +@ 1D IN SOA ns.@DOMAIN@. hostmaster.@DOMAIN@. ( + 2002022401 ; serial + 10 ; refresh + 15 ; retry + 10 ; expire + 10 ; minimum + ) + + IN NS ns.@DOMAIN@. + +ns IN A @IP_ADDR@ http://git-wip-us.apache.org/repos/asf/stratos/blob/8006ca82/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 655365e..0c12c32 100755 --- a/tools/stratos-docker-images/build-all.sh +++ b/tools/stratos-docker-images/build-all.sh @@ -24,6 +24,10 @@ set -e export STRATOS_SOURCE="$(cd ../../; pwd)" +cd bind +./docker-build.sh +cd .. + cd mysql ./docker-build.sh cd .. http://git-wip-us.apache.org/repos/asf/stratos/blob/8006ca82/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 044ef8c..7048f25 100755 --- a/tools/stratos-docker-images/push-all.sh +++ b/tools/stratos-docker-images/push-all.sh @@ -22,14 +22,18 @@ set -e +cd bind +docker push apachestratos/bind +cd .. + cd mysql -sudo docker push apachestratos/mysql +docker push apachestratos/mysql cd .. cd activemq -sudo docker push apachestratos/activemq +docker push apachestratos/activemq cd .. cd stratos -sudo docker push apachestratos/stratos +docker push apachestratos/stratos cd ..
