2019-09-16 09:38:33 +00:00
|
|
|
export GIT_ROOT = $(shell git rev-parse --show-toplevel)
|
2021-08-17 17:15:40 +00:00
|
|
|
# Useful for showing enode address
|
|
|
|
PUBLIC_IP ?= $(shell curl -s https://ipecho.net/plain)
|
2019-02-06 16:47:01 +00:00
|
|
|
|
2019-12-20 13:09:39 +00:00
|
|
|
RED := $(shell tput -Txterm setaf 1)
|
|
|
|
GRN := $(shell tput -Txterm setaf 2)
|
|
|
|
YLW := $(shell tput -Txterm setaf 3)
|
|
|
|
RST := $(shell tput -Txterm sgr0)
|
|
|
|
BLD := $(shell tput bold)
|
2019-02-06 16:47:01 +00:00
|
|
|
|
|
|
|
# Settings
|
2021-08-24 10:27:45 +00:00
|
|
|
export CONTAINER_TAG ?= v0.84.0
|
2021-01-20 13:08:14 +00:00
|
|
|
export CONTAINER_IMG ?= statusteam/status-go
|
|
|
|
export CONTAINER_NAME ?= status-go-mailserver
|
2019-02-18 15:23:18 +00:00
|
|
|
export LOG_LEVEL ?= INFO
|
|
|
|
export LISTEN_PORT ?= 30303
|
2020-04-08 11:24:02 +00:00
|
|
|
export METRICS_PORT ?= 9090
|
2021-08-24 10:27:45 +00:00
|
|
|
export RPC_HOST ?= 0.0.0.0
|
2019-02-18 15:23:18 +00:00
|
|
|
export RPC_PORT ?= 8545
|
2021-08-24 10:27:45 +00:00
|
|
|
export API_MODULES ?= eth,web3,admin,waku,wakuext
|
|
|
|
export DATA_PATH ?= /var/tmp/$(CONTAINER_NAME)
|
2019-04-01 12:08:52 +00:00
|
|
|
export REGISTER_TOPIC ?= whispermail
|
|
|
|
export MAIL_PASSWORD ?= status-offline-inbox
|
2019-02-06 16:47:01 +00:00
|
|
|
|
2021-08-17 17:15:40 +00:00
|
|
|
define INFO_MSG
|
|
|
|
* $(GRN)Your mailserver is listening on:$(RST) $(BLD)$(PUBLIC_IP):$(LISTEN_PORT)$(RST)
|
2021-08-24 13:13:10 +00:00
|
|
|
* $(GRN)Your enode address is:$(RST)
|
2021-08-17 17:15:40 +00:00
|
|
|
$(shell $(GIT_ROOT)/_assets/scripts/get_enode.sh 2>/dev/null)
|
|
|
|
|
|
|
|
$(YLW)Make sure that IP and TCP port are available from the internet!$(RST)
|
|
|
|
|
|
|
|
endef
|
|
|
|
export INFO_MSG
|
|
|
|
|
|
|
|
all: checks start show info enode-qr
|
|
|
|
|
|
|
|
status: show
|
2019-02-06 16:47:01 +00:00
|
|
|
|
|
|
|
checks:
|
2019-12-16 22:27:01 +00:00
|
|
|
ifeq (, $(shell which docker))
|
2019-12-20 13:09:39 +00:00
|
|
|
$(error $(RED)No 'docker' in your $$PATH. Please install it$(RST))
|
2019-12-16 22:27:01 +00:00
|
|
|
endif
|
|
|
|
ifeq (, $(shell docker version | grep Server))
|
2019-12-20 13:09:39 +00:00
|
|
|
$(error $(RED)No permissions to run 'docker'. Add yourself to docker group$(RST))
|
2019-12-16 22:27:01 +00:00
|
|
|
endif
|
2019-02-06 16:47:01 +00:00
|
|
|
ifeq (, $(shell which docker-compose))
|
2019-12-20 13:09:39 +00:00
|
|
|
$(error $(RED)No 'docker-compose' in your $$PATH. Please install it$(RST))
|
2019-02-06 16:47:01 +00:00
|
|
|
endif
|
|
|
|
ifeq (, $(shell which jq))
|
2019-12-20 13:09:39 +00:00
|
|
|
$(error $(RED)No 'jq' in your $$PATH. Please install it$(RST))
|
2019-02-06 16:47:01 +00:00
|
|
|
endif
|
|
|
|
ifndef CONTAINER_NAME
|
2019-12-20 13:09:39 +00:00
|
|
|
$(error $(RED)$$CONTAINER_NAME not set! Export it as environment variable$(RST))
|
2019-02-06 16:47:01 +00:00
|
|
|
endif
|
2021-08-17 17:15:40 +00:00
|
|
|
ifndef PUBLIC_IP
|
|
|
|
$(warning $(YLW)$$PUBLIC_IP not set! Export it as environment variable$(RST))
|
|
|
|
endif
|
2019-02-06 16:47:01 +00:00
|
|
|
|
2021-08-17 17:15:40 +00:00
|
|
|
info:
|
|
|
|
@echo "$$INFO_MSG"
|
2019-02-06 16:47:01 +00:00
|
|
|
|
|
|
|
enode:
|
2019-09-16 09:38:33 +00:00
|
|
|
@$(GIT_ROOT)/_assets/scripts/get_enode.sh
|
2019-02-06 16:47:01 +00:00
|
|
|
|
2020-01-23 09:33:47 +00:00
|
|
|
enode-qr:
|
|
|
|
@$(GIT_ROOT)/_assets/scripts/get_enode.sh --qr
|
|
|
|
|
2021-08-24 13:13:10 +00:00
|
|
|
logs: LOG_LINES ?= 100
|
2021-08-17 17:15:40 +00:00
|
|
|
logs:
|
2021-08-24 13:13:10 +00:00
|
|
|
docker-compose logs -f -t --tail=$(LOG_LINES)
|
2021-08-17 17:15:40 +00:00
|
|
|
|
|
|
|
start: config
|
|
|
|
@echo " * $(GRN)Starting '$(CONTAINER_NAME)' container...$(RST)"
|
|
|
|
docker-compose up -d
|
|
|
|
|
|
|
|
stop:
|
|
|
|
@echo " * $(YLW)Stopping '$(CONTAINER_NAME)' container...$(RST)"
|
|
|
|
docker-compose down
|
|
|
|
|
2019-09-16 09:38:33 +00:00
|
|
|
config:
|
2021-08-17 17:15:40 +00:00
|
|
|
@echo " * $(GRN)Generating '$(CONTAINER_NAME)' config...$(RST)"
|
2019-09-16 09:38:33 +00:00
|
|
|
@$(GIT_ROOT)/_assets/scripts/gen_config.sh
|
2019-02-06 16:47:01 +00:00
|
|
|
|
|
|
|
show:
|
2019-09-16 09:38:33 +00:00
|
|
|
@docker ps \
|
|
|
|
--filter='name=$(CONTAINER_NAME)' \
|
|
|
|
--format="table {{.ID}}\t{{.Names}}\t{{.Status}}\t{{.Ports}}"
|
2019-02-06 16:47:01 +00:00
|
|
|
|
|
|
|
clean:
|
2021-08-17 17:15:40 +00:00
|
|
|
@echo " * $(YLW)Removing '$(CONTAINER_NAME)' container...$(RST)"
|
2019-02-06 16:47:01 +00:00
|
|
|
docker-compose rm -s -f
|