aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docker_build.sh4
-rw-r--r--docker_merge.sh4
-rw-r--r--docker_verify.sh2
-rw-r--r--packages/docker/pom.xml4
-rw-r--r--packages/docker/src/main/docker/Dockerfile26
-rw-r--r--packages/docker/src/main/docker/do-start.sh27
-rw-r--r--packages/docker/src/main/docker/docker-install.sh43
-rw-r--r--pom.xml2
8 files changed, 63 insertions, 49 deletions
diff --git a/docker_build.sh b/docker_build.sh
index 1168a2a8..a7e79db6 100644
--- a/docker_build.sh
+++ b/docker_build.sh
@@ -58,7 +58,7 @@ TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_MAJMIN_VERSION}-lat
#
# This has the nexus repo prepended and major/minor/patch version with timestamp
#
-TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_VERSION}-STAGING-${TIMESTAMP}"
+TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_VERSION}-STAGING-${TIMESTAMP}Z"
echo $TAGS
@@ -92,7 +92,7 @@ then
exit 1
fi
-docker push ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_VERSION}-STAGING-${TIMESTAMP}
+docker push ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_VERSION}-STAGING-${TIMESTAMP}Z
if [ $? -ne 0 ]
then
diff --git a/docker_merge.sh b/docker_merge.sh
index bd2b99bc..2175d714 100644
--- a/docker_merge.sh
+++ b/docker_merge.sh
@@ -54,7 +54,7 @@ TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_MAJMIN_VERSION}-lat
#
# This has the nexus repo prepended and major/minor/patch version with timestamp
#
-TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_VERSION}-${TIMESTAMP}"
+TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_VERSION}-${TIMESTAMP}Z"
echo $TAGS
@@ -81,7 +81,7 @@ then
exit 1
fi
-docker push ${DOCKER_REPOSITORY}/onap/$IMAGE:${MVN_VERSION}-${TIMESTAMP}
+docker push ${DOCKER_REPOSITORY}/onap/$IMAGE:${MVN_VERSION}-${TIMESTAMP}Z
if [ $? -ne 0 ]
then
diff --git a/docker_verify.sh b/docker_verify.sh
index 99043f62..2e2c7110 100644
--- a/docker_verify.sh
+++ b/docker_verify.sh
@@ -57,7 +57,7 @@ TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_MAJMIN_VERSION}-lat
#
# This has the nexus repo prepended and major/minor/patch version with timestamp
#
-TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_VERSION}-${TIMESTAMP}"
+TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_VERSION}-${TIMESTAMP}Z"
echo $TAGS
diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml
index ff8ebadd..5d90809b 100644
--- a/packages/docker/pom.xml
+++ b/packages/docker/pom.xml
@@ -78,10 +78,10 @@
<artifactItems>
<artifactItem>
<groupId>org.onap.policy.drools-applications.controlloop.packages</groupId>
- <artifactId>apps</artifactId>
+ <artifactId>apps-controlloop</artifactId>
<version>${project.version}</version>
<type>zip</type>
- <destFileName>apps.zip</destFileName>
+ <destFileName>apps-controlloop.zip</destFileName>
</artifactItem>
</artifactItems>
</configuration>
diff --git a/packages/docker/src/main/docker/Dockerfile b/packages/docker/src/main/docker/Dockerfile
index d7af6be9..6d5c4ab7 100644
--- a/packages/docker/src/main/docker/Dockerfile
+++ b/packages/docker/src/main/docker/Dockerfile
@@ -2,11 +2,16 @@ FROM ubuntu:14.04
ARG HTTP_PROXY=${HTTP_PROXY}
ARG HTTPS_PROXY=${HTTPS_PROXY}
-ARG POLICY_LOGS=/var/log/ONAP/policy
+ARG POLICY_HOME=/opt/app/policy
+ARG POLICY_LOGS=/var/log/onap/policy/pdpd
+ARG POLICY_INSTALL=/tmp/policy-install
ENV http_proxy $HTTP_PROXY
ENV https_proxy $HTTPS_PROXY
+ENV POLICY_INSTALL ${POLICY_INSTALL}
+ENV POLICY_HOME ${POLICY_HOME}
ENV POLICY_LOGS ${POLICY_LOGS}
+ENV POLICY_DOCKER true
RUN \
apt-get clean && \
@@ -32,18 +37,23 @@ RUN \
apt-get install -y mariadb-client
RUN pip install http-prompt
-RUN mkdir -p /opt/app/policy/ /tmp/policy-install/ ${POLICY_LOGS} && \
- chown -R policy /opt/app/policy/ /tmp/policy-install/ ${POLICY_LOGS}
+RUN mkdir -p ${POLICY_HOME}/config ${POLICY_LOGS} ${POLICY_INSTALL}/config && \
+ chown -R policy:policy ${POLICY_HOME} ${POLICY_LOGS} ${POLICY_INSTALL}
-WORKDIR /tmp/policy-install
+WORKDIR ${POLICY_INSTALL}
-COPY install-drools.zip apps.zip docker-install.sh do-start.sh wait-for-port.sh ./
+COPY install-drools.zip apps-controlloop.zip docker-install.sh do-start.sh wait-for-port.sh ./
+
+VOLUME [ "${POLICY_INSTALL}/config", "${POLICY_HOME}/config" ]
RUN unzip -o install-drools.zip && \
- unzip -o apps.zip && \
- rm install-drools.zip apps.zip && \
- chown -R policy * && \
+ unzip -o apps-controlloop.zip && \
+ rm install-drools.zip apps-controlloop.zip && \
+ chown -R policy:policy * && \
chmod +x *.sh
+EXPOSE 9696 6969
+
USER policy
+
CMD ./do-start.sh
diff --git a/packages/docker/src/main/docker/do-start.sh b/packages/docker/src/main/docker/do-start.sh
index e1857441..5f156979 100644
--- a/packages/docker/src/main/docker/do-start.sh
+++ b/packages/docker/src/main/docker/do-start.sh
@@ -1,10 +1,12 @@
#!/bin/bash
# skip installation if build.info file is present (restarting an existing container)
-if [[ -f /opt/app/policy/etc/build.info ]]; then
+if [[ -f ${POLICY_HOME}/etc/build.info ]]; then
echo "Found existing installation, will not reinstall"
- . /opt/app/policy/etc/profile.d/env.sh
+ . ${POLICY_HOME}/etc/profile.d/env.sh
else
+ echo "installing .."
+
# replace conf files from installer with environment-specific files
# mounted from the hosting VM
if [[ -d config ]]; then
@@ -15,13 +17,22 @@ else
# needs to deploy some artifacts to the repo
./wait-for-port.sh nexus 8081
+ # remove broken symbolic links if any in data directory
+ if [[ -d ${POLICY_HOME}/config ]]; then
+ echo "removing dangling symbolic links"
+ find -L ${POLICY_HOME}/config -type l -exec rm -- {} +
+ fi
+
+ echo "docker install at ${PWD}"
+
./docker-install.sh
. /opt/app/policy/etc/profile.d/env.sh
# install policy keystore
- mkdir -p $POLICY_HOME/etc/ssl
- cp config/policy-keystore $POLICY_HOME/etc/ssl
+
+ mkdir -p ${POLICY_HOME}/etc/ssl
+ cp config/policy-keystore ${POLICY_HOME}/etc/ssl
if [[ -x config/drools-tweaks.sh ]] ; then
echo "Executing tweaks"
@@ -29,16 +40,10 @@ else
# argument to bash avoids needing execute perms.
bash config/drools-tweaks.sh
fi
-
- # wait for DB up
- ./wait-for-port.sh mariadb 3306
-
- # now that DB is up, invoke database upgrade:
- # sql provisioning scripts should be invoked here.
fi
echo "Starting processes"
policy start
-sleep 1000d
+tail -f /dev/null
diff --git a/packages/docker/src/main/docker/docker-install.sh b/packages/docker/src/main/docker/docker-install.sh
index 2ff6a0b3..5ec25823 100644
--- a/packages/docker/src/main/docker/docker-install.sh
+++ b/packages/docker/src/main/docker/docker-install.sh
@@ -369,32 +369,31 @@ function install_base() {
fi
done
+ /bin/mkdir -p "${POLICY_HOME}/logs/" > /dev/null 2>&1
+
if [[ ! ( -d "$POLICY_HOME" && -w "$POLICY_HOME" ) ]]; then
echo "ERROR: Installation directory $POLICY_HOME does not exist or not writable"
exit 1
fi
- if ! /bin/rm -fr "${POLICY_HOME}"/* > /dev/null 2>&1; then
- echo "error: aborting base installation: cannot delete the underlying ${POLICY_HOME} files"
- exit 1
- fi
-
- POLICY_HOME_CONTENTS=$(ls -A "${POLICY_HOME}" 2> /dev/null)
- if [[ -n ${POLICY_HOME_CONTENTS} ]]; then
- echo "error: aborting base installation: ${POLICY_HOME} directory is not empty"
- exit 1
- fi
-
- if ! /bin/mkdir -p "${POLICY_HOME}/logs/" > /dev/null 2>&1; then
- echo "error: aborting base installation: cannot create ${POLICY_HOME}/logs/"
- exit 1
- fi
+ if [[ -z ${POLICY_DOCKER} ]]; then
+ if ! /bin/rm -fr "${POLICY_HOME}"/* > /dev/null 2>&1; then
+ echo "error: aborting base installation: cannot delete the underlying ${POLICY_HOME} files"
+ exit 1
+ fi
- if [[ -n ${POLICY_LOGS} ]]; then
- if ! /bin/mkdir -p "${POLICY_LOGS}" > /dev/null 2>&1; then
- echo "error: aborting base installation: cannot create ${POLICY_LOGS}"
+ POLICY_HOME_CONTENTS=$(ls -A "${POLICY_HOME}" 2> /dev/null)
+ if [[ -n ${POLICY_HOME_CONTENTS} ]]; then
+ echo "error: aborting base installation: ${POLICY_HOME} directory is not empty"
exit 1
- fi
+ fi
+
+ if [[ -n ${POLICY_LOGS} ]]; then
+ if ! /bin/mkdir -p "${POLICY_LOGS}" > /dev/null 2>&1; then
+ echo "error: aborting base installation: cannot create ${POLICY_LOGS}"
+ exit 1
+ fi
+ fi
fi
BASE_TGZ=$(ls base-*.tar.gz)
@@ -868,7 +867,7 @@ function do_install()
set -x
fi
- echo "Starting installation at $(date)"
+ echo "Starting installation at $(date) at ${PWD}"
echo
COMPONENT_TYPE=base
@@ -883,12 +882,12 @@ function do_install()
installArtifacts
- if [[ -f apps-installer ]]; then
+ if [[ -f apps-controlloop-installer ]]; then
# if exists, any customizations to the
# base drools installation from the drools apps
# is executed here
- ./apps-installer
+ ./apps-controlloop-installer
fi
echo
diff --git a/pom.xml b/pom.xml
index 9fd43aad..cd484f9f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -61,7 +61,7 @@
<cambria.version>0.0.1</cambria.version>
<jersey.version>2.25.1</jersey.version>
<jersey.swagger.version>1.5.18</jersey.swagger.version>
- <jackson.version>2.9.4</jackson.version>
+ <jackson.version>2.9.5</jackson.version>
<http.client.version>4.5.5</http.client.version>
<http.core.version>4.4.4</http.core.version>
<logback.version>1.2.3</logback.version>