From 58e97c473bf5b28b2cb629057afa0a478e953288 Mon Sep 17 00:00:00 2001 From: Kurt Moeller Date: Fri, 30 Nov 2018 16:29:37 -0800 Subject: [PATCH 1/5] add some new DNS create / reprovision scripts to work with docker for mac --- reprovision_network_onmac.bash | 11 +++++++++++ start_dns_onmac.bash | 22 ++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 reprovision_network_onmac.bash create mode 100644 start_dns_onmac.bash diff --git a/reprovision_network_onmac.bash b/reprovision_network_onmac.bash new file mode 100644 index 0000000..5825bc6 --- /dev/null +++ b/reprovision_network_onmac.bash @@ -0,0 +1,11 @@ +#!/bin/bash + +echo "### network ###" +echo Just ensuring that the required network exists ... +./create_network.bash + +echo "### kill dns ###" +./kill_dns.bash + +echo "### start dns ###" +./start_dns_onmac.bash diff --git a/start_dns_onmac.bash b/start_dns_onmac.bash new file mode 100644 index 0000000..33044ef --- /dev/null +++ b/start_dns_onmac.bash @@ -0,0 +1,22 @@ +#!/bin/bash +source ./settings.bash + +## Prepare directories +if [ ! -d "/tmp/docker" ]; then + mkdir /tmp/docker + mkdir /tmp/docker/bind + #chgrp docker /tmp/docker/bind +fi + + +## Calculate the IP +net_ip_pre=`echo $NET_CIDR | cut -f 1 -d'/' | cut -f 1-3 -d'.'` +net_ip=${net_ip_pre}.201 +echo ip = $net_ip + +## Run +docker run --name bind -d --restart=always \ + --network $NET_NAME --ip $net_ip \ + --publish 10000:10000/tcp \ + --volume /tmp/docker/bind:/data \ + sameersbn/bind:9.10.3-20180127 From f243551669958e2b7f49cb6d7a5d294b77203530 Mon Sep 17 00:00:00 2001 From: Kurt Moeller Date: Fri, 30 Nov 2018 16:36:13 -0800 Subject: [PATCH 2/5] exec --- reprovision_network_onmac.bash | 0 start_dns_onmac.bash | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 reprovision_network_onmac.bash mode change 100644 => 100755 start_dns_onmac.bash diff --git a/reprovision_network_onmac.bash b/reprovision_network_onmac.bash old mode 100644 new mode 100755 diff --git a/start_dns_onmac.bash b/start_dns_onmac.bash old mode 100644 new mode 100755 From 9f6bd4928882206aec48b4c8ffd6d4ecf8b5b6c9 Mon Sep 17 00:00:00 2001 From: Kurt Moeller Date: Tue, 12 Feb 2019 17:42:27 -0800 Subject: [PATCH 3/5] Make DNS bind directory configurable. Update start scripts to use this new env var. --- settings.bash | 4 ++++ start_dns.bash | 13 ++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/settings.bash b/settings.bash index 8f0d9d0..4f80a64 100644 --- a/settings.bash +++ b/settings.bash @@ -1,4 +1,8 @@ +## DNS +export DNS_TEMP_DIR=/tmp/sameers-dns-docker/ + + ## CLUSTER1 # Misc diff --git a/start_dns.bash b/start_dns.bash index 0a0fd67..4e9e1ec 100755 --- a/start_dns.bash +++ b/start_dns.bash @@ -2,9 +2,12 @@ source ./settings.bash ## Prepare directories -mkdir /srv/docker -mkdir /srv/docker/bind -chgrp docker /srv/docker/bind +if [ ! -d $DNS_TEMP_DIR ]; then + mkdir $DNS_TEMP_DIR + mkdir $DNS_TEMP_DIR/bind + #chgrp docker $DNS_TEMP_DIR/bind/ +fi + ## Calculate the IP net_ip_pre=`echo $NET_CIDR | cut -f 1 -d'/' | cut -f 1-3 -d'.'` @@ -15,5 +18,5 @@ echo ip = $net_ip docker run --name bind -d --restart=always \ --network $NET_NAME --ip $net_ip \ --publish 10000:10000/tcp \ - --volume /srv/docker/bind:/data \ - sameersbn/bind:9.10.3-20180127 + --volume $DNS_TEMP_DIR/bind/:/data \ + sameersbn/bind:9.10.3-20180127 \ No newline at end of file From b918310ecfa6393df0dc308379fa0c163f70c5bf Mon Sep 17 00:00:00 2001 From: Kurt Moeller Date: Tue, 12 Feb 2019 17:43:17 -0800 Subject: [PATCH 4/5] Remove mac specific files. --- reprovision_network_onmac.bash | 11 ----------- start_dns_onmac.bash | 22 ---------------------- 2 files changed, 33 deletions(-) delete mode 100755 reprovision_network_onmac.bash delete mode 100755 start_dns_onmac.bash diff --git a/reprovision_network_onmac.bash b/reprovision_network_onmac.bash deleted file mode 100755 index 5825bc6..0000000 --- a/reprovision_network_onmac.bash +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -echo "### network ###" -echo Just ensuring that the required network exists ... -./create_network.bash - -echo "### kill dns ###" -./kill_dns.bash - -echo "### start dns ###" -./start_dns_onmac.bash diff --git a/start_dns_onmac.bash b/start_dns_onmac.bash deleted file mode 100755 index 33044ef..0000000 --- a/start_dns_onmac.bash +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -source ./settings.bash - -## Prepare directories -if [ ! -d "/tmp/docker" ]; then - mkdir /tmp/docker - mkdir /tmp/docker/bind - #chgrp docker /tmp/docker/bind -fi - - -## Calculate the IP -net_ip_pre=`echo $NET_CIDR | cut -f 1 -d'/' | cut -f 1-3 -d'.'` -net_ip=${net_ip_pre}.201 -echo ip = $net_ip - -## Run -docker run --name bind -d --restart=always \ - --network $NET_NAME --ip $net_ip \ - --publish 10000:10000/tcp \ - --volume /tmp/docker/bind:/data \ - sameersbn/bind:9.10.3-20180127 From 172cf6c6da5f8248d5615aa6eed05cf51fdfde86 Mon Sep 17 00:00:00 2001 From: Kurt Moeller Date: Wed, 20 Feb 2019 11:03:35 -0800 Subject: [PATCH 5/5] fix dns now requires sudo --- fix_dns.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fix_dns.bash b/fix_dns.bash index 0c749e0..2debca0 100755 --- a/fix_dns.bash +++ b/fix_dns.bash @@ -7,6 +7,6 @@ echo dns = $dns ./list.bash | cut -f1 -d' ' | while read i do - docker exec $i bash -c "echo nameserver $dns > /etc/resolv.conf" - docker exec $i bash -c "echo search $FQN >> /etc/resolv.conf" + docker exec $i bash -c "sudo echo nameserver $dns > /etc/resolv.conf" + docker exec $i bash -c "sudo echo search $FQN >> /etc/resolv.conf" done