Use common /etc/hosts

Signed-off-by: Stanislav Bogatyrev <stanislav@nspcc.ru>
This commit is contained in:
Stanislav Bogatyrev 2020-09-24 12:34:19 +03:00
parent bdb2eb6d67
commit 7d8fbc7754
6 changed files with 46 additions and 51 deletions

View file

@ -34,14 +34,9 @@ pull:
get: $(foreach SVC, $(GET_SVCS), get.$(SVC)) get: $(foreach SVC, $(GET_SVCS), get.$(SVC))
@: @:
# Build custom environments
.PHONY: rebuild
rebuild: $(foreach SVC, $(BUILD_SVCS), build.$(SVC))
@:
# Start environments # Start environments
.PHONY: up .PHONY: up
up: get up: get vendor/hosts
$(foreach SVC, $(START_SVCS), $(shell docker-compose -f services/$(SVC)/docker-compose.yml up -d)) $(foreach SVC, $(START_SVCS), $(shell docker-compose -f services/$(SVC)/docker-compose.yml up -d))
# Stop environments # Stop environments
@ -49,10 +44,9 @@ up: get
down: down:
$(foreach SVC, $(STOP_SVCS), $(shell docker-compose -f services/$(SVC)/docker-compose.yml down)) $(foreach SVC, $(STOP_SVCS), $(shell docker-compose -f services/$(SVC)/docker-compose.yml down))
# Display changes for /etc/hosts .PHONY: vendor/hosts
.PHONY: hosts
.ONESHELL: .ONESHELL:
hosts: vendor/hosts:
@for file in $(HOSTS_LINES) @for file in $(HOSTS_LINES)
do do
while read h while read h
@ -61,4 +55,9 @@ hosts:
sed 's|IPV4_PREFIX|$(IPV4_PREFIX)|g' | \ sed 's|IPV4_PREFIX|$(IPV4_PREFIX)|g' | \
sed 's|LOCAL_DOMAIN|$(LOCAL_DOMAIN)|g' sed 's|LOCAL_DOMAIN|$(LOCAL_DOMAIN)|g'
done < $${file}; done < $${file};
done done > $@
# Display changes for /etc/hosts
.PHONY: hosts
hosts: vendor/hosts
@cat vendor/hosts

View file

@ -16,7 +16,8 @@ services:
networks: networks:
internet: internet:
ipv4_address: ${IPV4_PREFIX}.10 ipv4_address: ${IPV4_PREFIX}.10
volumes:
- ./../../vendor/hosts:/etc/hosts
networks: networks:
internet: internet:
driver: bridge driver: bridge

View file

@ -23,6 +23,7 @@ services:
- ./../../vendor/chain.gz:/chain.gz - ./../../vendor/chain.gz:/chain.gz
- ./protocol.privnet.yml:/config/protocol.privnet.yml - ./protocol.privnet.yml:/config/protocol.privnet.yml
- ./node-wallet.json:/wallets/node-wallet.json - ./node-wallet.json:/wallets/node-wallet.json
- ./../../vendor/hosts:/etc/hosts
neofs_main_chain-healthy: neofs_main_chain-healthy:
image: alpine image: alpine

View file

@ -11,11 +11,10 @@ services:
ir_int: ir_int:
internet: internet:
ipv4_address: ${IPV4_PREFIX}.61 ipv4_address: ${IPV4_PREFIX}.61
extra_hosts:
- "main_chain:${IPV4_PREFIX}.50"
- "morph_chain:${IPV4_PREFIX}.90"
stop_signal: SIGKILL stop_signal: SIGKILL
volumes: [ "./01.key:/01.key" ] volumes:
- ./01.key:/01.key
- ./../../vendor/hosts:/etc/hosts
env_file: [ ".env", ".ir.env" ] env_file: [ ".env", ".ir.env" ]
environment: environment:
- NEOFS_IR_KEY=/01.key - NEOFS_IR_KEY=/01.key
@ -29,11 +28,10 @@ services:
ir_int: ir_int:
internet: internet:
ipv4_address: ${IPV4_PREFIX}.62 ipv4_address: ${IPV4_PREFIX}.62
extra_hosts: volumes:
- "main_chain:${IPV4_PREFIX}.50" - ./02.key:/02.key
- "morph_chain:${IPV4_PREFIX}.90" - ./../../vendor/hosts:/etc/hosts
stop_signal: SIGKILL stop_signal: SIGKILL
volumes: [ "./02.key:/02.key" ]
env_file: [ ".env", ".ir.env" ] env_file: [ ".env", ".ir.env" ]
environment: environment:
- NEOFS_IR_KEY=/02.key - NEOFS_IR_KEY=/02.key
@ -47,11 +45,10 @@ services:
ir_int: ir_int:
internet: internet:
ipv4_address: ${IPV4_PREFIX}.63 ipv4_address: ${IPV4_PREFIX}.63
extra_hosts: volumes:
- "main_chain:${IPV4_PREFIX}.50" - ./03.key:/03.key
- "morph_chain:${IPV4_PREFIX}.90" - ./../../vendor/hosts:/etc/hosts
stop_signal: SIGKILL stop_signal: SIGKILL
volumes: [ "./03.key:/03.key" ]
env_file: [ ".env", ".ir.env" ] env_file: [ ".env", ".ir.env" ]
environment: environment:
- NEOFS_IR_KEY=/03.key - NEOFS_IR_KEY=/03.key
@ -65,11 +62,10 @@ services:
ir_int: ir_int:
internet: internet:
ipv4_address: ${IPV4_PREFIX}.64 ipv4_address: ${IPV4_PREFIX}.64
extra_hosts: volumes:
- "main_chain:${IPV4_PREFIX}.50" - ./04.key:/04.key
- "morph_chain:${IPV4_PREFIX}.90" - ./../../vendor/hosts:/etc/hosts
stop_signal: SIGKILL stop_signal: SIGKILL
volumes: [ "./04.key:/04.key" ]
env_file: [ ".env", ".ir.env" ] env_file: [ ".env", ".ir.env" ]
environment: environment:
- NEOFS_IR_KEY=/04.key - NEOFS_IR_KEY=/04.key
@ -83,11 +79,10 @@ services:
ir_int: ir_int:
internet: internet:
ipv4_address: ${IPV4_PREFIX}.65 ipv4_address: ${IPV4_PREFIX}.65
extra_hosts: volumes:
- "main_chain:${IPV4_PREFIX}.50" - ./05.key:/05.key
- "morph_chain:${IPV4_PREFIX}.90" - ./../../vendor/hosts:/etc/hosts
stop_signal: SIGKILL stop_signal: SIGKILL
volumes: [ "./05.key:/05.key" ]
env_file: [ ".env", ".ir.env" ] env_file: [ ".env", ".ir.env" ]
environment: environment:
- NEOFS_IR_KEY=/05.key - NEOFS_IR_KEY=/05.key
@ -101,11 +96,10 @@ services:
ir_int: ir_int:
internet: internet:
ipv4_address: ${IPV4_PREFIX}.66 ipv4_address: ${IPV4_PREFIX}.66
extra_hosts: volumes:
- "main_chain:${IPV4_PREFIX}.50" - ./06.key:/06.key
- "morph_chain:${IPV4_PREFIX}.90" - ./../../vendor/hosts:/etc/hosts
stop_signal: SIGKILL stop_signal: SIGKILL
volumes: [ "./06.key:/06.key" ]
env_file: [ ".env", ".ir.env" ] env_file: [ ".env", ".ir.env" ]
environment: environment:
- NEOFS_IR_KEY=/06.key - NEOFS_IR_KEY=/06.key
@ -119,11 +113,10 @@ services:
ir_int: ir_int:
internet: internet:
ipv4_address: ${IPV4_PREFIX}.67 ipv4_address: ${IPV4_PREFIX}.67
extra_hosts: volumes:
- "main_chain:${IPV4_PREFIX}.50" - ./07.key:/07.key
- "morph_chain:${IPV4_PREFIX}.90" - ./../../vendor/hosts:/etc/hosts
stop_signal: SIGKILL stop_signal: SIGKILL
volumes: [ "./07.key:/07.key" ]
env_file: [ ".env", ".ir.env" ] env_file: [ ".env", ".ir.env" ]
environment: environment:
- NEOFS_IR_KEY=/07.key - NEOFS_IR_KEY=/07.key

View file

@ -23,6 +23,7 @@ services:
- ./../../vendor/morph_chain.gz:/morph_chain.gz - ./../../vendor/morph_chain.gz:/morph_chain.gz
- ./protocol.privnet.yml:/config/protocol.privnet.yml - ./protocol.privnet.yml:/config/protocol.privnet.yml
- ./node-wallet.json:/wallets/node-wallet.json - ./node-wallet.json:/wallets/node-wallet.json
- ./../../vendor/hosts:/etc/hosts
neofs_morph_chain-healthy: neofs_morph_chain-healthy:
image: alpine image: alpine

View file

@ -11,10 +11,10 @@ services:
storage_int: storage_int:
internet: internet:
ipv4_address: ${IPV4_PREFIX}.71 ipv4_address: ${IPV4_PREFIX}.71
extra_hosts: volumes:
- "morph_chain:${IPV4_PREFIX}.90" - ./01.key:/01.key
- ./../../vendor/hosts:/etc/hosts
stop_signal: SIGKILL stop_signal: SIGKILL
volumes: [ "./01.key:/01.key" ]
env_file: [ ".env", ".storage.env" ] env_file: [ ".env", ".storage.env" ]
environment: environment:
- NEOFS_NODE_KEY=/01.key - NEOFS_NODE_KEY=/01.key
@ -31,10 +31,10 @@ services:
storage_int: storage_int:
internet: internet:
ipv4_address: ${IPV4_PREFIX}.72 ipv4_address: ${IPV4_PREFIX}.72
extra_hosts: volumes:
- "morph_chain:${IPV4_PREFIX}.90" - ./02.key:/02.key
- ./../../vendor/hosts:/etc/hosts
stop_signal: SIGKILL stop_signal: SIGKILL
volumes: [ "./02.key:/02.key" ]
env_file: [ ".env", ".storage.env" ] env_file: [ ".env", ".storage.env" ]
environment: environment:
- NEOFS_NODE_KEY=/02.key - NEOFS_NODE_KEY=/02.key
@ -50,10 +50,10 @@ services:
storage_int: storage_int:
internet: internet:
ipv4_address: ${IPV4_PREFIX}.73 ipv4_address: ${IPV4_PREFIX}.73
extra_hosts: volumes:
- "morph_chain:${IPV4_PREFIX}.90" - ./03.key:/03.key
- ./../../vendor/hosts:/etc/hosts
stop_signal: SIGKILL stop_signal: SIGKILL
volumes: [ "./03.key:/03.key" ]
env_file: [ ".env", ".storage.env" ] env_file: [ ".env", ".storage.env" ]
environment: environment:
- NEOFS_NODE_KEY=/03.key - NEOFS_NODE_KEY=/03.key
@ -69,10 +69,10 @@ services:
storage_int: storage_int:
internet: internet:
ipv4_address: ${IPV4_PREFIX}.74 ipv4_address: ${IPV4_PREFIX}.74
extra_hosts: volumes:
- "morph_chain:${IPV4_PREFIX}.90" - ./04.key:/04.key
- ./../../vendor/hosts:/etc/hosts
stop_signal: SIGKILL stop_signal: SIGKILL
volumes: [ "./04.key:/04.key" ]
env_file: [ ".env", ".storage.env" ] env_file: [ ".env", ".storage.env" ]
environment: environment:
- NEOFS_NODE_KEY=/04.key - NEOFS_NODE_KEY=/04.key