applied requested changes
This commit is contained in:
parent
cd783f91d7
commit
4335d6fb82
26
Vagrantfile
vendored
26
Vagrantfile
vendored
@ -125,6 +125,29 @@ DOCKERFILE
|
|||||||
ufw-docker allow public_webapp
|
ufw-docker allow public_webapp
|
||||||
SHELL
|
SHELL
|
||||||
|
|
||||||
|
master.vm.provision "multiple-network", type: 'shell', inline: <<-SHELL
|
||||||
|
set -euo pipefail
|
||||||
|
if ! docker network ls | grep -F foo-internal; then
|
||||||
|
docker network create --internal foo-internal
|
||||||
|
fi
|
||||||
|
if ! docker network ls | grep -F bar-external; then
|
||||||
|
docker network create bar-external
|
||||||
|
fi
|
||||||
|
|
||||||
|
for app in internal-multinet-app:7000 public-multinet-app:17070; do
|
||||||
|
if ! docker inspect "${app%:*}" &>/dev/null; then
|
||||||
|
docker run -d --restart unless-stopped --name "${app%:*}" \
|
||||||
|
-p "${app#*:}":80 --env name="${app}" \
|
||||||
|
--network foo-internal \
|
||||||
|
192.168.56.130:5000/chaifeng/hostname-webapp
|
||||||
|
docker network connect bar-external "${app%:*}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
ufw-docker allow public-multinet-app 80 bar-external
|
||||||
|
ufw-docker allow internal-multinet-app 80 foo-internal
|
||||||
|
SHELL
|
||||||
|
|
||||||
master.vm.provision "swarm-webapp", type: 'shell', inline: <<-SHELL
|
master.vm.provision "swarm-webapp", type: 'shell', inline: <<-SHELL
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
for name in public:29090 local:9000; do
|
for name in public:29090 local:9000; do
|
||||||
@ -166,6 +189,9 @@ DOCKERFILE
|
|||||||
test-webapp "$server:18080"
|
test-webapp "$server:18080"
|
||||||
! test-webapp "$server:8000"
|
! test-webapp "$server:8000"
|
||||||
|
|
||||||
|
test-webapp "$server:17070" # multiple networks app
|
||||||
|
! test-webapp "$server:7000" # internal multiple networks app
|
||||||
|
|
||||||
test-webapp "$server:29090"
|
test-webapp "$server:29090"
|
||||||
! test-webapp "$server:9000"
|
! test-webapp "$server:9000"
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ function ufw-docker--add-rule() {
|
|||||||
local INSTANCE_IP_ADDRESS="$2"
|
local INSTANCE_IP_ADDRESS="$2"
|
||||||
local PORT="$3"
|
local PORT="$3"
|
||||||
local PROTO="$4"
|
local PROTO="$4"
|
||||||
local NETWORK="$5"
|
local NETWORK="${5:-}"
|
||||||
|
|
||||||
declare comment
|
declare comment
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user