$DOCKERNET -> $KIWI_HUB_NAME, $DOCKERCIDR -> $KIWI_HUB_CIDR
This commit is contained in:
parent
6ee528f4cb
commit
3522d6bba5
4 changed files with 22 additions and 22 deletions
34
Makefile
34
Makefile
|
@ -23,15 +23,15 @@ CONF_SOURCE:=$(patsubst %,. %;,$(CONF_WILDC))
|
||||||
confvalue=$(shell $(CONF_SOURCE) echo -n $${$(1)})
|
confvalue=$(shell $(CONF_SOURCE) echo -n $${$(1)})
|
||||||
|
|
||||||
# docker network name
|
# docker network name
|
||||||
CONF_DOCKERNET:=$(call confvalue,DOCKERNET)
|
CONF_KIWI_HUB_NAME:=$(call confvalue,KIWI_HUB_NAME)
|
||||||
ifeq ($(CONF_DOCKERNET),)
|
ifeq ($(CONF_KIWI_HUB_NAME),)
|
||||||
$(error DOCKERNET not set in $(CONF_WILDC))
|
$(error KIWI_HUB_NAME not set in $(CONF_WILDC))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# docker network CIDR
|
# docker network CIDR
|
||||||
CONF_DOCKERCIDR:=$(call confvalue,DOCKERCIDR)
|
CONF_KIWI_HUB_CIDR:=$(call confvalue,KIWI_HUB_CIDR)
|
||||||
ifeq ($(CONF_DOCKERNET),)
|
ifeq ($(CONF_KIWI_HUB_CIDR),)
|
||||||
$(error DOCKERCIDR not set in $(CONF_WILDC))
|
$(error KIWI_HUB_CIDR not set in $(CONF_WILDC))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# persistent data directory
|
# persistent data directory
|
||||||
|
@ -56,7 +56,7 @@ endif
|
||||||
# CONSTANTS
|
# CONSTANTS
|
||||||
|
|
||||||
# file to store docker network cidr
|
# file to store docker network cidr
|
||||||
FILE_DOCKERNET:=$(CONF_TARGETROOT)/up-$(CONF_DOCKERNET)
|
KIWI_HUB_FILE:=$(CONF_TARGETROOT)/up-$(CONF_KIWI_HUB_NAME)
|
||||||
|
|
||||||
# remove any suffix $2 from $1
|
# remove any suffix $2 from $1
|
||||||
rmsuffix=$(patsubst %$2,%,$1)
|
rmsuffix=$(patsubst %$2,%,$1)
|
||||||
|
@ -91,31 +91,31 @@ all: purge-conf up
|
||||||
|
|
||||||
#########
|
#########
|
||||||
# manage the docker network (container name local DNS)
|
# manage the docker network (container name local DNS)
|
||||||
$(FILE_DOCKERNET):
|
$(KIWI_HUB_FILE):
|
||||||
-$(DOCKER) network create \
|
-$(DOCKER) network create \
|
||||||
--driver bridge \
|
--driver bridge \
|
||||||
--internal \
|
--internal \
|
||||||
--subnet "$(CONF_DOCKERCIDR)" \
|
--subnet "$(CONF_KIWI_HUB_CIDR)" \
|
||||||
"$(CONF_DOCKERNET)"
|
"$(CONF_KIWI_HUB_NAME)"
|
||||||
@echo "Creating canary $(FILE_DOCKERNET) ..."
|
@echo "Creating canary $(KIWI_HUB_FILE) ..."
|
||||||
@$(DOCKER) run --rm \
|
@$(DOCKER) run --rm \
|
||||||
-v "/:/mnt" -u root alpine:latest \
|
-v "/:/mnt" -u root alpine:latest \
|
||||||
ash -c '\
|
ash -c '\
|
||||||
mkdir -p "$(addprefix /mnt, $(CONF_TARGETROOT))"; \
|
mkdir -p "$(addprefix /mnt, $(CONF_TARGETROOT))"; \
|
||||||
echo "$(CONF_DOCKERCIDR)" > "$(addprefix /mnt, $(FILE_DOCKERNET))"; \
|
echo "$(CONF_KIWI_HUB_CIDR)" > "$(addprefix /mnt, $(KIWI_HUB_FILE))"; \
|
||||||
'
|
'
|
||||||
|
|
||||||
.PHONY: net-up
|
.PHONY: net-up
|
||||||
net-up: $(FILE_DOCKERNET)
|
net-up: $(KIWI_HUB_FILE)
|
||||||
|
|
||||||
.PHONY: net-down
|
.PHONY: net-down
|
||||||
net-down: down
|
net-down: down
|
||||||
$(DOCKER) network rm "$(CONF_DOCKERNET)"
|
$(DOCKER) network rm "$(CONF_KIWI_HUB_NAME)"
|
||||||
@echo "Removing canary $(FILE_DOCKERNET) ..."
|
@echo "Removing canary $(KIWI_HUB_FILE) ..."
|
||||||
@$(DOCKER) run --rm \
|
@$(DOCKER) run --rm \
|
||||||
-v "/:/mnt" -u root alpine:latest \
|
-v "/:/mnt" -u root alpine:latest \
|
||||||
ash -c '\
|
ash -c '\
|
||||||
rm -f "$(addprefix /mnt, $(FILE_DOCKERNET))"; \
|
rm -f "$(addprefix /mnt, $(KIWI_HUB_FILE))"; \
|
||||||
'
|
'
|
||||||
|
|
||||||
#########
|
#########
|
||||||
|
@ -243,7 +243,7 @@ networks:
|
||||||
# interconnects projects
|
# interconnects projects
|
||||||
kiwihub:
|
kiwihub:
|
||||||
external:
|
external:
|
||||||
name: $$DOCKERNET
|
name: $$KIWI_HUB_NAME
|
||||||
|
|
||||||
services:
|
services:
|
||||||
something:
|
something:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
export SUFFIX_PROJECT=.project
|
export SUFFIX_PROJECT=.project
|
||||||
export SUFFIX_DOWN=.down
|
export SUFFIX_DOWN=.down
|
||||||
|
|
||||||
export DOCKERNET=kiwihub
|
export KIWI_HUB_NAME=kiwihub
|
||||||
export DOCKERCIDR=10.22.46.0/24
|
export KIWI_HUB_CIDR=10.22.46.0/24
|
||||||
|
|
||||||
export TARGETROOT=/tmp/kiwi
|
export TARGETROOT=/tmp/kiwi
|
||||||
|
|
|
@ -7,9 +7,9 @@ networks:
|
||||||
# interconnects projects
|
# interconnects projects
|
||||||
kiwihub:
|
kiwihub:
|
||||||
external:
|
external:
|
||||||
name: $DOCKERNET
|
name: $KIWI_HUB_NAME
|
||||||
|
|
||||||
services:
|
services:
|
||||||
hello-world:
|
hello-world:
|
||||||
image: alpine:latest
|
image: alpine:latest
|
||||||
command: sh -c 'while :; do echo Hello World; sleep 10; done'
|
command: sh -c 'while :; do echo Hello World "$$RANDOM"; sleep 10; done'
|
||||||
|
|
|
@ -34,7 +34,7 @@ class LogsCommand(SubCommand):
|
||||||
project_dir = f'{project_name}{project_marker}'
|
project_dir = f'{project_name}{project_marker}'
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
'DOCKERNET': config['network:name'],
|
'KIWI_NET_NAME': config['network:name'],
|
||||||
'COMPOSE_PROJECT_NAME': project_name
|
'COMPOSE_PROJECT_NAME': project_name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue