aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/sdc-backend-init
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/sdc-backend-init')
-rw-r--r--catalog-be/sdc-backend-init/Dockerfile57
-rw-r--r--catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/1_create_consumer_and_user.rb21
-rw-r--r--catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/2_check_Backend.rb10
-rw-r--r--catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/3_import_Normatives.rb21
-rw-r--r--catalog-be/sdc-backend-init/startup.sh4
5 files changed, 61 insertions, 52 deletions
diff --git a/catalog-be/sdc-backend-init/Dockerfile b/catalog-be/sdc-backend-init/Dockerfile
index 3ffcbe691a..35e485b197 100644
--- a/catalog-be/sdc-backend-init/Dockerfile
+++ b/catalog-be/sdc-backend-init/Dockerfile
@@ -1,22 +1,59 @@
-FROM onap/base_sdc-python:1.7.0
+FROM onap/integration-python:8.0.0
+
+USER root
+
+# Needed for pycurl
+ENV PYCURL_SSL_LIBRARY=openssl
+
+# Install packages only needed for building
+RUN apk update && \
+ apk add binutils jq libpng && \
+ apk add --no-cache \
+ libcurl \
+ ruby && \
+ apk add --no-cache --virtual .build-dependencies \
+ libressl-dev \
+ ruby-dev \
+ libffi-dev \
+ libxml2-dev \
+ build-base \
+ curl-dev && \
+ # needed libcurl to install correctly
+ pip install 'pycurl==7.43.0.1' && \
+ set -ex && \
+ gem install \
+ chef:13.8.5 \
+ berkshelf:6.3.1 \
+ io-console:0.4.6 \
+ etc webrick \
+ --no-document && \
+ apk del .build-dependencies
+
+ENV ONAP_LOG=/home/onap/logs
+RUN mkdir $ONAP_LOG && chown onap:onap $ONAP_LOG
+
+# user/group are the same as in integration/docker/onap-python base image
+ENV user=onap group=onap
+
+USER onap
# user/group args are inherited from base_sdc-python base image
-COPY --chown=$user:$group scripts /home/$user/scripts
+COPY --chown=onap:onap scripts /home/onap/scripts
-RUN chmod 770 -R /home/$user/scripts && \
- cd /home/$user/scripts && \
+RUN chmod 770 -R /home/onap/scripts && \
+ cd /home/onap/scripts && \
python setup.py install --user
-ENV PATH=$PATH:/home/$user/.local/bin
+ENV PATH=$PATH:/home/onap/.local/bin
-COPY --chown=$user:$group chef-solo /home/$user/chef-solo/
+COPY --chown=onap:onap chef-solo /home/onap/chef-solo/
-COPY --chown=$user:$group chef-repo/cookbooks /home/$user/chef-solo/cookbooks/
+COPY --chown=onap:onap chef-repo/cookbooks /home/onap/chef-solo/cookbooks/
-COPY --chown=$user:$group startup.sh /home/$user/
+COPY --chown=onap:onap startup.sh /home/onap/
-RUN chmod 770 /home/$user/startup.sh
+RUN chmod 770 /home/onap/startup.sh
-WORKDIR /home/$user/
+WORKDIR /home/onap/
ENTRYPOINT /home/${user}/startup.sh
diff --git a/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/1_create_consumer_and_user.rb b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/1_create_consumer_and_user.rb
index dcf963fc29..3aabb0a10e 100644
--- a/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/1_create_consumer_and_user.rb
+++ b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/1_create_consumer_and_user.rb
@@ -28,20 +28,11 @@ if node['basic_auth']
end
end
-bash "executing-create_users" do
- code <<-EOH
- sdcuserinit -i #{node['Nodes']['BE']} -p #{be_port} #{basic_auth_config} #{user_conf_dir} #{https_flag}
- rc=$?
- if [[ $rc != 0 ]]; then exit $rc; fi
- EOH
- returns [0]
+execute "executing-create_users" do
+ command "sdcuserinit -i #{node['Nodes']['BE']} -p #{be_port} #{basic_auth_config} #{user_conf_dir} #{https_flag}"
+ action :run
end
-
-bash "executing-create_consumers" do
- code <<-EOH
- sdcconsumerinit -i #{node['Nodes']['BE']} -p #{be_port} #{basic_auth_config} #{https_flag}
- rc=$?
- if [[ $rc != 0 ]]; then exit $rc; fi
- EOH
- returns [0]
+execute "executing-create_consumers" do
+ command "sdcconsumerinit -i #{node['Nodes']['BE']} -p #{be_port} #{basic_auth_config} #{https_flag}"
+ action :run
end
diff --git a/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/2_check_Backend.rb b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/2_check_Backend.rb
index 27b1a7d5b9..2e479e0848 100644
--- a/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/2_check_Backend.rb
+++ b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/2_check_Backend.rb
@@ -21,11 +21,7 @@ if node['basic_auth']
end
end
-bash "executing-check_backend_health" do
- code <<-EOH
- sdccheckbackend -i #{node['Nodes']['BE']} -p #{be_port} #{basic_auth_config} #{https_flag}
- rc=$?
- if [[ $rc != 0 ]]; then exit $rc; fi
- EOH
- returns [0]
+execute "executing-check_backend_health" do
+ command "sdccheckbackend -i #{node['Nodes']['BE']} -p #{be_port} #{basic_auth_config} #{https_flag}"
+ action :run
end \ No newline at end of file
diff --git a/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/3_import_Normatives.rb b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/3_import_Normatives.rb
index 0abda0d07a..be32e98f2b 100644
--- a/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/3_import_Normatives.rb
+++ b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/3_import_Normatives.rb
@@ -26,21 +26,8 @@ cookbook_file "/var/tmp/normatives.tar.gz" do
source "normatives.tar.gz"
end
-bash "executing-import_Normatives" do
- code <<-EOH
- set -ex
-
- cd /var/tmp/
- tar -xvf normatives.tar.gz
-
- # executing the normatives
- # add --debug to the sdcinit command to enable debug
-
- cd /var/tmp/normatives/import/tosca
- sdcinit #{param} #{basic_auth_config} > /var/lib/jetty/logs/init.log
- rc=$?
- if [[ $rc != 0 ]]; then exit $rc; fi
-
- EOH
- returns [0]
+execute "create-jetty-modules" do
+ command "set -ex && tar -xvf normatives.tar.gz && cd /var/tmp/normatives/import/tosca && sdcinit #{param} #{basic_auth_config} > #{ENV['ONAP_LOG']}/init.log"
+ cwd "/var/tmp/"
+ action :run
end
diff --git a/catalog-be/sdc-backend-init/startup.sh b/catalog-be/sdc-backend-init/startup.sh
index 83bfbf23de..e216341882 100644
--- a/catalog-be/sdc-backend-init/startup.sh
+++ b/catalog-be/sdc-backend-init/startup.sh
@@ -1,6 +1,4 @@
#!/bin/sh
cd /home/"${user}"/chef-solo || exit $?
-chef-solo -c solo.rb -E "${ENVNAME}"
-rc=$?
-if [ $rc != 0 ]; then exit $rc; fi
+chef-solo -c solo.rb -E "${ENVNAME}" \ No newline at end of file