summaryrefslogtreecommitdiffstats
path: root/docker/chef-solo/cookbooks/Deploy-DCAE/recipes/jetty_setup.rb
blob: 74c384e51741fb1ff1b6a88f077bfe4f09f45b3b (plain)
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
jetty_base = "#{node['JETTY_BASE']}"
jetty_home = "#{node['JETTY_HOME']}"

#Set the http module option
if node['disableHttp']
  http_option = "#--module=http"
else
  http_option = "--module=http"
end


printf("DEBUG: [%s]:[%s] disableHttp=[%s], http_option=[%s] !!! \n", cookbook_name, recipe_name, node['disableHttp'], http_option )


directory "Jetty_etcdir_creation" do
    path "/#{jetty_base}/etc"
    owner 'jetty'
    group 'jetty'
    mode '0755'
    action :create
end


# Create Keystore
cookbook_file "#{jetty_base}/etc/keystore" do
   source "keystore"
   owner "jetty"
   group "jetty"
   mode 0755
end

# Create Trustore
cookbook_file "#{jetty_base}/etc/truststore" do
   source "truststore"
   owner "jetty"
   group "jetty"
   mode 0755
end

bash "create-jetty-modules" do
  cwd "#{jetty_base}"
  code <<-EOH
    cd "#{jetty_base}"
    java -jar "#{jetty_home}"/start.jar --add-to-start=deploy
    java -jar "#{jetty_home}"/start.jar --add-to-startd=http,https,logging,setuid
  EOH
end

# configure Jetty modules
template "http-ini" do
   path "#{jetty_base}/start.d/http.ini"
   source "http-ini.erb"
   owner "jetty"
   group "jetty"
   mode "0755"
   variables ({
     :http_option => http_option ,
     :http_port => "#{node['DCAE']['FE'][:http_port]}"
    })
end

template "https-ini" do
   path "#{jetty_base}/start.d/https.ini"
   source "https-ini.erb"
   owner "jetty"
   group "jetty"
   mode "0755"
   variables ({
     :https_port => "#{node['DCAE']['FE'][:https_port]}"
   })
end

template "ssl-ini" do
   path "#{jetty_base}/start.d/ssl.ini"
   source "ssl-ini.erb"
   owner "jetty"
   group "jetty"
   mode "0755"
   variables ({ 
     :https_port => "#{node['DCAE']['FE'][:https_port]}" ,
     :jetty_keystore_pwd => "#{node['jetty'][:keystore_pwd]}" ,
     :jetty_keymanager_pwd => "#{node['jetty'][:keymanager_pwd]}" ,
     :jetty_truststore_pwd => "#{node['jetty'][:truststore_pwd]}"
   })
end