<commit_before>TOP_DIR = ../..
TARGET ?= /kb/deployment
DEPLOY_RUNTIME = /kb/runtime
SERVICE = awe_service
SERVICE_DIR = $(TARGET)/services/$(SERVICE)

GO_TMP_DIR = /tmp/go_build.tmp

PRODUCTION = 1

ifeq ($(PRODUCTION), 1)
	AWE_DIR = /disk0/awe
	TPAGE_ARGS = --define kb_top=$(TARGET) \
	--define site_url=https://kbase.us/services/awe \
	--define api_url=https://kbase.us/services/awe-api \
	--define site_port=7106 \
	--define api_port=7107 \
	--define site_dir=$(AWE_DIR)/site \
	--define data_dir=$(AWE_DIR)/data \
	--define logs_dir=$(AWE_DIR)/logs \
	--define awfs_dir=$(AWE_DIR)/awfs \
	--define mongo_host=localhost \
	--define mongo_db=ShockDBtest
else
	AWE_DIR = /mnt/awe
	TPAGE_ARGS = --define kb_top=$(TARGET) \
	--define site_url= \
	--define api_url= \
	--define site_port=7079 \
	--define api_port=7080 \
	--define site_dir=$(AWE_DIR)/site \
	--define data_dir=$(AWE_DIR)/data \
	--define logs_dir=$(AWE_DIR)/logs \
	--define awfs_dir=$(AWE_DIR)/awfs \
	--define mongo_host=localhost \
	--define mongo_db=ShockDBtest
endif

include $(TOP_DIR)/tools/Makefile.common

.PHONY : test

all: initialize build-awe

deploy: deploy-libs deploy-client deploy-service

deploy-libs:
	
deploy-client: all
	cp $(BIN_DIR)/awe-client $(TARGET)/bin/awe-client

build-awe: $(BIN_DIR)/awe-server

$(BIN_DIR)/awe-server: AWE/awe-server/awe-server.go
	rm -rf $(GO_TMP_DIR)
	mkdir -p $(GO_TMP_DIR)/src/github.com/MG-RAST
	cp -r AWE $(GO_TMP_DIR)/src/github.com/MG-RAST/
	export GOPATH=$(GO_TMP_DIR); go get -v github.com/MG-RAST/AWE/...
	cp -v $(GO_TMP_DIR)/bin/awe-server $(BIN_DIR)/awe-server
	cp -v $(GO_TMP_DIR)/bin/awe-client $(BIN_DIR)/awe-client

deploy-service: all
	cp $(BIN_DIR)/awe-server $(TARGET)/bin
	$(TPAGE) $(TPAGE_ARGS) awe_server.cfg.tt > awe.cfg
	$(TPAGE) $(TPAGE_ARGS) AWE/site/js/config.js.tt > AWE/site/js/config.js
	mkdir -p $(AWE_DIR)/site $(AWE_DIR)/data $(AWE_DIR)/logs $(AWE_DIR)/awfs
	rm -r $(AWE_DIR)/site
	cp -v -r AWE/site $(AWE_DIR)/site
	mkdir -p $(BIN_DIR) $(SERVICE_DIR) $(SERVICE_DIR)/conf $(SERVICE_DIR)/logs/awe $(SERVICE_DIR)/data/temp
	cp -v awe.cfg $(SERVICE_DIR)/conf/awe.cfg
	cp -r AWE/templates/awf_templates/* $(AWE_DIR)/awfs/
	cp service/start_service $(SERVICE_DIR)/
	chmod +x $(SERVICE_DIR)/start_service
	cp service/stop_service $(SERVICE_DIR)/
	chmod +x $(SERVICE_DIR)/stop_service

initialize: AWE/site<commit_msg>removed deploy-libs target and references to it because there appears to be no implementation/action for it<commit_after>TOP_DIR = ../..
TARGET ?= /kb/deployment
DEPLOY_RUNTIME = /kb/runtime
SERVICE = awe_service
SERVICE_DIR = $(TARGET)/services/$(SERVICE)

GO_TMP_DIR = /tmp/go_build.tmp

PRODUCTION = 1

ifeq ($(PRODUCTION), 1)
	AWE_DIR = /disk0/awe
	TPAGE_ARGS = --define kb_top=$(TARGET) \
	--define site_url=https://kbase.us/services/awe \
	--define api_url=https://kbase.us/services/awe-api \
	--define site_port=7106 \
	--define api_port=7107 \
	--define site_dir=$(AWE_DIR)/site \
	--define data_dir=$(AWE_DIR)/data \
	--define logs_dir=$(AWE_DIR)/logs \
	--define awfs_dir=$(AWE_DIR)/awfs \
	--define mongo_host=localhost \
	--define mongo_db=ShockDBtest
else
	AWE_DIR = /mnt/awe
	TPAGE_ARGS = --define kb_top=$(TARGET) \
	--define site_url= \
	--define api_url= \
	--define site_port=7079 \
	--define api_port=7080 \
	--define site_dir=$(AWE_DIR)/site \
	--define data_dir=$(AWE_DIR)/data \
	--define logs_dir=$(AWE_DIR)/logs \
	--define awfs_dir=$(AWE_DIR)/awfs \
	--define mongo_host=localhost \
	--define mongo_db=ShockDBtest
endif

include $(TOP_DIR)/tools/Makefile.common

.PHONY : test

all: initialize build-awe

deploy: deploy-client deploy-service

deploy-client: all
	cp $(BIN_DIR)/awe-client $(TARGET)/bin/awe-client

build-awe: $(BIN_DIR)/awe-server

$(BIN_DIR)/awe-server: AWE/awe-server/awe-server.go
	rm -rf $(GO_TMP_DIR)
	mkdir -p $(GO_TMP_DIR)/src/github.com/MG-RAST
	cp -r AWE $(GO_TMP_DIR)/src/github.com/MG-RAST/
	export GOPATH=$(GO_TMP_DIR); go get -v github.com/MG-RAST/AWE/...
	cp -v $(GO_TMP_DIR)/bin/awe-server $(BIN_DIR)/awe-server
	cp -v $(GO_TMP_DIR)/bin/awe-client $(BIN_DIR)/awe-client

deploy-service: all
	cp $(BIN_DIR)/awe-server $(TARGET)/bin
	$(TPAGE) $(TPAGE_ARGS) awe_server.cfg.tt > awe.cfg
	$(TPAGE) $(TPAGE_ARGS) AWE/site/js/config.js.tt > AWE/site/js/config.js
	mkdir -p $(AWE_DIR)/site $(AWE_DIR)/data $(AWE_DIR)/logs $(AWE_DIR)/awfs
	rm -r $(AWE_DIR)/site
	cp -v -r AWE/site $(AWE_DIR)/site
	mkdir -p $(BIN_DIR) $(SERVICE_DIR) $(SERVICE_DIR)/conf $(SERVICE_DIR)/logs/awe $(SERVICE_DIR)/data/temp
	cp -v awe.cfg $(SERVICE_DIR)/conf/awe.cfg
	cp -r AWE/templates/awf_templates/* $(AWE_DIR)/awfs/
	cp service/start_service $(SERVICE_DIR)/
	chmod +x $(SERVICE_DIR)/start_service
	cp service/stop_service $(SERVICE_DIR)/
	chmod +x $(SERVICE_DIR)/stop_service

initialize: AWE/site
{'fraction_non_alphanumeric': 0.1740129517443075, 'fraction_numerical': 0.007938165865886776, 'mean_word_length': 3.997912317327766, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5403494', 'n_tokens_mistral': 2022, 'n_tokens_neox': 1997, 'n_words': 350}