Skip to content

Commit 6376249

Browse files
committed
Add support for dancer configuration file and session location definition.
1 parent 1845f82 commit 6376249

File tree

5 files changed

+32
-19
lines changed

5 files changed

+32
-19
lines changed

Makefile

+8-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ TPAGE_ARGS = --define kb_top=$(TARGET) \
6363

6464
TESTS = $(wildcard t/client-tests/*.t)
6565

66-
all: build-libs bin compile-typespec service
66+
all: build-libs bin compile-typespec service build-dancer-config
6767

6868
build-libs:
6969
$(TPAGE) $(TPAGE_ARGS) AppConfig.pm.tt > lib/Bio/KBase/AppService/AppConfig.pm
@@ -112,7 +112,7 @@ deploy: deploy-client deploy-service
112112
deploy-all: deploy-client deploy-service
113113
deploy-client: compile-typespec build-libs deploy-docs deploy-libs deploy-scripts
114114

115-
deploy-service: deploy-dir deploy-monit deploy-libs deploy-service-scripts
115+
deploy-service: deploy-dir deploy-monit deploy-libs deploy-service-scripts deploy-dancer-config
116116
for script in start_service stop_service postinstall; do \
117117
$(TPAGE) $(TPAGE_ARGS) service/$$script.tt > $(TARGET)/services/$(SERVICE)/$$script ; \
118118
chmod +x $(TARGET)/services/$(SERVICE)/$$script ; \
@@ -122,6 +122,12 @@ deploy-service: deploy-dir deploy-monit deploy-libs deploy-service-scripts
122122
ln -s ../services/$(SERVICE)/postinstall $(TARGET)/postinstall/$(SERVICE)
123123
rsync -arv app_specs $(TARGET)/services/$(SERVICE)/.
124124

125+
deploy-dancer-config:
126+
$(TPAGE) --define deployment_flag=1 $(TPAGE_ARGS) dancer_config.yml.tt > $(TARGET)/services/$(SERVICE)/config.yml
127+
128+
build-dancer-config:
129+
$(TPAGE) $(TPAGE_ARGS) dancer_config.yml.tt > lib/Bio/KBase/AppService/config.yml
130+
125131
deploy-service-scripts:
126132
export KB_TOP=$(TARGET); \
127133
export KB_RUNTIME=$(DEPLOY_RUNTIME); \

dancer_config.yml.tt

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
session: "YAML"
2+
3+
template: "template_toolkit"
4+
engines:
5+
session:
6+
YAML:
7+
[% IF kb_service_log_dir -%]
8+
session_dir: "[% kb_service_log_dir %]/sessions"
9+
[% ELSIF deployment_flag -%]
10+
session_dir: "[% kb_top %]/services/[% kb_service_name %]"
11+
[% ELSE -%]
12+
session_dir: "./sessions"
13+
[% END -%]

lib/Bio/KBase/AppService/Monitor.pm

+3-8
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,16 @@ use Data::Dumper;
66
use LWP::UserAgent;
77
use HTTP::Headers;
88
use JSON::XS;
9+
use File::Spec;
910
use Bio::KBase::AppService::Awe;
1011

1112
our $impl;
1213
our $json = JSON::XS->new->pretty;
1314

14-
set session => 'YAML';
1515
set views => path(dirname(__FILE__), 'templates');
1616
set layout => 'main';
17-
set template => 'template_toolkit';
18-
set engines => {
19-
template => {
20-
template_toolkit => {
21-
},
22-
},
23-
};
17+
18+
print Dumper(Monitor => config);
2419

2520
sub set_impl
2621
{

lib/Bio/KBase/AppService/Quick.pm

+3-9
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use LWP::UserAgent;
1212
use HTTP::Headers;
1313
use JSON::XS;
1414
use MIME::Base64;
15+
use File::Spec;
1516
use Bio::KBase::AppService::Awe;
1617
use Bio::P3::Workspace::WorkspaceClientExt;
1718
use Bio::KBase::AppService::Client;
@@ -23,19 +24,12 @@ our $json = JSON::XS->new->pretty;
2324
our %token_cache;
2425
our $validator = P3TokenValidator->new();
2526

26-
set session => 'YAML';
2727
set views => path(dirname(__FILE__), 'templates');
28-
set layout => undef;
29-
set template => 'template_toolkit';
30-
set engines => {
31-
template => {
32-
template_toolkit => {
33-
},
34-
},
35-
};
3628
set content_type => 'text/plain';
3729
set error_template => undef;
3830

31+
print Dumper(Quick => config);
32+
3933
sub set_impl
4034
{
4135
my($i) = @_;

service/start_service.tt

+5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ export KB_DEPLOYMENT_CONFIG="$KB_TOP/deployment.cfg"
1414
# For phispy
1515
export R_LIBS="$KB_TOP/lib"
1616

17+
#
18+
# Dancer apps config dir
19+
#
20+
export DANCER_CONFDIR="$KB_TOP/services/[% kb_service_name %]"
21+
1722
[% IF kb_tempdir -%]
1823
export TMPDIR=[% kb_tempdir %]
1924
export TEMPDIR=[% kb_tempdir %]

0 commit comments

Comments
 (0)