Move start-stop order to single config

Now .services file defines list and order of services to start and stop.

Signed-off-by: Stanislav Bogatyrev <stanislav@nspcc.ru>
This commit is contained in:
Stanislav Bogatyrev 2020-09-22 16:08:06 +03:00
parent 959d994ae5
commit d0cfbcd95a
6 changed files with 10 additions and 6 deletions

7
.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

@ -16,12 +16,13 @@ GET_SVCS = $(shell grep -Rl "get.*:" ./services/* | sort -u | grep artifacts.mk
PULL_SVCS = $(shell find ./services -type f -name 'docker-compose.yml' | sort -u | xargs -I {} dirname {} | xargs basename -a) PULL_SVCS = $(shell find ./services -type f -name 'docker-compose.yml' | sort -u | xargs -I {} dirname {} | xargs basename -a)
# Sorted services for running # Sorted services for running
START_SVCS = $(shell find ./services -type f -name '.order' | xargs -I % /bin/bash -c 'echo "$$(cat %) %"' | sort -u | awk '{ print $$2 }' | xargs -I {} dirname {} | xargs basename -a) START_SVCS = $(shell cat .services | grep -v \\\#)
STOP_SVCS = $(shell find ./services -type f -name '.order' | xargs -I % /bin/bash -c 'echo "$$(cat %) %"' | sort -ur | awk '{ print $$2 }' | xargs -I {} dirname {} | xargs basename -a) STOP_SVCS = $(shell tac .services | grep -v \\\#)
# List of available sites # List of available sites
HOSTS_LINES = $(shell grep -Rl IPV4_PREFIX ./services/* | grep .hosts) HOSTS_LINES = $(shell grep -Rl IPV4_PREFIX ./services/* | grep .hosts)
# Pull all required Docker images # Pull all required Docker images
.PHONY: pull .PHONY: pull
pull: pull:

View file

@ -1 +0,0 @@
01

View file

@ -1 +0,0 @@
02

View file

@ -1 +0,0 @@
04

View file

@ -1 +0,0 @@
03