Skip to content
47 changes: 23 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
# - all (default): Builds all targets and runs all tests/checks
# - clean: Cleans the docker containers.
# - check: Setup as master node, and runs all tests/checks, will be triggered by CI
# - deep-clean: Clean up all docker images and local storage.
# - doc: Start a local web service to explore the documentation
# - deep-clean: Clean up all docker images and local storage.
# - doc: Start a local web service to explore the documentation
# - docker[-clean]: Build/clean docker images locally
# - docker-compose: Start development docker-compose.
# - license: Checks sourrce files for Apache license header
# - local: Run all services ad-hoc
# - help: Output the help instructions for each command
# - license: Checks source files for Apache license header
# - local: Run all services ad-hoc
# - reset: Clean up and remove local storage (only use for development)
# - restart: Stop the cello service and then start
# - setup-master: Setup the host as a master node, install pkg and download docker images
Expand Down Expand Up @@ -132,25 +132,21 @@ all: check

clean: ##@Clean Stop services and clean docker containers.
make stop
if docker ps -a | grep "cello-"; then \
docker ps -a | grep "cello-" | awk '{print $1}' | xargs docker rm -f >/dev/null 2>&1; \
fi

@-docker ps -a --filter "name=cello-" --format "{{.ID}}" | xargs docker rm -f >/dev/null 2>&1
@echo "Cleared out containers"

check: ##@Code Check code format
@$(MAKE) license
find ./docs -type f -name "*.md" -exec egrep -l " +$$" {} \;
-find ./docs -type f -name "*.md" -exec egrep -l " +$$" {} \;
cd src/api-engine && tox && cd ${ROOT_PATH}
make docker-compose
MODE=dev make start
sleep 10
# make test-api
MODE=dev make stop
make stop
make check-dashboard

deep-clean: ##@Clean Stop services, clean docker images and remove mounted local storage.
make stop
make clean
make clean-docker-images
make clean-images
rm -rf $(LOCAL_STORAGE_PATH)

doc: ##@Documentation Build local online documentation and start serve
Expand All @@ -159,21 +155,20 @@ doc: ##@Documentation Build local online documentation and start serve

docker: images ##@Build Build all required docker images locally

docker-clean:##@Clean Clean docker images locally
make stop
docker-clean:##@Clean Clean docker images locally
make clean-images

docker-compose: api-engine fabric docker-rest-agent dashboard ##@Development Start development docker-compose

help: ##@Help Show this help.
@perl -e '$(HELP_FUN)' $(MAKEFILE_LIST)

license: ##@Code Check source files for Apache license header
scripts/check_license.sh

local:##@Development Run all services ad-hoc
make docker-compose start-docker-compose

help: ##@Help Show this help.
@perl -e '$(HELP_FUN)' $(MAKEFILE_LIST)

reset:##@Development Clean up and remove local storage (only use for development)
make clean
echo "Clean up and remove all local storage..."
Expand All @@ -191,17 +186,21 @@ start: ##@Service Start service
make start-docker-compose

stop: ##@Service Stop service
if [ "$(CONFIG_DOCKER_COMPOSE_DEPLOY)" = "y" ]; then \
@if [ "$(CONFIG_DOCKER_COMPOSE_DEPLOY)" = "y" ]; then \
make stop-docker-compose; \
else \
make stop-k8s; \
fi

## Help rules
clean-images:
@echo "Clean all cello related images, may need to remove all containers"
make clean
echo "Clean all cello related images, may need to remove all containers before"
docker images | grep "cello-" | awk '{print $3}' | xargs docker rmi -f
@-docker images --filter=reference='hyperledger/*cello*' --format '{{.ID}}' | xargs -r docker rmi -f 2>/dev/null
@echo "Images deleted!"
@echo "Pruning dangling images..."
docker image prune
@echo "Dangling images pruned, cleanup finished!"

check-dashboard:
docker compose -f tests/dashboard/docker-compose.yml up --abort-on-container-exit || (echo "check dashboard failed $$?"; exit 1)
Expand Down Expand Up @@ -253,4 +252,4 @@ dashboard:
clean-images \
start-docker-compose \
stop-docker-compose \
images \
images \