diff --git a/Makefile b/Makefile index 2b13b76..388f4c4 100644 --- a/Makefile +++ b/Makefile @@ -23,15 +23,15 @@ CONF_SOURCE:=$(patsubst %,. %;,$(CONF_WILDC)) confvalue=$(shell $(CONF_SOURCE) echo -n $${$(1)}) # docker network name -CONF_DOCKERNET:=$(call confvalue,DOCKERNET) -ifeq ($(CONF_DOCKERNET),) -$(error DOCKERNET not set in $(CONF_WILDC)) +CONF_KIWI_HUB_NAME:=$(call confvalue,KIWI_HUB_NAME) +ifeq ($(CONF_KIWI_HUB_NAME),) +$(error KIWI_HUB_NAME not set in $(CONF_WILDC)) endif # docker network CIDR -CONF_DOCKERCIDR:=$(call confvalue,DOCKERCIDR) -ifeq ($(CONF_DOCKERNET),) -$(error DOCKERCIDR not set in $(CONF_WILDC)) +CONF_KIWI_HUB_CIDR:=$(call confvalue,KIWI_HUB_CIDR) +ifeq ($(CONF_KIWI_HUB_CIDR),) +$(error KIWI_HUB_CIDR not set in $(CONF_WILDC)) endif # persistent data directory @@ -56,7 +56,7 @@ endif # CONSTANTS # 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 rmsuffix=$(patsubst %$2,%,$1) @@ -91,31 +91,31 @@ all: purge-conf up ######### # manage the docker network (container name local DNS) -$(FILE_DOCKERNET): +$(KIWI_HUB_FILE): -$(DOCKER) network create \ --driver bridge \ --internal \ - --subnet "$(CONF_DOCKERCIDR)" \ - "$(CONF_DOCKERNET)" - @echo "Creating canary $(FILE_DOCKERNET) ..." + --subnet "$(CONF_KIWI_HUB_CIDR)" \ + "$(CONF_KIWI_HUB_NAME)" + @echo "Creating canary $(KIWI_HUB_FILE) ..." @$(DOCKER) run --rm \ -v "/:/mnt" -u root alpine:latest \ ash -c '\ 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 -net-up: $(FILE_DOCKERNET) +net-up: $(KIWI_HUB_FILE) .PHONY: net-down net-down: down - $(DOCKER) network rm "$(CONF_DOCKERNET)" - @echo "Removing canary $(FILE_DOCKERNET) ..." + $(DOCKER) network rm "$(CONF_KIWI_HUB_NAME)" + @echo "Removing canary $(KIWI_HUB_FILE) ..." @$(DOCKER) run --rm \ -v "/:/mnt" -u root alpine:latest \ ash -c '\ - rm -f "$(addprefix /mnt, $(FILE_DOCKERNET))"; \ + rm -f "$(addprefix /mnt, $(KIWI_HUB_FILE))"; \ ' ######### @@ -243,7 +243,7 @@ networks: # interconnects projects kiwihub: external: - name: $$DOCKERNET + name: $$KIWI_HUB_NAME services: something: diff --git a/example/base.conf b/example/base.conf index e012a32..80f2b32 100644 --- a/example/base.conf +++ b/example/base.conf @@ -1,7 +1,7 @@ export SUFFIX_PROJECT=.project export SUFFIX_DOWN=.down -export DOCKERNET=kiwihub -export DOCKERCIDR=10.22.46.0/24 +export KIWI_HUB_NAME=kiwihub +export KIWI_HUB_CIDR=10.22.46.0/24 export TARGETROOT=/tmp/kiwi diff --git a/example/hello-world.project/docker-compose.yml b/example/hello-world.project/docker-compose.yml index 201bd21..e8398b7 100644 --- a/example/hello-world.project/docker-compose.yml +++ b/example/hello-world.project/docker-compose.yml @@ -7,9 +7,9 @@ networks: # interconnects projects kiwihub: external: - name: $DOCKERNET + name: $KIWI_HUB_NAME services: hello-world: 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' diff --git a/src/kiwi/subcommands/logs.py b/src/kiwi/subcommands/logs.py index e7fb766..eea6985 100644 --- a/src/kiwi/subcommands/logs.py +++ b/src/kiwi/subcommands/logs.py @@ -34,7 +34,7 @@ class LogsCommand(SubCommand): project_dir = f'{project_name}{project_marker}' environment = { - 'DOCKERNET': config['network:name'], + 'KIWI_NET_NAME': config['network:name'], 'COMPOSE_PROJECT_NAME': project_name }