aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/docker/src/main/docker/docker-files/Dockerfile.mso-arquillian41
-rw-r--r--packages/docker/src/main/docker/docker-files/Dockerfile.mso-build62
-rw-r--r--packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final38
-rw-r--r--packages/docker/src/main/docker/docker-files/chef-configs/readme.md1
-rw-r--r--packages/docker/src/main/docker/docker-files/scripts/build-and-start.sh230
-rw-r--r--packages/docker/src/main/docker/docker-files/scripts/init-chef.sh25
6 files changed, 29 insertions, 368 deletions
diff --git a/packages/docker/src/main/docker/docker-files/Dockerfile.mso-arquillian b/packages/docker/src/main/docker/docker-files/Dockerfile.mso-arquillian
index 044e3aa..b07c8c9 100644
--- a/packages/docker/src/main/docker/docker-files/Dockerfile.mso-arquillian
+++ b/packages/docker/src/main/docker/docker-files/Dockerfile.mso-arquillian
@@ -5,14 +5,8 @@ FROM openecomp/wildfly:1.0
MAINTAINER "The OpenECOMP Team"
LABEL Description="This image contains the OpenECOMP MSO base for arquillian" Version="1.0"
-ARG chef_repo_branch_name
-ARG chef_repo_address
-ARG chef_repo_git_name
-ARG chef_repo_git_username
-ENV BRANCH_NAME=$chef_repo_branch_name
-ENV REPO_USERNAME=$chef_repo_git_username
-ENV REPO_ADDRESS=$chef_repo_address
-ENV CHEF_REPO_NAME=$chef_repo_git_name
+ENV CHEF_REPO_NAME="chef-repo"
+ENV CHEF_CONFIG_NAME="mso-config"
### Downloading dependencies
@@ -23,7 +17,6 @@ RUN chown -R jboss:jboss /tmp/jacoco
### Install Chef
RUN dpkg -i chefdk_0.17.17-1_amd64.deb
-COPY scripts/init-chef.sh /opt/mso/scripts/init-chef.sh
COPY scripts/start-jboss-server.sh /opt/mso/scripts/start-jboss-server.sh
RUN chown jboss:jboss /opt/mso/scripts/*
@@ -42,34 +35,30 @@ RUN mkdir /shared
RUN chown jboss:jboss /shared
# Setup chef folders
+RUN mkdir -p /var/chef/nodes
+RUN chown jboss:jboss /var/chef/nodes
RUN mkdir /var/berks-cookbooks
RUN chown jboss:jboss /var/berks-cookbooks
-COPY chef-configs/solo.rb /tmp/git/solo.rb
-RUN chown -R jboss:jboss /tmp/git/
+RUN mkdir -p /home/jboss/.chef/nodes
+RUN chown jboss:jboss /home/jboss/.chef/nodes
-COPY id_rsa /home/jboss/user
-RUN chmod 600 /home/jboss/user
-RUN chown -R jboss:jboss /home/jboss
+COPY chef-configs/${CHEF_REPO_NAME} /var/berks-cookbooks/${CHEF_REPO_NAME}
+COPY chef-configs/${CHEF_CONFIG_NAME} /var/berks-cookbooks/${CHEF_CONFIG_NAME}
+COPY chef-configs/solo.rb /var/berks-cookbooks/${CHEF_REPO_NAME}/solo.rb
# Start Chef config
-RUN mkdir -p /var/nodes
-RUN chown jboss:jboss /var/nodes
-
-RUN mkdir -p /home/jboss/.chef/nodes
-RUN mkdir /home/jboss/.ssh
+RUN sed "s/CHEF_REPO_NAME_TO_REPLACE/${CHEF_REPO_NAME}/g" -i /var/berks-cookbooks/${CHEF_REPO_NAME}/solo.rb
+RUN chef-solo -c /var/berks-cookbooks/${CHEF_REPO_NAME}/solo.rb -o recipe[mso-config::apih],recipe[mso-config::bpmn],recipe[mso-config::jra]
-
-RUN apt-get install -y git && sed -i "s@jboss:/bin/false@jboss:/bin/bash@g" /etc/passwd && su jboss -c "/opt/mso/scripts/init-chef.sh" && sed -i "s@jboss:/bin/bash@jboss:/bin/false@g" /etc/passwd && apt-get remove --purge -y git && apt-get autoremove -y
-RUN rm -rf /home/jboss/.ssh
-RUN rm /home/jboss/user
+RUN mv /var/berks-cookbooks/${CHEF_REPO_NAME}/environments/mso-docker.json /var/berks-cookbooks/${CHEF_REPO_NAME}/environments/mso-docker-init.json
RUN echo "" > /shared/mso-docker.json
+RUN ln -s /shared/mso-docker.json /var/berks-cookbooks/${CHEF_REPO_NAME}/environments/mso-docker.json
+
+# Jacoco config
RUN echo "" > /shared/jacoco-it.exec
RUN ls -latr /
RUN ls -latr /shared
RUN chown jboss:jboss /shared/jacoco-it.exec
-RUN mv /var/berks-cookbooks/${CHEF_REPO_NAME}/environments/mso-docker.json /var/berks-cookbooks/${CHEF_REPO_NAME}/environments/mso-docker-init.json
-RUN ln -s /shared/mso-docker.json /var/berks-cookbooks/${CHEF_REPO_NAME}/environments/mso-docker.json
-RUN rm -rf /tmp/git
## Create the log folder for MSO
RUN mkdir -p /var/log/ecomp/MSO/
diff --git a/packages/docker/src/main/docker/docker-files/Dockerfile.mso-build b/packages/docker/src/main/docker/docker-files/Dockerfile.mso-build
deleted file mode 100644
index ddf0ac7..0000000
--- a/packages/docker/src/main/docker/docker-files/Dockerfile.mso-build
+++ /dev/null
@@ -1,62 +0,0 @@
-FROM ubuntu:16.04
-
-### File Author / Maintainer
-MAINTAINER "The OpenECOMP Team"
-LABEL Description="This image builds OpenECOMP MSO" Version="1.0"
-
-ARG http_proxy
-ARG https_proxy
-
-ARG mso_git_repository
-ARG mso_git_branch
-
-ARG mvn_central_user
-ARG mvn_central_pwd
-
-ENV HTTP_PROXY=$http_proxy
-ENV HTTPS_PROXY=$https_proxy
-ENV http_proxy=$HTTP_PROXY
-ENV https_proxy=$HTTPS_PROXY
-
-
-ENV mso_git_repository=$mso_git_repository
-ENV mso_git_branch=$mso_git_branch
-
-
-ENV mvn_central_user=$mvn_central_user
-ENV mvn_central_pwd=$mvn_central_pwd
-
-ENV JBOSS_HOME=/opt/jboss
-
-USER root
-
-COPY scripts/init-chef.sh /opt/mso/scripts/init-chef.sh
-RUN chmod 755 /opt/mso/scripts/init-chef.sh
-
-COPY scripts/build-and-start.sh /opt/mso/scripts/build-and-start.sh
-RUN chmod 755 /opt/mso/scripts/build-and-start.sh
-
-# should be copied at final destination once jboss user is created
-COPY id_rsa /tmp/id_rsa
-COPY settings.xml /tmp/settings.xml
-
-# should be copied at final destination once jboss is installed
-COPY jboss-configs/module.xml /tmp/jboss-configs/module.xml
-COPY jboss-configs/standalone-full-ha.xml /tmp/jboss-configs/standalone-full-ha.xml
-COPY jboss-configs/modules/mariadb/main/module.xml /tmp/jboss-configs/modules/mariadb/main
-COPY jboss-configs/configuration/standalone-full-ha.xml /tmp/jboss-configs/standalone/configuration/standalone-full-ha-mso.xml
-COPY jboss-configs/configuration/mgmt-users.properties /tmp/jboss-configs/standalone/configuration/mgmt-users.properties
-COPY jboss-configs/configuration/mgmt-groups.properties /tmp/jboss-configs/standalone/configuration/mgmt-groups.properties
-COPY jboss-configs/configuration/application-users.properties /tmp/jboss-configs/standalone/configuration/application-users.properties
-COPY jboss-configs/configuration/application-roles.properties /tmp/jboss-configs/standalone/configuration/application-roles.properties
-
-
-### Open Ports
-EXPOSE 8080
-
-### Start EAP
-VOLUME /shared
-
-
-CMD ["/opt/mso/scripts/build-and-start.sh"]
-
diff --git a/packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final b/packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final
index 2475112..ff7f44b 100644
--- a/packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final
+++ b/packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final
@@ -7,19 +7,14 @@ LABEL Description="This image contains the OpenECOMP MSO" Version="1.0"
ARG http_proxy
ARG https_proxy
-ARG chef_repo_branch_name
-ARG chef_repo_address
-ARG chef_repo_git_name
-ARG chef_repo_git_username
-ENV BRANCH_NAME=$chef_repo_branch_name
-ENV REPO_USERNAME=$chef_repo_git_username
-ENV REPO_ADDRESS=$chef_repo_address
-ENV CHEF_REPO_NAME=$chef_repo_git_name
ENV HTTP_PROXY=$http_proxy
ENV HTTPS_PROXY=$https_proxy
ENV http_proxy=$HTTP_PROXY
ENV https_proxy=$HTTPS_PROXY
+ENV CHEF_REPO_NAME="chef-repo"
+ENV CHEF_CONFIG_NAME="mso-config"
+
### Downloading dependencies
USER root
@@ -28,7 +23,6 @@ RUN apt-get install -y curl && curl -LO https://packages.chef.io/stable/ubuntu/
### Install Chef
RUN dpkg -i chefdk_0.17.17-1_amd64.deb
-COPY scripts/init-chef.sh /opt/mso/scripts/init-chef.sh
COPY scripts/start-jboss-server.sh /opt/mso/scripts/start-jboss-server.sh
RUN chown jboss:jboss /opt/mso/scripts/*
@@ -47,30 +41,24 @@ RUN mkdir /shared
RUN chown jboss:jboss /shared
# Setup chef folders
+RUN mkdir -p /var/chef/nodes
+RUN chown jboss:jboss /var/chef/nodes
RUN mkdir /var/berks-cookbooks
RUN chown jboss:jboss /var/berks-cookbooks
-COPY chef-configs/solo.rb /tmp/git/solo.rb
-RUN chown -R jboss:jboss /tmp/git/
+RUN mkdir -p /home/jboss/.chef/nodes
+RUN chown jboss:jboss /home/jboss/.chef/nodes
-COPY id_rsa /home/jboss/user
-RUN chmod 600 /home/jboss/user
-RUN chown -R jboss:jboss /home/jboss
+COPY chef-configs/${CHEF_REPO_NAME} /var/berks-cookbooks/${CHEF_REPO_NAME}
+COPY chef-configs/${CHEF_CONFIG_NAME} /var/berks-cookbooks/${CHEF_CONFIG_NAME}
+COPY chef-configs/solo.rb /var/berks-cookbooks/${CHEF_REPO_NAME}/solo.rb
# Start Chef config
-RUN mkdir -p /var/nodes
-RUN chown jboss:jboss /var/nodes
-
-RUN mkdir -p /home/jboss/.chef/nodes
-RUN mkdir /home/jboss/.ssh
+RUN sed "s/CHEF_REPO_NAME_TO_REPLACE/${CHEF_REPO_NAME}/g" -i /var/berks-cookbooks/${CHEF_REPO_NAME}/solo.rb
+RUN chef-solo -c /var/berks-cookbooks/${CHEF_REPO_NAME}/solo.rb -o recipe[mso-config::apih],recipe[mso-config::bpmn],recipe[mso-config::jra]
-
-RUN apt-get install -y git && sed -i "s@jboss:/bin/false@jboss:/bin/bash@g" /etc/passwd && su jboss -c "/opt/mso/scripts/init-chef.sh" && sed -i "s@jboss:/bin/bash@jboss:/bin/false@g" /etc/passwd && apt-get remove --purge -y git && apt-get autoremove -y
-RUN rm -rf /home/jboss/.ssh
-RUN rm /home/jboss/user
-RUN echo "" > /shared/mso-docker.json
RUN mv /var/berks-cookbooks/${CHEF_REPO_NAME}/environments/mso-docker.json /var/berks-cookbooks/${CHEF_REPO_NAME}/environments/mso-docker-init.json
+RUN echo "" > /shared/mso-docker.json
RUN ln -s /shared/mso-docker.json /var/berks-cookbooks/${CHEF_REPO_NAME}/environments/mso-docker.json
-RUN rm -rf /tmp/git
## Create the log folder for MSO
RUN mkdir -p /var/log/ecomp/MSO/
diff --git a/packages/docker/src/main/docker/docker-files/chef-configs/readme.md b/packages/docker/src/main/docker/docker-files/chef-configs/readme.md
new file mode 100644
index 0000000..6d42de8
--- /dev/null
+++ b/packages/docker/src/main/docker/docker-files/chef-configs/readme.md
@@ -0,0 +1 @@
+Please clone the 'chef-repo' and 'mso-config' repository here before building images.
diff --git a/packages/docker/src/main/docker/docker-files/scripts/build-and-start.sh b/packages/docker/src/main/docker/docker-files/scripts/build-and-start.sh
deleted file mode 100644
index 3694981..0000000
--- a/packages/docker/src/main/docker/docker-files/scripts/build-and-start.sh
+++ /dev/null
@@ -1,230 +0,0 @@
-#!/bin/bash -x
-
-GIT_REPO=$mso_git_repository
-GIT_BRANCH=$mso_git_branch
-! [[ $GIT_SSH_KEY ]] && GIT_SSH_KEY=/home/jboss/user
-MVN_CENTRAL_USER=$mvn_central_user
-MVN_CENTRAL_PWD=$mvn_central_pwd
-WILDFLY_TAR=wildfly-10.1.0.Final.tar.gz;
-CHEF_DEB=chefdk_0.17.17-1_amd64.deb
-
-echo "Jboss Home:"
-echo ${JBOSS_HOME}
-echo "Repository :"
-echo ${GIT_REPO}
-echo "Branch :"
-echo ${GIT_BRANCH}
-echo "Ssh key file :"
-echo ${GIT_SSH_KEY}
-echo "Maven central user :"
-echo ${MVN_CENTRAL_USER}
-
-[[ ${MVN_CENTRAL_PWD} ]] && echo "with password" || echo "without password"
-
-function update_terminal() {
- echo "--------------------------------------------------------------------------"
- echo $*
- echo "--------------------------------------------------------------------------"
-}
-
-function update_ubuntu() {
- update_terminal "Updating ubuntu"
- apt-get update
- apt-get -y dist-upgrade
-}
-
-
-function set_ssh_key() {
- [[ -f /home/jboss/user ]] && return || update_terminal "Setting ssh key"
- mkdir -p /home/jboss/.ssh/
- mv /tmp/id_rsa /home/jboss/user
- chown jboss:jboss -R /home/jboss/user
- chmod 600 /home/jboss/user
- chown jboss:jboss /home/jboss/.ssh
- chmod 700 /home/jboss/.ssh
-
-}
-
-function set_maven_settings() {
- [[ -f /home/jboss/.m2/settings.xml ]] && return || update_terminal "Updating maven settings"
- mkdir -p /home/jboss/.m2/
- mv /tmp/settings.xml /home/jboss/.m2/settings.xml
- chown -R jboss:jboss /home/jboss/.m2/
-
- # set login and password for maven central
- sed -i "s/#PASSWORD#/$MVN_CENTRAL_PWD/g" /home/jboss/.m2/settings.xml \
- && sed -i "s/#USERNAME#/$MVN_CENTRAL_USER/g" /home/jboss/.m2/settings.xml
-}
-
-function install_jboss() {
- [[ -f $JBOSS_HOME/bin/standalone.conf ]] && [[ $(grep "LAUNCH_JBOSS_IN_BACKGROUND=true" $JBOSS_HOME/bin/standalone.conf) ]] && return || update_terminal "Installing jboss";
-
-
- adduser --system --group jboss
-
- curl -C - -LO http://download.jboss.org/wildfly/10.1.0.Final/$WILDFLY_TAR ;
- tar xvfz $WILDFLY_TAR -C /opt/;
- mv /opt/${WILDFLY_TAR%.tar.gz} $JBOSS_HOME;
-
- chown -R jboss:jboss $JBOSS_HOME
- echo "JAVA_OPTS=\"\$JAVA_OPTS -Djboss.bind.address=0.0.0.0 -Djboss.bind.address.management=0.0.0.0 -Dmso.db=MARIADB -Dmso.config.path=/etc/mso/config.d/ -Dmso.aaf.enable=false \"" >> $JBOSS_HOME/bin/standalone.conf
- echo "LAUNCH_JBOSS_IN_BACKGROUND=true" >> $JBOSS_HOME/bin/standalone.conf
-
-}
-
-function create_log_folders() {
- [[ -d /var/log/ecomp ]] && [[ /var/log/ecomp/MSO/ ]] && return || update_terminal "Creating log folders"
- mkdir -p /var/log/ecomp/MSO/
- chown -R jboss:jboss /var/log/ecomp
-}
-
-function install_mariadb_connector() {
- [[ -f $JBOSS_HOME/standalone/configuration/standalone-full-ha-mso.xml ]] && return || update_terminal "Installing mariadb connector"
- MARIADB_DIR=$JBOSS_HOME/modules/mariadb
- curl -C - -O -L http://central.maven.org/maven2/org/mariadb/jdbc/mariadb-java-client/1.5.4/mariadb-java-client-1.5.4.jar
- mkdir -p $MARIADB_DIR/main
- mv mariadb-java-client-1.5.4.jar $MARIADB_DIR/main
- cp /tmp/jboss-configs//modules/mariadb/main/module.xml $MARIADB_DIR/main
- cp /tmp/jboss-configs/standalone-full-ha.xml $JBOSS_HOME/standalone/configuration/standalone-full-ha-mso.xml
- cp /tmp/jboss-configs/configuration/application-roles.properties $JBOSS_HOME/standalone/configuration/application-roles.properties
- cp /tmp/jboss-configs/configuration/application-users.properties $JBOSS_HOME/standalone/configuration/application-users.properties
- cp /tmp/jboss-configs/configuration/mgmt-groups.properties $JBOSS_HOME/standalone/configuration/mgmt-groups.properties
- cp /tmp/jboss-configs/configuration/mgmt-users.properties $JBOSS_HOME/standalone/configuration/mgmt-users.properties
-
- chown -R jboss:jboss $MARIADB_DIR
-}
-
-function dep_install() {
- update_terminal "Installing dependencies"
- # install requirements
- apt-get -y install openjdk-8-jre-headless curl git maven
- STATUS=$?
- if [[ $STATUS != 0 ]];
- then
- exit 1
- fi
-}
-
-function clone_mso() {
- [[ $("ls /tmp/mso-core") ]] && return || update_terminal "Cloning mso repository"
- # build git command
- GIT_CMD="git clone --single-branch -b ${GIT_BRANCH-master} ${GIT_REPO} -v"
-
- # build ssh command
- export GIT_SSH_COMMAND="ssh -i ${GIT_SSH_KEY} -o StrictHostKeyChecking=false"
-
- # cloning
- su - jboss -s /bin/bash -c "export GIT_SSH_COMMAND=\"ssh -i ${GIT_SSH_KEY} -o StrictHostKeyChecking=false\"; cd /tmp/; ${GIT_CMD} mso-core"
- STATUS=$?
- if [[ $STATUS != 0 ]];
- then
- exit 2
- fi
-}
-#export MAVEN_OPTS="$MAVEN_OPTS -Dhttp.proxyHost=one.proxy.att.com -Dhttp.proxyPort=8080 -Dhttps.proxyHost=one.proxy.att.com -Dhttps.proxyPort=8080"
-
-function mso_build() {
- update_terminal "Building Mso core"
- # building
- cd /tmp/mso-core
- su jboss -s /bin/bash -c "mvn clean install"
- STATUS=$?
- if [[ $STATUS != 0 ]];
- then
- exit 4
- fi
-}
-
-function war_to_temp() {
- [[ $("ls /tmp/wars/") ]] && return || update_terminal "Copying wars to tmp directory"
- function copy_wars() {
- for war in `find . -iname "*.war" `;
- do
- cp $war /tmp/wars/
- done
- }
- export -f copy_wars
- su - jboss -s /bin/bash -c copy_wars
- #tar xzf ./packages/deliveries/target/assembly/war-packs/*.tar.gz -C /tmp/wars/
-}
-
-function install_chef() {
- [[ -d /home/jboss/.chef/nodes ]] && return || update_terminal "Installing chef"
- curl -C - -LO https://packages.chef.io/stable/ubuntu/12.04/$CHEF_DEB
- dpkg -i $CHEF_DEB
- for dir in "/etc/chef /etc/mso /var/berks-cookbooks /tmp/git /var/nodes /home/jboss/.chef/nodes";
- do
- mkdir -p $dir
- chown jboss:jboss $dir
- chmod 700 $dir
- done
-}
-
-function chef_init() {
- update_terminal "Initializing chef"
- mkdir -p /tmp/git
- cp /shared/solo.rb /tmp/git/
- chown -R jboss:jboss /tmp/git
- su - jboss -s /bin/bash -c /opt/mso/scripts/init-chef.sh
- mv /var/berks-cookbooks/${CHEF_REPO_NAME}/environments/mso-docker.json /var/berks-cookbooks/${CHEF_REPO_NAME}/environments/mso-docker-init.json
- ln -s /shared/mso-docker.json /var/berks-cookbooks/${CHEF_REPO_NAME}/environments/mso-docker.json
-}
-
-function cleanup() {
- # cleaning & space freeup
- echo "Cleaning up"
-
- rm -rf /tmp/git/mso-core
- rm -f /$WILDFLY_TAR;
- rm -f /$CHEF_DEB
-
- rm -rf /home/jboss/.m2
- apt-get remove -y maven git curl
-
-}
-
-function build() {
- update_ubuntu
- dep_install
-
- install_jboss
- create_log_folders
- install_mariadb_connector
-
- set_ssh_key
-
- install_chef
- chef_init
-
-
- clone_mso
-
- set_maven_settings
- mso_build
- war_to_temp
- cleanup
-}
-
-function init_certif() {
- # Copy the certificates
- cp /shared/*.crt /usr/local/share/ca-certificates
- update-ca-certificates
-}
-
-function start() {
- su - jboss -s /bin/bash -c /opt/mso/scripts/start-jboss-server.sh
-}
-
-rm -f "$JBOSS_HOME/standalone/deployments/README.txt"
-if ! [[ "$(ls -A $JBOSS_HOME/standalone/deployments/)" ]];
-then
- mkdir -p /tmp/wars/
- build
- cp /tmp/wars/* $JBOSS_HOME/standalone/deployments/
- rm -rf /tmp/wars/
- init_certif
-fi
-
-cd /opt/jboss
-
-start
diff --git a/packages/docker/src/main/docker/docker-files/scripts/init-chef.sh b/packages/docker/src/main/docker/docker-files/scripts/init-chef.sh
deleted file mode 100644
index 0a562e7..0000000
--- a/packages/docker/src/main/docker/docker-files/scripts/init-chef.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-# Copyright 2015 AT&T Intellectual Properties
-##############################################################################
-# Script to initialize the chef-repo branch and.chef
-#
-##############################################################################
-
-set -x
-cd /tmp/git/
-export GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=false -i ~/user"
-git clone -b ${BRANCH_NAME:-master} --single-branch ssh://${REPO_USERNAME}@${REPO_ADDRESS}/${CHEF_REPO_NAME}.git
-
-
-# Will have to be removed later
-#mkdir -p /var/chef/nodes
-sed "s/CHEF_REPO_NAME_TO_REPLACE/${CHEF_REPO_NAME}/g" -i /tmp/git/solo.rb
-mv /tmp/git/solo.rb /tmp/git/${CHEF_REPO_NAME}/
-cd /tmp/git/${CHEF_REPO_NAME}
-
-echo "Vendor cookbooks with Berkshelf"
-berks vendor /var/berks-cookbooks -b Berksfile.mso-docker
-
-# Execute the ChefClient to configure the mso-config
-echo "Update config with chef solo"
-chef-solo -c /var/berks-cookbooks/${CHEF_REPO_NAME}/solo.rb -o recipe[mso-config::apih],recipe[mso-config::bpmn],recipe[mso-config::jra] \ No newline at end of file