Create on boarding docker
[sdc.git] / catalog-be / sdc-backend / chef-repo / cookbooks / sdc-catalog-be / recipes / BE_2_setup_configuration.rb
1 # Set the cassandra replica number
2 cassandra_nodes = node['Nodes']['CS']
3 if cassandra_nodes.length <=2
4    replication_factor=1
5 elsif cassandra_nodes.length >2 && cassandra_nodes.length <=4
6    replication_factor=3
7 else
8    replication_factor=4
9 end
10
11
12 template "titan.properties" do
13    path "#{ENV['JETTY_BASE']}/config/catalog-be/titan.properties"
14    source "BE-titan.properties.erb"
15    owner "jetty"
16    group "jetty"
17    mode "0755"
18    variables({
19       :CASSANDRA_IP             => node['Nodes']['CS'],
20       :CASSANDRA_PWD            => node['cassandra'][:cassandra_password],
21       :CASSANDRA_USR            => node['cassandra'][:cassandra_user],
22       :rep_factor               => replication_factor,
23       :DC_NAME                  => node['cassandra'][:cluster_name]+node.chef_environment,
24       :titan_connection_timeout => node['cassandra']['titan_connection_timeout'],
25       :cassandra_traststore_password => node['cassandra'][:truststore_password],
26       :cassandra_ssl_enabled => "#{ENV['cassandra_ssl_enabled']}"
27    })
28 end
29
30
31 template "catalog-be-config" do
32    path "#{ENV['JETTY_BASE']}/config/catalog-be/configuration.yaml"
33    source "BE-configuration.yaml.erb"
34    owner "jetty"
35    group "jetty"
36    mode "0755"
37    variables({
38       :catalog_ip             => node['Nodes']['BE'],
39       :catalog_port           => node['BE'][:http_port],
40       :ssl_port               => node['BE'][:https_port],
41       :cassandra_ip           => node['Nodes']['CS'],
42       :rep_factor             => replication_factor,
43       :DC_NAME                => node['cassandra'][:cluster_name]+node.chef_environment,
44       :titan_Path             => "/var/lib/jetty/config/catalog-be/",
45       :socket_connect_timeout => node['cassandra']['socket_connect_timeout'],
46       :socket_read_timeout    => node['cassandra']['socket_read_timeout'],
47       :cassandra_pwd          => node['cassandra'][:cassandra_password],
48       :cassandra_usr          => node['cassandra'][:cassandra_user],
49       :cassandra_traststore_password => node['cassandra'][:truststore_password],
50       :cassandra_ssl_enabled => "#{ENV['cassandra_ssl_enabled']}"
51    })
52 end
53
54
55 template "distribution-engine-configuration" do
56    path "#{ENV['JETTY_BASE']}/config/catalog-be/distribution-engine-configuration.yaml"
57    source "BE-distribution-engine-configuration.yaml.erb"
58    owner "jetty"
59    group "jetty"
60    mode "0755"
61 end
62
63
64 cookbook_file "ArtifactGenerator" do
65    path "#{ENV['JETTY_BASE']}/config/catalog-be/Artifact-Generator.properties"
66    source "Artifact-Generator.properties"
67    owner "jetty"
68    group "jetty"
69    mode "0755"
70 end