aboutsummaryrefslogtreecommitdiffstats
path: root/packages/docker
diff options
context:
space:
mode:
Diffstat (limited to 'packages/docker')
-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
3 files changed, 51 insertions, 34 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