From b9708a7c3cfaf5767992a2b15180e7b85c459242 Mon Sep 17 00:00:00 2001 From: "Eran (ev672n), Vosk" Date: Tue, 7 Aug 2018 14:15:05 +0300 Subject: adding the dcae dt code Adding DCAE-dt code Change-Id: Id6b779db9d24e10825fb97ad5fd46f41e65e6738 Issue-ID: SDC-1614 Signed-off-by: Eran (ev672n), Vosk --- docker/chef-solo/cookbooks/dcae-dt/.gitignore | 20 ++ docker/chef-solo/cookbooks/dcae-dt/.kitchen.yml | 16 + docker/chef-solo/cookbooks/dcae-dt/README.md | 4 + .../cookbooks/dcae-dt/attributes/default.rb | 19 ++ .../cookbooks/dcae-dt/files/default/keystore | Bin 0 -> 4255 bytes .../cookbooks/dcae-dt/files/default/truststore | Bin 0 -> 4255 bytes docker/chef-solo/cookbooks/dcae-dt/metadata.rb | 7 + .../cookbooks/dcae-dt/recipes/dcae_dt_setup.rb | 69 +++++ .../cookbooks/dcae-dt/recipes/jetty_setup.rb | 86 ++++++ .../default/dcae-application.properties.erb | 4 + .../templates/default/dcae-logback-spring.erb | 342 +++++++++++++++++++++ .../dcae-dt/templates/default/http-ini.erb | 29 ++ .../dcae-dt/templates/default/https-ini.erb | 29 ++ .../dcae-dt/templates/default/ssl-ini.erb | 90 ++++++ docker/chef-solo/environments/.keep | 0 docker/chef-solo/roles/dcae-dt.json | 18 ++ docker/chef-solo/solo.json | 4 + docker/chef-solo/solo.rb | 16 + docker/scripts/set_dockerfile_and_pom.pl | 62 ++++ docker/set_user.sh | 20 ++ docker/startup.sh | 19 ++ 21 files changed, 854 insertions(+) create mode 100644 docker/chef-solo/cookbooks/dcae-dt/.gitignore create mode 100644 docker/chef-solo/cookbooks/dcae-dt/.kitchen.yml create mode 100644 docker/chef-solo/cookbooks/dcae-dt/README.md create mode 100644 docker/chef-solo/cookbooks/dcae-dt/attributes/default.rb create mode 100644 docker/chef-solo/cookbooks/dcae-dt/files/default/keystore create mode 100644 docker/chef-solo/cookbooks/dcae-dt/files/default/truststore create mode 100644 docker/chef-solo/cookbooks/dcae-dt/metadata.rb create mode 100644 docker/chef-solo/cookbooks/dcae-dt/recipes/dcae_dt_setup.rb create mode 100644 docker/chef-solo/cookbooks/dcae-dt/recipes/jetty_setup.rb create mode 100644 docker/chef-solo/cookbooks/dcae-dt/templates/default/dcae-application.properties.erb create mode 100644 docker/chef-solo/cookbooks/dcae-dt/templates/default/dcae-logback-spring.erb create mode 100644 docker/chef-solo/cookbooks/dcae-dt/templates/default/http-ini.erb create mode 100644 docker/chef-solo/cookbooks/dcae-dt/templates/default/https-ini.erb create mode 100644 docker/chef-solo/cookbooks/dcae-dt/templates/default/ssl-ini.erb create mode 100644 docker/chef-solo/environments/.keep create mode 100644 docker/chef-solo/roles/dcae-dt.json create mode 100644 docker/chef-solo/solo.json create mode 100644 docker/chef-solo/solo.rb create mode 100644 docker/scripts/set_dockerfile_and_pom.pl create mode 100755 docker/set_user.sh create mode 100644 docker/startup.sh (limited to 'docker') diff --git a/docker/chef-solo/cookbooks/dcae-dt/.gitignore b/docker/chef-solo/cookbooks/dcae-dt/.gitignore new file mode 100644 index 0000000..b31c0d3 --- /dev/null +++ b/docker/chef-solo/cookbooks/dcae-dt/.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/chef-solo/cookbooks/dcae-dt/.kitchen.yml b/docker/chef-solo/cookbooks/dcae-dt/.kitchen.yml new file mode 100644 index 0000000..8e76353 --- /dev/null +++ b/docker/chef-solo/cookbooks/dcae-dt/.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[dcae-dt::default] + attributes: diff --git a/docker/chef-solo/cookbooks/dcae-dt/README.md b/docker/chef-solo/cookbooks/dcae-dt/README.md new file mode 100644 index 0000000..de00ec4 --- /dev/null +++ b/docker/chef-solo/cookbooks/dcae-dt/README.md @@ -0,0 +1,4 @@ +# dcae-dt + +TODO: Enter the cookbook description here. + diff --git a/docker/chef-solo/cookbooks/dcae-dt/attributes/default.rb b/docker/chef-solo/cookbooks/dcae-dt/attributes/default.rb new file mode 100644 index 0000000..22650c5 --- /dev/null +++ b/docker/chef-solo/cookbooks/dcae-dt/attributes/default.rb @@ -0,0 +1,19 @@ +default['JETTY_BASE'] = "/var/lib/jetty" +default['JETTY_HOME'] = "/usr/local/jetty" +default['APP_LOG_DIR'] = "/opt/logs/dcae-dt" + +default['DCAE']['BE'][:http_port] = 8082 +default['DCAE']['BE'][:https_port] = 8444 + +default['DCAE']['FE'][:http_port] = 8183 +default['DCAE']['FE'][:https_port] = 9444 + +default['DCAE']['DT'][:http_port] = 8186 +default['DCAE']['DT'][:https_port] = 9446 + +default['jetty'][:keystore_pwd] = "OBF:1cp61iuj194s194u194w194y1is31cok" +default['jetty'][:keymanager_pwd] = "OBF:1cp61iuj194s194u194w194y1is31cok" +default['jetty'][:truststore_pwd] = "OBF:1cp61iuj194s194u194w194y1is31cok" + +default['disableHttp'] = true + diff --git a/docker/chef-solo/cookbooks/dcae-dt/files/default/keystore b/docker/chef-solo/cookbooks/dcae-dt/files/default/keystore new file mode 100644 index 0000000..c408393 Binary files /dev/null and b/docker/chef-solo/cookbooks/dcae-dt/files/default/keystore differ diff --git a/docker/chef-solo/cookbooks/dcae-dt/files/default/truststore b/docker/chef-solo/cookbooks/dcae-dt/files/default/truststore new file mode 100644 index 0000000..c408393 Binary files /dev/null and b/docker/chef-solo/cookbooks/dcae-dt/files/default/truststore differ diff --git a/docker/chef-solo/cookbooks/dcae-dt/metadata.rb b/docker/chef-solo/cookbooks/dcae-dt/metadata.rb new file mode 100644 index 0000000..f114e32 --- /dev/null +++ b/docker/chef-solo/cookbooks/dcae-dt/metadata.rb @@ -0,0 +1,7 @@ +name 'dcae-dt' +maintainer 'The Authors' +maintainer_email 'you@example.com' +license 'all_rights' +description 'Installs/Configures dcae-dt' +long_description 'Installs/Configures dcae-dt' +version '1.0.0' diff --git a/docker/chef-solo/cookbooks/dcae-dt/recipes/dcae_dt_setup.rb b/docker/chef-solo/cookbooks/dcae-dt/recipes/dcae_dt_setup.rb new file mode 100644 index 0000000..240ea10 --- /dev/null +++ b/docker/chef-solo/cookbooks/dcae-dt/recipes/dcae_dt_setup.rb @@ -0,0 +1,69 @@ +jetty_base = "#{node['JETTY_BASE']}" +dcae_logs = "#{node['APP_LOG_DIR']}" + +dcae_fe_vip = node['DCAE_FE_VIP'] + +if node['disableHttp'] + protocol = "https" + dcae_be_port = node['DCAE']['BE'][:https_port] + dcae_fe_port = node['DCAE']['FE'][:https_port] + dcae_dt_port = node['DCAE']['DT'][:https_port] +else + protocol = "http" + dcae_be_port = node['DCAE']['BE'][:http_port] + dcae_fe_port = node['DCAE']['FE'][:http_port] + dcae_dt_port = node['DCAE']['DT'][:http_port] +end + +printf("DEBUG: [%s]:[%s] disableHttp=[%s], protocol=[%s], dcae_dt_port=[%s] !!! \n", cookbook_name, recipe_name, node['disableHttp'], protocol, dcae_dt_port ) + + +directory "#{jetty_base}/config" do + owner "jetty" + group "jetty" + mode '0755' + recursive true + action :create +end + +directory "#{jetty_base}/config/dcae-dt" do + owner "jetty" + group "jetty" + mode '0755' + recursive true + action :create +end + +template "dcae-dt-config" do + sensitive true + path "#{jetty_base}/config/dcae-dt/application.properties" + source "dcae-application.properties.erb" + owner "jetty" + group "jetty" + mode "0755" + variables ({ + :dcae_fe_vip => dcae_fe_vip, + :dcae_fe_port => dcae_fe_port, + :protocol => protocol, + :dcae_dt_port => dcae_dt_port + }) +end + + +template "dcae-logback-spring-config" do + sensitive true + path "#{jetty_base}/config/dcae-dt/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 diff --git a/docker/chef-solo/cookbooks/dcae-dt/recipes/jetty_setup.rb b/docker/chef-solo/cookbooks/dcae-dt/recipes/jetty_setup.rb new file mode 100644 index 0000000..f07f0e9 --- /dev/null +++ b/docker/chef-solo/cookbooks/dcae-dt/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']['DT'][: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']['DT'][: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']['DT'][:https_port]}" , + :jetty_keystore_pwd => "#{node['jetty'][:keystore_pwd]}" , + :jetty_keymanager_pwd => "#{node['jetty'][:keymanager_pwd]}" , + :jetty_truststore_pwd => "#{node['jetty'][:truststore_pwd]}" + }) +end + diff --git a/docker/chef-solo/cookbooks/dcae-dt/templates/default/dcae-application.properties.erb b/docker/chef-solo/cookbooks/dcae-dt/templates/default/dcae-application.properties.erb new file mode 100644 index 0000000..789d103 --- /dev/null +++ b/docker/chef-solo/cookbooks/dcae-dt/templates/default/dcae-application.properties.erb @@ -0,0 +1,4 @@ +server.port=<%= @dcae_dt_port %> +server.context-path=/dcae +newFeUrl=<%= @protocol %>://<%= @dcae_fe_vip %>:<%= @dcae_fe_port %> +newFeContextPath=/dcaed diff --git a/docker/chef-solo/cookbooks/dcae-dt/templates/default/dcae-logback-spring.erb b/docker/chef-solo/cookbooks/dcae-dt/templates/default/dcae-logback-spring.erb new file mode 100644 index 0000000..7c0bfb6 --- /dev/null +++ b/docker/chef-solo/cookbooks/dcae-dt/templates/default/dcae-logback-spring.erb @@ -0,0 +1,342 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${defaultPattern} + + + + + + + + + + + + ${logDirectory}/${generalLogName}.log + + ${logDirectory}/${generalLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + ${defaultPattern} + + + + + 256 + + + + + + ${logDirectory}/${securityLogName}.log + + ${logDirectory}/${securityLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + ${defaultPattern} + + + + + 256 + 0 + + + + + + ${logDirectory}/${performanceLogName}.log + + ${logDirectory}/${performanceLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + ${defaultPattern} + + + + 256 + + + + + + ${logDirectory}/${serverLogName}.log + + ${logDirectory}/${serverLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + ${defaultPattern} + + + + 256 + + + + + + + ${logDirectory}/${policyLogName}.log + + ${logDirectory}/${policyLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + ${defaultPattern} + + + + 256 + + + + + + + + + ${logDirectory}/${auditLogName}.log + + + + AUDIT_MARKER + AUDIT + + DENY + ACCEPT + + + + ${logDirectory}/${auditLogName}.%i.log.zip + 1 + 10 + + + + 20MB + + + ${auditLoggerPattern} + + + + + 256 + + + + + ${logDirectory}/${metricsLogName}.log + + ${logDirectory}/${metricsLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + + ${metricsLoggerPattern} + + + + + + 256 + + + + + ${logDirectory}/${errorLogName}.log + + ${logDirectory}/${errorLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + ${errorLoggerPattern} + + + + + 256 + + + + + ${logDirectory}/${debugLogName}.log + + ${logDirectory}/${debugLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + ${debugLoggerPattern} + + + + + 256 + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docker/chef-solo/cookbooks/dcae-dt/templates/default/http-ini.erb b/docker/chef-solo/cookbooks/dcae-dt/templates/default/http-ini.erb new file mode 100644 index 0000000..8f26690 --- /dev/null +++ b/docker/chef-solo/cookbooks/dcae-dt/templates/default/http-ini.erb @@ -0,0 +1,29 @@ +# --------------------------------------- +# Module: http +<%= @http_option %> + +### HTTP Connector Configuration + +## Connector host/address to bind to +# jetty.http.host=0.0.0.0 + +## Connector port to listen on +jetty.http.port=<%= @http_port %> + +## Connector idle timeout in milliseconds +jetty.http.idleTimeout=30000 + +## Connector socket linger time in seconds (-1 to disable) +# jetty.http.soLingerTime=-1 + +## Number of acceptors (-1 picks default based on number of cores) +# jetty.http.acceptors=-1 + +## Number of selectors (-1 picks default based on number of cores) +# jetty.http.selectors=-1 + +## ServerSocketChannel backlog (0 picks platform default) +# jetty.http.acceptorQueueSize=0 + +## Thread priority delta to give to acceptor threads +# jetty.http.acceptorPriorityDelta=0 diff --git a/docker/chef-solo/cookbooks/dcae-dt/templates/default/https-ini.erb b/docker/chef-solo/cookbooks/dcae-dt/templates/default/https-ini.erb new file mode 100644 index 0000000..9999a41 --- /dev/null +++ b/docker/chef-solo/cookbooks/dcae-dt/templates/default/https-ini.erb @@ -0,0 +1,29 @@ +# --------------------------------------- +# Module: https +--module=https + +### HTTPS Connector Configuration + +## Connector host/address to bind to +# jetty.https.host=0.0.0.0 + +## Connector port to listen on +jetty.https.port=<%= @https_port %> + +## Connector idle timeout in milliseconds +jetty.https.idleTimeout=30000 + +## Connector socket linger time in seconds (-1 to disable) +# jetty.https.soLingerTime=-1 + +## Number of acceptors (-1 picks default based on number of cores) +# jetty.https.acceptors=-1 + +## Number of selectors (-1 picks default based on number of cores) +# jetty.https.selectors=-1 + +## ServerSocketChannel backlog (0 picks platform default) +# jetty.https.acceptorQueueSize=0 + +## Thread priority delta to give to acceptor threads +# jetty.https.acceptorPriorityDelta=0 diff --git a/docker/chef-solo/cookbooks/dcae-dt/templates/default/ssl-ini.erb b/docker/chef-solo/cookbooks/dcae-dt/templates/default/ssl-ini.erb new file mode 100644 index 0000000..9abac51 --- /dev/null +++ b/docker/chef-solo/cookbooks/dcae-dt/templates/default/ssl-ini.erb @@ -0,0 +1,90 @@ +# --------------------------------------- +# Module: ssl +--module=ssl + +### TLS(SSL) Connector Configuration + +## Connector host/address to bind to +# jetty.ssl.host=0.0.0.0 + +## Connector port to listen on +jetty.ssl.port=<%= @https_port %> + +## Connector idle timeout in milliseconds +# jetty.ssl.idleTimeout=30000 + +## Connector socket linger time in seconds (-1 to disable) +# jetty.ssl.soLingerTime=-1 + +## Number of acceptors (-1 picks default based on number of cores) +# jetty.ssl.acceptors=-1 + +## Number of selectors (-1 picks default based on number of cores) +# jetty.ssl.selectors=-1 + +## ServerSocketChannel backlog (0 picks platform default) +# jetty.ssl.acceptorQueueSize=0 + +## Thread priority delta to give to acceptor threads +# jetty.ssl.acceptorPriorityDelta=0 + +## Whether request host names are checked to match any SNI names +# jetty.ssl.sniHostCheck=true + +## max age in seconds for a Strict-Transport-Security response header (default -1) +# jetty.ssl.stsMaxAgeSeconds=31536000 + +## include subdomain property in any Strict-Transport-Security header (default false) +# jetty.ssl.stsIncludeSubdomains=true + +### SslContextFactory Configuration +## Note that OBF passwords are not secure, just protected from casual observation +## See http://www.eclipse.org/jetty/documentation/current/configuring-security-secure-passwords.html + +## Keystore file path (relative to $jetty.base) +#jetty.sslContext.keyStorePath=etc/keystore + +## Truststore file path (relative to $jetty.base) +#jetty.sslContext.trustStorePath=etc/truststore + +## Keystore password +# jetty.sslContext.keyStorePassword=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4 +jetty.sslContext.keyStorePassword=<%= @jetty_keystore_pwd %> + +## Keystore type and provider +# jetty.sslContext.keyStoreType=JKS +# jetty.sslContext.keyStoreProvider= + +## KeyManager password +# jetty.sslContext.keyManagerPassword=OBF:1u2u1wml1z7s1z7a1wnl1u2g +jetty.sslContext.keyManagerPassword=<%= @jetty_keymanager_pwd %> + +## Truststore password +# jetty.sslContext.trustStorePassword=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4 +jetty.sslContext.trustStorePassword=<%= @jetty_truststore_pwd %> + +## Truststore type and provider +# jetty.sslContext.trustStoreType=JKS +# jetty.sslContext.trustStoreProvider= + +## whether client certificate authentication is required +# jetty.sslContext.needClientAuth=false + +## Whether client certificate authentication is desired +# jetty.sslContext.wantClientAuth=false + +## Whether cipher order is significant (since java 8 only) +# jetty.sslContext.useCipherSuitesOrder=true + +## To configure Includes / Excludes for Cipher Suites or Protocols see tweak-ssl.xml example at +## https://www.eclipse.org/jetty/documentation/current/configuring-ssl.html#configuring-sslcontextfactory-cipherSuites + +## Set the size of the SslSession cache +# jetty.sslContext.sslSessionCacheSize=-1 + +## Set the timeout (in seconds) of the SslSession cache timeout +# jetty.sslContext.sslSessionTimeout=-1 + +## Allow SSL renegotiation +# jetty.sslContext.renegotiationAllowed=true +# jetty.sslContext.renegotiationLimit=5 diff --git a/docker/chef-solo/environments/.keep b/docker/chef-solo/environments/.keep new file mode 100644 index 0000000..e69de29 diff --git a/docker/chef-solo/roles/dcae-dt.json b/docker/chef-solo/roles/dcae-dt.json new file mode 100644 index 0000000..fe27501 --- /dev/null +++ b/docker/chef-solo/roles/dcae-dt.json @@ -0,0 +1,18 @@ +{ + "name": "dcae-dt", + "description": "Installation application Setup- dcae DT", + "json_class": "Chef::Role", + "default_attributes": { + + }, + "override_attributes": { + + }, + "chef_type": "role", + "run_list": [ + "recipe[dcae-dt::jetty_setup]", + "recipe[dcae-dt::dcae_dt_setup]" + ], + "env_run_lists": { + } +} diff --git a/docker/chef-solo/solo.json b/docker/chef-solo/solo.json new file mode 100644 index 0000000..3461494 --- /dev/null +++ b/docker/chef-solo/solo.json @@ -0,0 +1,4 @@ +{ + "run_list": [ "role[dcae-dt]" ] +} + diff --git a/docker/chef-solo/solo.rb b/docker/chef-solo/solo.rb new file mode 100644 index 0000000..06c1af4 --- /dev/null +++ b/docker/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/scripts/set_dockerfile_and_pom.pl b/docker/scripts/set_dockerfile_and_pom.pl new file mode 100644 index 0000000..8411f30 --- /dev/null +++ b/docker/scripts/set_dockerfile_and_pom.pl @@ -0,0 +1,62 @@ +#!/usr/bin/perl + +use strict; +use warnings; + + +my @lines; + +# +### POM file +# + +my $file = 'pom.xml'; +### Read the pom.xml file. +open (POM, $file) or die "[ERROR] Cannot read the file '$file' : $!\n\n"; +chomp (@lines = ); +close (POM); + +open (NEW, ">${file}") or die "[ERROR] Cannot write to the file '$file' : $!\n\n"; +foreach my $line (@lines) { + + # Replace groupID + if ($line =~ m|org.onap.sdc|) { + $line =~ s|org.onap.sdc|com.att.sdc|; + } + + # Remove the tags. + if ($line =~ m|(.*)|) { + + if ($1 eq '${docker.tag}') { + $line =~ s|\$\{docker.tag\}|\$\{project.version\}|; + } + else { + next; + } + } + + print NEW "$line\n"; +} +close (NEW); + + +# +### Dockerfie +# + +my $dockerFile = 'Dockerfile'; + +open (FILE, $dockerFile) or die "[ERROR] Cannot read the file '$dockerFile' : $!\n\n"; +chomp (@lines = ); +close (FILE); + +open (NEW, ">${dockerFile}") or die "[ERROR] Cannot write to the file '$dockerFile' : $!\n\n"; + +foreach my $line (@lines) { + # Replace the docker registry + if ($line =~ m|FROM|) { + $line =~ s|onap|dockercentral.it.att.com:5100/com.att.sdc|; + } + print NEW "$line\n"; +} +close (NEW); diff --git a/docker/set_user.sh b/docker/set_user.sh new file mode 100755 index 0000000..539a200 --- /dev/null +++ b/docker/set_user.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# Create user + +USER="jetty" +GROUP="jetty" +UID="352070" +GID="35953" + +# Remove user: +deluser ${USER} + +##delgroup ${GROUP} + +echo "${USER}:x:${UID}:${GID}::/home/${USER}:Linux User,,,:/home/jetty:/bin/false" >> /etc/passwd + +echo "${GROUP}:x:${GID}:${USER}" >> /etc/group + +echo "${USER}:!:17501:0:99999:7:::" >> /etc/shadow + +mkdir /home/${USER} && chown ${USER}:${GROUP} /home/${USER} diff --git a/docker/startup.sh b/docker/startup.sh new file mode 100644 index 0000000..4f363da --- /dev/null +++ b/docker/startup.sh @@ -0,0 +1,19 @@ +#!/bin/sh +#set -x + +# Run chef-solo for configuration +cd /var/opt/dcae-dt/chef-solo +chef-solo -c solo.rb -E ${ENVNAME} --log_level "debug" --logfile "/opt/logs/dcae-dt/chef-dcae-dt.log" + +status=$? +if [ $status != 0 ]; then + echo "[ERROR] Problem detected while running chef. Aborting !" + exit 1 +fi + +# Execute Jetty +cd /var/lib/jetty +/docker-entrypoint.sh & + +while true; do sleep 2; done + -- cgit