Make up/down for services (#155)

* [#155] s3_gate: Service name in docker-compose.yml

Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>

* [#155] Makefile: Make Up/Down certain services

Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>

* [#155] Makefile: minor fixes

Signed-off-by: Stanislav Bogatyrev <stanislav@nspcc.ru>

Co-authored-by: Stanislav Bogatyrev <stanislav@nspcc.ru>
This commit is contained in:
Elizaveta Chichindaeva 2022-02-04 18:27:49 +03:00 committed by GitHub
parent 07bd61f78e
commit 3348ebbfe0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 9 deletions

7
.basic_services Normal file
View file

@ -0,0 +1,7 @@
# Services start/stop order
# Will start from top to bottom and stop in reverse
basenet
chain
morph_chain
ir
storage

View file

@ -1,10 +1,5 @@
# Services start/stop order # Services start/stop order
# Will start from top to bottom and stop in reverse # Will start from top to bottom and stop in reverse
basenet
chain
morph_chain
ir
storage
http_gate http_gate
s3_gate s3_gate
coredns coredns

View file

@ -27,7 +27,9 @@ PULL_SVCS = $(shell find ./services -type f -name 'docker-compose.yml' | sort -u
# List of services to run # List of services to run
START_SVCS = $(shell cat .services | grep -v \\\#) START_SVCS = $(shell cat .services | grep -v \\\#)
START_BASIC = $(shell cat .basic_services | grep -v \\\#)
STOP_SVCS = $(shell tac .services | grep -v \\\#) STOP_SVCS = $(shell tac .services | grep -v \\\#)
STOP_BASIC = $(shell tac .basic_services | grep -v \\\#)
# List of hosts available in devenv # List of hosts available in devenv
HOSTS_LINES = $(shell grep -Rl IPV4_PREFIX ./services/* | grep .hosts) HOSTS_LINES = $(shell grep -Rl IPV4_PREFIX ./services/* | grep .hosts)
@ -52,17 +54,43 @@ get: $(foreach SVC, $(GET_SVCS), get.$(SVC))
# Start environment # Start environment
.PHONY: up .PHONY: up
up: get vendor/hosts up: up/basic
@$(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))
@echo "Full NeoFS Developer Environment is ready"
# Build up NeoFS
.PHONY: up/basic
up/basic: get vendor/hosts
@$(foreach SVC, $(START_BASIC), $(shell docker-compose -f services/$(SVC)/docker-compose.yml up -d))
@./bin/tick.sh @./bin/tick.sh
@./bin/config.sh string SystemDNS container @./bin/config.sh string SystemDNS container
@echo "NeoFS Developer Environment is ready" @echo "Basic NeoFS Developer Environment is ready"
# Build up certain service
.PHONY: up/%
up/%: get vendor/hosts
@docker-compose -f services/$*/docker-compose.yml up -d
@echo "Developer Environment for $* service is ready"
# Stop environment # Stop environment
.PHONY: down .PHONY: down
down: down: down/add down/basic
@echo "Full NeoFS Developer Environment is down"
.PHONY: down/add
down/add:
$(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))
# Stop basic environment
.PHONY: down/basic
down/basic:
$(foreach SVC, $(STOP_BASIC), $(shell docker-compose -f services/$(SVC)/docker-compose.yml down))
# Stop certain service
.PHONY: down/%
down/%:
@docker-compose -f services/$*/docker-compose.yml down
.PHONY: vendor/hosts .PHONY: vendor/hosts
.ONESHELL: .ONESHELL:
vendor/hosts: vendor/hosts:

View file

@ -2,7 +2,7 @@
version: "2.4" version: "2.4"
services: services:
http_gate: s3_gate:
image: ${S3_GW_IMAGE}:${S3_GW_VERSION} image: ${S3_GW_IMAGE}:${S3_GW_VERSION}
domainname: ${LOCAL_DOMAIN} domainname: ${LOCAL_DOMAIN}
hostname: s3_gate hostname: s3_gate