summaryrefslogtreecommitdiffstats
path: root/docker/docker_tools
diff options
context:
space:
mode:
Diffstat (limited to 'docker/docker_tools')
-rw-r--r--docker/docker_tools/Dockerfile20
-rw-r--r--docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/.gitignore20
-rw-r--r--docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/.kitchen.yml16
-rw-r--r--docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/README.md4
-rw-r--r--docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/attributes/default.rb7
-rw-r--r--docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/files/default/config.json207
-rw-r--r--docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/metadata.rb7
-rw-r--r--docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/recipes/dcae_tools_setup.rb47
-rw-r--r--docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/templates/default/environment.json.erb12
-rw-r--r--docker/docker_tools/chef-solo/environments/.keep0
-rw-r--r--docker/docker_tools/chef-solo/roles/dcae-tools.json17
-rw-r--r--docker/docker_tools/chef-solo/solo.json4
-rw-r--r--docker/docker_tools/chef-solo/solo.rb16
-rw-r--r--docker/docker_tools/startup.sh17
14 files changed, 394 insertions, 0 deletions
diff --git a/docker/docker_tools/Dockerfile b/docker/docker_tools/Dockerfile
new file mode 100644
index 0000000..4a36f7d
--- /dev/null
+++ b/docker/docker_tools/Dockerfile
@@ -0,0 +1,20 @@
+FROM onap/base_sdc-jetty:1.2.0-SNAPSHOT-latest
+
+USER root
+
+RUN adduser -h /home/dcae -s /bin/sh -D dcae
+
+COPY target/dcaedt_tools-*.jar /var/opt/dcae-tools/app/dcaedt_tools.jar
+
+COPY chef-solo /var/opt/dcae-tools/chef-solo/
+
+COPY startup.sh /var/opt/dcae-tools
+
+RUN chmod 775 /var/opt/dcae-tools/startup.sh
+
+RUN chown -R dcae /var/opt/dcae-tools
+
+USER dcae
+
+ENTRYPOINT [ "/var/opt/dcae-tools/startup.sh" ]
+
diff --git a/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/.gitignore b/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/.gitignore
new file mode 100644
index 0000000..b31c0d3
--- /dev/null
+++ b/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/.gitignore
@@ -0,0 +1,20 @@
+.vagrant
+Berksfile.lock
+*~
+*#
+.#*
+\#*#
+.*.sw[a-z]
+*.un~
+
+# Bundler
+Gemfile.lock
+bin/*
+.bundle/*
+
+.kitchen/
+.kitchen.local.yml
+
+######### Private
+run.me
+DCAE-CI01.json
diff --git a/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/.kitchen.yml b/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/.kitchen.yml
new file mode 100644
index 0000000..37d2844
--- /dev/null
+++ b/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/.kitchen.yml
@@ -0,0 +1,16 @@
+---
+driver:
+ name: vagrant
+
+provisioner:
+ name: chef_zero
+
+platforms:
+ - name: ubuntu-16.04
+ - name: centos-7.1
+
+suites:
+ - name: default
+ run_list:
+ - recipe[Deploy-DCAE::default]
+ attributes:
diff --git a/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/README.md b/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/README.md
new file mode 100644
index 0000000..27aba53
--- /dev/null
+++ b/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/README.md
@@ -0,0 +1,4 @@
+# Deploy-DCAE
+
+TODO: Enter the cookbook description here.
+
diff --git a/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/attributes/default.rb b/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/attributes/default.rb
new file mode 100644
index 0000000..b774969
--- /dev/null
+++ b/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/attributes/default.rb
@@ -0,0 +1,7 @@
+default['WORKSPACE_DIR'] = "/var/opt/dcae-tools/app"
+
+default['DCAE']['BE'][:http_port] = 8082
+default['DCAE']['BE'][:https_port] = 8444
+
+default['disableHttp'] = true
+
diff --git a/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/files/default/config.json b/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/files/default/config.json
new file mode 100644
index 0000000..a243dc7
--- /dev/null
+++ b/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/files/default/config.json
@@ -0,0 +1,207 @@
+{
+ "templateInfo": [{
+ "name": "Syslog Collector Template",
+ "flowType": "Syslog Collector",
+ "description": "Syslog Collector",
+ "category": "Template",
+ "subCategory":"Base Monitoring Template",
+ "updateIfExist": "false",
+ "composition": [{
+ "type": "SyslogCollector",
+ "alias": "Syslog"
+ }, {
+ "type": "Existing Topic",
+ "alias": "eTopic"
+ }],
+ "relations": [{
+ "fromComponent": "Syslog.SyslogCollector",
+ "fromRequirement": "stream_publish_0",
+ "toComponent": "eTopic.topic",
+ "toCapability": "topic"
+ }],
+ "nodesToDelete": [
+ {
+ "type": "SyslogCollector",
+ "nodeName": "topic0"
+ }]
+ },{
+ "name": "Syslog MSEA Template",
+ "flowType": "Syslog MSEA",
+ "description": "Syslog MSEA",
+ "category": "Template",
+ "subCategory":"Base Monitoring Template",
+ "updateIfExist": "false",
+ "composition": [{
+ "type": "Map",
+ "alias": "Map"
+ }, {
+ "type": "Supplement",
+ "alias": "Sup"
+ }, {
+ "type": "Enrich",
+ "alias": "Enr"
+ }, {
+ "type": "Alert",
+ "alias": "Ale"
+ }],
+ "relations": [{
+ "fromComponent": "Sup.Supplement",
+ "fromRequirement": "dependency",
+ "toComponent": "Map.Map",
+ "toCapability": "feature"
+ },{
+ "fromComponent": "Enr.Enrich",
+ "fromRequirement": "dependency",
+ "toComponent": "Sup.Supplement",
+ "toCapability": "feature"
+ },{
+ "fromComponent": "Ale.Alert",
+ "fromRequirement": "dependency",
+ "toComponent": "Enr.Enrich",
+ "toCapability": "feature"
+ }]
+ },{
+ "name": "Status Poller Collector Template",
+ "flowType": "Status Poller Collector",
+ "description": "Status Poller Collector",
+ "category": "Template",
+ "subCategory":"Base Monitoring Template",
+ "updateIfExist": "false",
+ "composition": [{
+ "type": "StatusPoller",
+ "alias": "sPoller"
+ }, {
+ "type": "Existing Topic",
+ "alias": "eTopic0"
+ }],
+ "relations": [{
+ "fromComponent": "sPoller.StatusPoller",
+ "fromRequirement": "stream_publish_0",
+ "toComponent": "eTopic0.topic",
+ "toCapability": "topic"
+ }],
+ "nodesToDelete": [
+ {
+ "type": "StatusPoller",
+ "nodeName": "topic0"
+ }]
+ }, {
+ "name": "Status Poller MSE Template",
+ "flowType": "Status Poller MSE",
+ "description": "Status Poller MSE",
+ "category": "Template",
+ "subCategory":"Base Monitoring Template",
+ "updateIfExist": "false",
+ "composition": [{
+ "type": "Map",
+ "alias": "Map"
+ }, {
+ "type": "Supplement",
+ "alias": "Sup"
+ }, {
+ "type": "Enrich",
+ "alias": "Enr"
+ }],
+ "relations": [{
+ "fromComponent": "Sup.Supplement",
+ "fromRequirement": "dependency",
+ "toComponent": "Map.Map",
+ "toCapability": "feature"
+ },{
+ "fromComponent": "Enr.Enrich",
+ "fromRequirement": "dependency",
+ "toComponent": "Sup.Supplement",
+ "toCapability": "feature"
+ }]
+ }, {
+ "name": "FOI Collector Template",
+ "flowType": "FOI Collector",
+ "description": "FOI Collector",
+ "category": "Template",
+ "subCategory":"Base Monitoring Template",
+ "updateIfExist": "false",
+ "composition": [{
+ "type": "FOICollector",
+ "alias": "fCollector"
+ }, {
+ "type": "Existing Feed",
+ "alias": "eFeed"
+ }],
+ "relations": [{
+ "fromComponent": "fCollector.FoiSftp",
+ "fromRequirement": "stream_publish_0",
+ "toComponent": "eFeed.feed",
+ "toCapability": "feed"
+ }],
+ "nodesToDelete": [
+ {
+ "type": "FOICollector",
+ "nodeName": "feed0"
+ }]
+ }, {
+ "name": "SNMP MSE Template",
+ "flowType": "SNMP MSE",
+ "description": "SNMP MSE",
+ "category": "Template",
+ "subCategory":"Base Monitoring Template",
+ "updateIfExist": "false",
+ "composition": [{
+ "type": "Map",
+ "alias": "Map"
+ }, {
+ "type": "Supplement",
+ "alias": "Sup"
+ }, {
+ "type": "Enrich",
+ "alias": "Enr"
+ }],
+ "relations": [{
+ "fromComponent": "Sup.Supplement",
+ "fromRequirement": "dependency",
+ "toComponent": "Map.Map",
+ "toCapability": "feature"
+ },{
+ "fromComponent": "Enr.Enrich",
+ "fromRequirement": "dependency",
+ "toComponent": "Sup.Supplement",
+ "toCapability": "feature"
+ }]
+ }, {
+ "name": "Docker Map Template",
+ "flowType": "Docker Map",
+ "description": "Docker Map",
+ "category": "Template",
+ "subCategory":"Base Monitoring Template",
+ "updateIfExist": "false",
+ "composition": [{
+ "type": "DockerMap",
+ "alias": "dMp"
+ }, {
+ "type": "Existing Feed",
+ "alias": "eFeed"
+ }, {
+ "type": "Existing Topic",
+ "alias": "eTopic"
+ }],
+ "relations": [{
+ "fromComponent": "dMp.DockerMap",
+ "fromRequirement": "stream_subscribe_0",
+ "toComponent": "eFeed.feed",
+ "toCapability": "feed"
+ }, {
+ "fromComponent": "dMp.DockerMap",
+ "fromRequirement": "stream_publish_0",
+ "toComponent": "eTopic.topic",
+ "toCapability": "topic"
+ }],
+ "nodesToDelete": [
+ {
+ "type": "DockerMap",
+ "nodeName": "feed0"
+ },
+ {
+ "type": "DockerMap",
+ "nodeName": "topic0"
+ }]
+ }]
+} \ No newline at end of file
diff --git a/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/metadata.rb b/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/metadata.rb
new file mode 100644
index 0000000..7935c22
--- /dev/null
+++ b/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/metadata.rb
@@ -0,0 +1,7 @@
+name 'Deploy-DCAE'
+maintainer 'The Authors'
+maintainer_email 'you@example.com'
+license 'all_rights'
+description 'Installs/Configures Deploy-DCAE'
+long_description 'Installs/Configures Deploy-DCAE'
+version '1.0.0'
diff --git a/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/recipes/dcae_tools_setup.rb b/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/recipes/dcae_tools_setup.rb
new file mode 100644
index 0000000..152def2
--- /dev/null
+++ b/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/recipes/dcae_tools_setup.rb
@@ -0,0 +1,47 @@
+workspace_dir = "#{node['WORKSPACE_DIR']}"
+
+dcae_be_host = node['DCAE_BE_VIP']
+
+if node['disableHttp']
+ protocol = "https"
+ dcae_be_port = node['DCAE']['BE'][:https_port]
+else
+ protocol = "http"
+ 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_host ,dcae_be_port )
+
+
+directory "#{workspace_dir}/conf" do
+ mode '0755'
+ owner "dcae"
+ group "dcae"
+ recursive true
+ action :create
+end
+
+
+template "dcae-tools-config-yaml" do
+ sensitive true
+ path "/#{workspace_dir}/conf/environment.json"
+ source "environment.json.erb"
+ mode "0755"
+ owner "dcae"
+ group "dcae"
+ variables ({
+ :dcae_be_host => dcae_be_host,
+ :dcae_be_port => dcae_be_port,
+ :protocol => protocol
+ })
+end
+
+
+cookbook_file "/#{workspace_dir}/conf/config.json" do
+ sensitive true
+ source "config.json"
+ owner "dcae"
+ group "dcae"
+ mode "0755"
+ action :create
+end
diff --git a/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/templates/default/environment.json.erb b/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/templates/default/environment.json.erb
new file mode 100644
index 0000000..a792cf9
--- /dev/null
+++ b/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/templates/default/environment.json.erb
@@ -0,0 +1,12 @@
+{
+ "dcaeBeHost": "<%= @protocol %>://<%= @dcae_be_host %>",
+ "dcaeBePort": "<%= @dcae_be_port %>",
+ "apiPath": "/dcae",
+ "credential" :{
+ "editor": "Carlos_Santana",
+ "username": "cs0008",
+ "password": "",
+ "firstName": "",
+ "lastName": ""
+ }
+} \ No newline at end of file
diff --git a/docker/docker_tools/chef-solo/environments/.keep b/docker/docker_tools/chef-solo/environments/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/docker/docker_tools/chef-solo/environments/.keep
diff --git a/docker/docker_tools/chef-solo/roles/dcae-tools.json b/docker/docker_tools/chef-solo/roles/dcae-tools.json
new file mode 100644
index 0000000..9544756
--- /dev/null
+++ b/docker/docker_tools/chef-solo/roles/dcae-tools.json
@@ -0,0 +1,17 @@
+{
+ "name": "dcae-tools",
+ "description": "Running DCAE setup Jar",
+ "json_class": "Chef::Role",
+ "default_attributes": {
+
+ },
+ "override_attributes": {
+
+ },
+ "chef_type": "role",
+ "run_list": [
+ "recipe[Deploy-DCAE::dcae_tools_setup]"
+ ],
+ "env_run_lists": {
+ }
+}
diff --git a/docker/docker_tools/chef-solo/solo.json b/docker/docker_tools/chef-solo/solo.json
new file mode 100644
index 0000000..b7c24a2
--- /dev/null
+++ b/docker/docker_tools/chef-solo/solo.json
@@ -0,0 +1,4 @@
+{
+ "run_list": [ "role[dcae-tools]" ]
+}
+
diff --git a/docker/docker_tools/chef-solo/solo.rb b/docker/docker_tools/chef-solo/solo.rb
new file mode 100644
index 0000000..06c1af4
--- /dev/null
+++ b/docker/docker_tools/chef-solo/solo.rb
@@ -0,0 +1,16 @@
+root = File.absolute_path(File.dirname(__FILE__))
+file_cache_path root
+cookbook_path root + '/cookbooks'
+json_attribs root + '/solo.json'
+checksum_path root + '/checksums'
+data_bag_path root + '/data_bags'
+environment_path root + '/environments'
+file_backup_path root + '/backup'
+file_cache_path root + '/cache'
+log_level :info
+log_location STDOUT
+rest_timeout 300
+role_path root + '/roles'
+syntax_check_cache_path
+umask 0022
+verbose_logging nil
diff --git a/docker/docker_tools/startup.sh b/docker/docker_tools/startup.sh
new file mode 100644
index 0000000..c8f5132
--- /dev/null
+++ b/docker/docker_tools/startup.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+set -x
+# Run chef-solo for configuration
+cd /var/opt/dcae-tools/chef-solo
+chef-solo -c solo.rb -E ${ENVNAME} --log_level "debug" --logfile "/tmp/Chef-Solo.log"
+
+status=$?
+if [ $status != 0 ]; then
+ echo "[ERROR] Problem detected while running chef. Aborting !"
+ exit 1
+fi
+
+# Execute DCAE tools
+cd /var/opt/dcae-tools/app
+java -jar dcaedt_tools.jar conf/environment.json conf/config.json
+
+exec "$@"; \ No newline at end of file