summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/docker/src/main/docker/Dockerfile20
-rw-r--r--packages/docker/src/main/docker/do-start.sh27
-rw-r--r--packages/docker/src/main/docker/docker-install.sh38
-rw-r--r--pom.xml2
4 files changed, 52 insertions, 35 deletions
diff --git a/packages/docker/src/main/docker/Dockerfile b/packages/docker/src/main/docker/Dockerfile
index d7af6be9..d4d427b5 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 ./
+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 * && \
+ 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..5fb59c27 100644
--- a/packages/docker/src/main/docker/docker-install.sh
+++ b/packages/docker/src/main/docker/docker-install.sh
@@ -374,27 +374,29 @@ function install_base() {
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 [[ -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 ! /bin/mkdir -p "${POLICY_HOME}/logs/" > /dev/null 2>&1; then
- echo "error: aborting base installation: cannot create ${POLICY_HOME}/logs/"
- 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 [[ -n ${POLICY_LOGS} ]]; then
- if ! /bin/mkdir -p "${POLICY_LOGS}" > /dev/null 2>&1; then
- echo "error: aborting base installation: cannot create ${POLICY_LOGS}"
+ 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 [[ -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 +870,7 @@ function do_install()
set -x
fi
- echo "Starting installation at $(date)"
+ echo "Starting installation at $(date) at ${PWD}"
echo
COMPONENT_TYPE=base
diff --git a/pom.xml b/pom.xml
index 8c7bfdad..1005283a 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>