summaryrefslogtreecommitdiffstats
path: root/docker/chef-solo/cookbooks/Deploy-DCAE/recipes
diff options
context:
space:
mode:
Diffstat (limited to 'docker/chef-solo/cookbooks/Deploy-DCAE/recipes')
-rw-r--r--docker/chef-solo/cookbooks/Deploy-DCAE/recipes/dcae_setup.rb65
-rw-r--r--docker/chef-solo/cookbooks/Deploy-DCAE/recipes/jetty_setup.rb86
2 files changed, 151 insertions, 0 deletions
diff --git a/docker/chef-solo/cookbooks/Deploy-DCAE/recipes/dcae_setup.rb b/docker/chef-solo/cookbooks/Deploy-DCAE/recipes/dcae_setup.rb
new file mode 100644
index 0000000..27b1a0f
--- /dev/null
+++ b/docker/chef-solo/cookbooks/Deploy-DCAE/recipes/dcae_setup.rb
@@ -0,0 +1,65 @@
+jetty_base = "#{node['JETTY_BASE']}"
+dcae_logs = "#{node['APP_LOG_DIR']}"
+
+if node['disableHttp']
+ protocol = "https"
+ dcae_be_vip = node['DCAE_BE_VIP']
+ dcae_be_port = node['DCAE']['BE'][:https_port]
+else
+ protocol = "http"
+ dcae_be_vip = "localhost"
+ dcae_be_port = node['DCAE']['BE'][:http_port]
+end
+
+printf("DEBUG: [%s]:[%s] disableHttp=[%s], protocol=[%s], dcae_be_vip=[%s], dcae_be_port=[%s] !!! \n", cookbook_name, recipe_name, node['disableHttp'], protocol, dcae_be_vip ,dcae_be_port )
+
+raise "[ERROR] 'DCAE_BE_FQDN' is not defined" if dcae_be_vip.nil? || dcae_be_vip == ""
+
+directory "#{jetty_base}/config" do
+ owner "jetty"
+ group "jetty"
+ mode '0755'
+ recursive true
+ action :create
+end
+
+directory "#{jetty_base}/config/dcae-fe" do
+ owner "jetty"
+ group "jetty"
+ mode '0755'
+ recursive true
+ action :create
+end
+
+template "dcae-fe-config" do
+ sensitive true
+ path "#{jetty_base}/config/dcae-fe/application.properties"
+ source "dcae-application.properties.erb"
+ owner "jetty"
+ group "jetty"
+ mode "0755"
+ variables ({
+ :dcae_be_vip => dcae_be_vip,
+ :dcae_be_port => dcae_be_port,
+ :protocol => protocol
+ })
+end
+
+
+template "dcae-logback-spring-config" do
+ sensitive true
+ path "#{jetty_base}/config/dcae-fe/logback-spring.xml"
+ source "dcae-logback-spring.erb"
+ owner "jetty"
+ group "jetty"
+ mode "0755"
+end
+
+
+directory "#{dcae_logs}" do
+ owner "jetty"
+ group "jetty"
+ mode '0755'
+ recursive true
+ action :create
+end \ No newline at end of file
diff --git a/docker/chef-solo/cookbooks/Deploy-DCAE/recipes/jetty_setup.rb b/docker/chef-solo/cookbooks/Deploy-DCAE/recipes/jetty_setup.rb
new file mode 100644
index 0000000..74c384e
--- /dev/null
+++ b/docker/chef-solo/cookbooks/Deploy-DCAE/recipes/jetty_setup.rb
@@ -0,0 +1,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
+