github.com/status-im/status-go@v1.1.0/_assets/compose/mailserver/Makefile (about)

     1  export GIT_ROOT = $(shell git rev-parse --show-toplevel)
     2  # Useful for showing enode address
     3  PUBLIC_IP ?= $(shell curl -s https://ipecho.net/plain)
     4  
     5  RED := $(shell tput -Txterm setaf 1)
     6  GRN := $(shell tput -Txterm setaf 2)
     7  YLW := $(shell tput -Txterm setaf 3)
     8  RST := $(shell tput -Txterm sgr0)
     9  BLD := $(shell tput bold)
    10  
    11  # Settings
    12  export CONTAINER_TAG  ?= v0.84.0
    13  export CONTAINER_IMG  ?= statusteam/status-go
    14  export CONTAINER_NAME ?= status-go-mailserver
    15  export LOG_LEVEL      ?= INFO
    16  export LISTEN_PORT    ?= 30303
    17  export METRICS_PORT   ?= 9090
    18  export RPC_HOST       ?= 0.0.0.0
    19  export RPC_PORT       ?= 8545
    20  export API_MODULES    ?= eth,web3,admin,waku,wakuext
    21  export DATA_PATH      ?= /var/tmp/$(CONTAINER_NAME)
    22  export REGISTER_TOPIC ?= whispermail
    23  export MAIL_PASSWORD  ?= status-offline-inbox
    24  
    25  define INFO_MSG
    26   * $(GRN)Your mailserver is listening on:$(RST) $(BLD)$(PUBLIC_IP):$(LISTEN_PORT)$(RST)
    27   * $(GRN)Your enode address is:$(RST)
    28  $(shell $(GIT_ROOT)/_assets/scripts/get_enode.sh 2>/dev/null)
    29  
    30  $(YLW)Make sure that IP and TCP port are available from the internet!$(RST)
    31  
    32  endef
    33  export INFO_MSG
    34  
    35  all: checks start show info enode-qr
    36  
    37  status: show
    38  
    39  checks:
    40  ifeq (, $(shell which docker))
    41  	$(error $(RED)No 'docker' in your $$PATH. Please install it$(RST))
    42  endif
    43  ifeq (, $(shell docker version | grep Server))
    44  	$(error $(RED)No permissions to run 'docker'. Add yourself to docker group$(RST))
    45  endif
    46  ifeq (, $(shell which docker-compose))
    47  	$(error $(RED)No 'docker-compose' in your $$PATH. Please install it$(RST))
    48  endif
    49  ifeq (, $(shell which jq))
    50  	$(error $(RED)No 'jq' in your $$PATH. Please install it$(RST))
    51  endif
    52  ifndef CONTAINER_NAME
    53  	$(error $(RED)$$CONTAINER_NAME not set! Export it as environment variable$(RST))
    54  endif
    55  ifndef PUBLIC_IP
    56  	$(warning $(YLW)$$PUBLIC_IP not set! Export it as environment variable$(RST))
    57  endif
    58  
    59  info:
    60  	@echo "$$INFO_MSG"
    61  
    62  enode:
    63  	@$(GIT_ROOT)/_assets/scripts/get_enode.sh
    64  
    65  enode-qr:
    66  	@$(GIT_ROOT)/_assets/scripts/get_enode.sh --qr
    67  
    68  logs: LOG_LINES ?= 100
    69  logs:
    70  	docker-compose logs -f -t --tail=$(LOG_LINES)
    71  
    72  start: config
    73  	@echo " * $(GRN)Starting '$(CONTAINER_NAME)' container...$(RST)"
    74  	docker-compose $(COMPOSE_UP_FLAGS) up -d
    75  
    76  stop:
    77  	@echo " * $(YLW)Stopping '$(CONTAINER_NAME)' container...$(RST)"
    78  	docker-compose down
    79  
    80  config:
    81  	@echo " * $(GRN)Generating '$(CONTAINER_NAME)' config...$(RST)"
    82  	@$(GIT_ROOT)/_assets/scripts/gen_config.sh
    83  
    84  show:
    85  	@docker ps \
    86  		--filter='name=$(CONTAINER_NAME)' \
    87  		--format="table {{.ID}}\t{{.Names}}\t{{.Status}}\t{{.Ports}}"
    88  
    89  clean:
    90  	@echo " * $(YLW)Removing '$(CONTAINER_NAME)' container...$(RST)"
    91  	docker-compose rm -s -f