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