-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
93 lines (71 loc) · 2.95 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
DEPLOY_RUNTIME ?= /kb/runtime
TARGET ?= /kb/deployment
TOP_DIR = ../..
include $(TOP_DIR)/tools/Makefile.common
SERVICE_SPEC = NarrativeJobService.spec
SERVICE_NAME = NarrativeJobService
SERVICE_PORT = 7080
SERVICE_DIR = narrative_job_service
ifeq ($(SELF_URL),)
SELF_URL = http://localhost:$(SERVICE_PORT)
endif
SERVICE_PSGI = $(SERVICE_NAME).psgi
TPAGE_ARGS = --define kb_runas_user=$(SERVICE_USER) --define kb_top=$(TARGET) --define kb_runtime=$(DEPLOY_RUNTIME) --define kb_service_name=$(SERVICE_NAME) --define kb_service_dir=$(SERVICE_DIR) --define kb_service_port=$(SERVICE_PORT) --define kb_psgi=$(SERVICE_PSGI)
##########################################
# main targets
default:
echo "no default make target"
deploy: deploy-all
deploy-all: | build-libs deploy-libs build-service deploy-client-scripts deploy-cfg
deploy-client: | build-libs deploy-libs deploy-client-scripts
deploy-service: | build-libs deploy-libs build-service deploy-cfg
##########################################
# helper targets
build-service:
mkdir -p $(TARGET)/services/$(SERVICE_DIR)
mkdir -p $(TARGET)/services/$(SERVICE_DIR)/log
$(TPAGE) $(TPAGE_ARGS) service/start_service.tt > $(TARGET)/services/$(SERVICE_DIR)/start_service
chmod +x $(TARGET)/services/$(SERVICE_DIR)/start_service
$(TPAGE) $(TPAGE_ARGS) service/stop_service.tt > $(TARGET)/services/$(SERVICE_DIR)/stop_service
chmod +x $(TARGET)/services/$(SERVICE_DIR)/stop_service
$(TPAGE) $(TPAGE_ARGS) service/upstart.tt > service/$(SERVICE_NAME).conf
chmod +x service/$(SERVICE_NAME).conf
echo "done executing deploy-service target"
build-libs:
mkdir -p lib/Bio/KBase/${SERVICE_NAME}/
cp impl_code.txt lib/Bio/KBase/${SERVICE_NAME}/${SERVICE_NAME}Impl.pm
compile_typespec \
--psgi $(SERVICE_PSGI) \
--impl Bio::KBase::$(SERVICE_NAME)::$(SERVICE_NAME)Impl \
--service Bio::KBase::$(SERVICE_NAME)::Service \
--client Bio::KBase::$(SERVICE_NAME)::Client \
--py biokbase/$(SERVICE_NAME)/Client \
--js javascript/$(SERVICE_NAME)/Client \
--url $(SELF_URL) \
$(SERVICE_SPEC) lib
# First do regular deploy-scripts then run special wrapper for fba
deploy-client-scripts: deploy-scripts
export KB_TOP=$(TARGET); \
export KB_RUNTIME=$(DEPLOY_RUNTIME); \
export KB_PERL_PATH=$(TARGET)/lib ; \
export KB_DEPLOYMENT_CONFIG=$(TARGET)/deployment.cfg; \
export KB_SERVICE_NAME=fbaModelServices; \
export WRAP_VARIABLES="KB_DEPLOYMENT_CONFIG KB_SERVICE_NAME"; \
$(WRAP_PERL_SCRIPT) "$(TARGET)/plbin/njs-run-fba-modeling.pl" $(TARGET)/bin/njs-run-fba-modeling
###########################################
# test targets # requires /kb/deployment/user-env.sh to be sourced
test: test-client
test-client:
<some test script here>; \
if [ $$? -ne 0 ]; then \
exit 1; \
fi
@echo test-client successful
test-service:
$(KB_RUNTIME)/bin/perl test/service-test.pl ; \
if [ $$? -ne 0 ]; then \
exit 1; \
fi
@echo test-service successful
##########################################
include $(TOP_DIR)/tools/Makefile.common.rules