mirror of
https://github.com/yavook/kiwi-scp.git
synced 2024-11-22 12:53:00 +00:00
internal networking
This commit is contained in:
parent
95c5bcba1b
commit
746f28d65e
2 changed files with 20 additions and 6 deletions
24
Makefile
24
Makefile
|
@ -13,6 +13,11 @@ ifeq ($(CONF_DOCKERNET),)
|
||||||
$(error DOCKERNET not set in $(CONF_WILDC))
|
$(error DOCKERNET not set in $(CONF_WILDC))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
CONF_DOCKERCIDR:=$(call confvalue,DOCKERCIDR)
|
||||||
|
ifeq ($(CONF_DOCKERNET),)
|
||||||
|
$(error DOCKERCIDR not set in $(CONF_WILDC))
|
||||||
|
endif
|
||||||
|
|
||||||
# persistent data directory
|
# persistent data directory
|
||||||
CONF_TARGETROOT:=$(call confvalue,TARGETROOT)
|
CONF_TARGETROOT:=$(call confvalue,TARGETROOT)
|
||||||
ifeq ($(CONF_TARGETROOT),)
|
ifeq ($(CONF_TARGETROOT),)
|
||||||
|
@ -62,18 +67,18 @@ all: purge-conf up
|
||||||
#########
|
#########
|
||||||
# manage the docker network (container name local DNS)
|
# manage the docker network (container name local DNS)
|
||||||
$(FILE_DOCKERNET):
|
$(FILE_DOCKERNET):
|
||||||
sudo docker network create "$(CONF_DOCKERNET)" ||:
|
sudo docker network create --driver bridge --internal --subnet "$(CONF_DOCKERCIDR)" "$(CONF_DOCKERNET)" ||:
|
||||||
sudo mkdir -p "$(CONF_TARGETROOT)"
|
sudo mkdir -p "$(CONF_TARGETROOT)"
|
||||||
sudo chmod 700 "$(CONF_TARGETROOT)"
|
sudo chmod 700 "$(CONF_TARGETROOT)"
|
||||||
sudo docker network inspect -f '{{(index .IPAM.Config 0).Subnet}}' "$(CONF_DOCKERNET)" | sudo tee "$@"
|
sudo echo "$(CONF_DOCKERCIDR)" | sudo tee "$@"
|
||||||
|
|
||||||
.PHONY: net-up
|
.PHONY: net-up
|
||||||
net-up: $(FILE_DOCKERNET)
|
net-up: $(FILE_DOCKERNET)
|
||||||
|
|
||||||
.PHONY: net-down
|
.PHONY: net-down
|
||||||
net-down: down
|
net-down: down
|
||||||
sudo docker network rm $(CONF_DOCKERNET)
|
sudo docker network rm "$(CONF_DOCKERNET)"
|
||||||
sudo rm $(FILE_DOCKERNET)
|
sudo rm "$(FILE_DOCKERNET)"
|
||||||
|
|
||||||
#########
|
#########
|
||||||
# sync project config directory to variable folder
|
# sync project config directory to variable folder
|
||||||
|
@ -160,10 +165,14 @@ s?=bash
|
||||||
|
|
||||||
# default compose file
|
# default compose file
|
||||||
define COMPOSEFILE
|
define COMPOSEFILE
|
||||||
version: "3"
|
version: "2"
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
default:
|
# reachable from outside
|
||||||
|
default:
|
||||||
|
driver: bridge
|
||||||
|
# interconnects projects
|
||||||
|
gassi:
|
||||||
external:
|
external:
|
||||||
name: $$DOCKERNET
|
name: $$DOCKERNET
|
||||||
|
|
||||||
|
@ -171,5 +180,8 @@ services:
|
||||||
something:
|
something:
|
||||||
image: maintainer/repo:tag
|
image: maintainer/repo:tag
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- gassi
|
||||||
[...]
|
[...]
|
||||||
endef
|
endef
|
||||||
|
|
|
@ -2,4 +2,6 @@ export SUFFIX_PROJECT=.project
|
||||||
export SUFFIX_DOWN=.down
|
export SUFFIX_DOWN=.down
|
||||||
|
|
||||||
export DOCKERNET=kiwinet
|
export DOCKERNET=kiwinet
|
||||||
|
export DOCKERCIDR=10.13.37.0/24
|
||||||
|
|
||||||
export TARGETROOT=/var/kiwi
|
export TARGETROOT=/var/kiwi
|
||||||
|
|
Loading…
Reference in a new issue