This repository has been archived by the owner on Oct 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
103 lines (88 loc) · 4.55 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
DOCKERCOMPOSE := docker compose -f docker-compose.yml
DOCKERCOMPOSEEXPLORERBACKEND := backend
DOCKERCOMPOSEEXPLORERBACKENDDB := backend-db
DOCKERCOMPOSEEXPLORERFRONTEND := frontend
DOCKERCOMPOSEEXPLORERPROXY := proxy
DOCKERCOMPOSEEXPLORERSMARTCONTRACTVERIFIER := smart-contract-verifier
DOCKERCOMPOSEEXPLORERVISUALIZER := visualizer
DOCKERCOMPOSEEXPLORERSIGPROVIDER := sig-provider
DOCKERCOMPOSEEXPLORERVISUALIZERPROXY := visualizer-proxy
DOCKERCOMPOSEEXPLORERSTATSDB := stats-db
DOCKERCOMPOSEEXPLORERSTATS := stats
RUNEXPLORERBACKEND := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEEXPLORERBACKEND)
RUNEXPLORERBACKENDDB := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEEXPLORERBACKENDDB)
RUNEXPLORERFRONTEND := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEEXPLORERFRONTEND)
RUNEXPLORERPROXY := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEEXPLORERPROXY)
RUNEXPLORERSMARTCONTRACTVERIFIER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEEXPLORERSMARTCONTRACTVERIFIER)
RUNEXPLORERVISUALIZER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEEXPLORERVISUALIZER)
RUNEXPLORERSIGPROVIDER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEEXPLORERSIGPROVIDER)
RUNEXPLORERVISUALIZERPROXY := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEEXPLORERVISUALIZERPROXY)
RUNEXPLORERSTATSDB := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEEXPLORERSTATSDB)
RUNEXPLORERSTATS := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEEXPLORERSTATS)
STOPEXPLORERBACKEND := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEEXPLORERBACKEND) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEEXPLORERBACKEND)
STOPEXPLORERBACKENDDB := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEEXPLORERBACKENDDB) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEEXPLORERBACKENDDB)
STOPEXPLORERFRONTEND := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEEXPLORERFRONTEND) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEEXPLORERFRONTEND)
STOPEXPLORERPROXY := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEEXPLORERPROXY) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEEXPLORERPROXY)
STOPEXPLORERSMARTCONTRACTVERIFIER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEEXPLORERSMARTCONTRACTVERIFIER) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEEXPLORERSMARTCONTRACTVERIFIER)
STOPEXPLORERVISUALIZER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEEXPLORERVISUALIZER) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEEXPLORERVISUALIZER)
STOPEXPLORERSIGPROVIDER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEEXPLORERSIGPROVIDER) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEEXPLORERSIGPROVIDER)
STOPEXPLORERVISUALIZERPROXY := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEEXPLORERVISUALIZERPROXY) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEEXPLORERVISUALIZERPROXY)
STOPEXPLORERSTATSDB := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEEXPLORERSTATSDB) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEEXPLORERSTATSDB)
STOPEXPLORERSTATS := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEEXPLORERSTATS) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEEXPLORERSTATS)
BACKENDDBDATAVOLUME := snapchain-tohma-block-explorer_backend_db_data
STATSDBDATAVOLUME := snapchain-tohma-block-explorer_stats_db_data
.PHONY: run-explorer
run-explorer: ## Runs all explorer services
$(RUNEXPLORERBACKENDDB)
$(RUNEXPLORERSTATSDB)
sleep 5
$(RUNEXPLORERBACKEND)
$(RUNEXPLORERFRONTEND)
$(RUNEXPLORERSTATS)
$(RUNEXPLORERSMARTCONTRACTVERIFIER)
$(RUNEXPLORERVISUALIZER)
$(RUNEXPLORERSIGPROVIDER)
$(RUNEXPLORERVISUALIZERPROXY)
$(RUNEXPLORERPROXY)
.PHONY: stop-explorer
stop-explorer: ## Stops all explorer services
$(STOPEXPLORERPROXY)
$(STOPEXPLORERVISUALIZERPROXY)
$(STOPEXPLORERSIGPROVIDER)
$(STOPEXPLORERVISUALIZER)
$(STOPEXPLORERSMARTCONTRACTVERIFIER)
$(STOPEXPLORERSTATS)
$(STOPEXPLORERFRONTEND)
$(STOPEXPLORERBACKEND)
$(STOPEXPLORERSTATSDB)
$(STOPEXPLORERBACKENDDB)
.PHONY: run-explorer-db
run-explorer-db: ## Runs the explorer databases
$(RUNEXPLORERBACKENDDB)
$(RUNEXPLORERSTATSDB)
.PHONY: stop-explorer-db
stop-explorer-db: ## Stops the explorer databases
$(STOPEXPLORERSTATSDB)
$(STOPEXPLORERBACKENDDB)
.PHONY: remove-volumes
remove-volumes: ## Removes Docker volumes
docker volume rm $(BACKENDDBDATAVOLUME) $(STATSDBDATAVOLUME)
.PHONY: logs
logs: ## Shows logs
$(DOCKERCOMPOSE) logs -f
.PHONY: restart-explorer
restart-explorer: stop-explorer remove-volumes run-explorer logs
.PHONY: ps
ps: ## Check all running services
$(DOCKERCOMPOSE) ps --status running --format "table {{.Service}}\t{{.Image}}\t{{.Status}}"
.PHONY: ps-exited
ps-exited: ## Check all exited services
$(DOCKERCOMPOSE) ps -a --format "table {{.Service}}\t{{.Image}}\t{{.Status}}" \
| grep 'Exited' \
|| echo "No exited containers"
.PHONY: help
help: ## Prints this help
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| sort \
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL := help