Add docker files
[sdc/dcae-d/dt-be-main.git] / docker / docker_be / chef-solo / cookbooks / Deploy-DCAE / recipes / jetty_setup.rb
1 jetty_base = "#{node['JETTY_BASE']}"
2 jetty_home = "#{node['JETTY_HOME']}"
3
4 #Set the http module option
5 if node['disableHttp']
6   http_option = "#--module=http"
7 else
8   http_option = "--module=http"
9 end
10
11
12 printf("DEBUG: [%s]:[%s] disableHttp=[%s], http_option=[%s] !!! \n", cookbook_name, recipe_name, node['disableHttp'], http_option )
13
14
15 directory "Jetty_etcdir_creation" do
16     path "/#{jetty_base}/etc"
17     owner 'jetty'
18     group 'jetty'
19     mode '0755'
20     action :create
21 end
22
23
24 # Create Keystore
25 cookbook_file "/#{jetty_base}/etc/keystore" do
26    source "keystore"
27    owner "jetty"
28    group "jetty"
29    mode 0755
30 end
31
32 # Create Truststore
33 cookbook_file "/#{jetty_base}/etc/truststore" do
34    source "truststore"
35    owner "jetty"
36    group "jetty"
37    mode 0755
38 end
39
40 bash "create-jetty-modules" do
41   cwd "#{jetty_base}"
42   code <<-EOH
43     cd "#{jetty_base}"
44     java -jar "/#{jetty_home}"/start.jar --add-to-start=deploy
45     java -jar "/#{jetty_home}"/start.jar --add-to-startd=http,https,logging,setuid
46   EOH
47 end
48
49 # configure Jetty modules
50 template "http-ini" do
51    path "/#{jetty_base}/start.d/http.ini"
52    source "http-ini.erb"
53    owner "jetty"
54    group "jetty"
55    mode "0755"
56    variables ({
57      :http_option => http_option ,
58      :http_port => "#{node['DCAE']['BE'][:http_port]}"
59     })
60 end
61
62 template "https-ini" do
63    path "/#{jetty_base}/start.d/https.ini"
64    source "https-ini.erb"
65    owner "jetty"
66    group "jetty"
67    mode "0755"
68    variables ({
69      :https_port => "#{node['DCAE']['BE'][:https_port]}"
70    })
71 end
72
73 template "ssl-ini" do
74    path "/#{jetty_base}/start.d/ssl.ini"
75    source "ssl-ini.erb"
76    owner "jetty"
77    group "jetty"
78    mode "0755"
79    variables ({ 
80      :https_port => "#{node['DCAE']['BE'][:https_port]}" ,
81      :jetty_keystore_pwd => "#{node['jetty'][:keystore_pwd]}" ,
82      :jetty_keymanager_pwd => "#{node['jetty'][:keymanager_pwd]}" ,
83      :jetty_truststore_pwd => "#{node['jetty'][:truststore_pwd]}"
84    })
85 end
86