diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/base/src/files/etc/profile.d/env.sh | 3 | ||||
-rw-r--r-- | packages/docker/pom.xml | 4 | ||||
-rw-r--r-- | packages/docker/src/main/docker/Dockerfile | 26 | ||||
-rw-r--r-- | packages/docker/src/main/docker/do-start.sh | 27 | ||||
-rw-r--r-- | packages/docker/src/main/docker/docker-install.sh | 40 | ||||
-rw-r--r-- | packages/install/src/files/base.conf | 3 |
6 files changed, 63 insertions, 40 deletions
diff --git a/packages/base/src/files/etc/profile.d/env.sh b/packages/base/src/files/etc/profile.d/env.sh index be8e7471..97076606 100644 --- a/packages/base/src/files/etc/profile.d/env.sh +++ b/packages/base/src/files/etc/profile.d/env.sh @@ -2,7 +2,7 @@ # ============LICENSE_START======================================================= # Base Package # ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ ### export POLICY_HOME=${{POLICY_HOME}} +export POLICY_LOGS=${{POLICY_LOGS}} export JAVA_HOME=${{JAVA_HOME}} export ENGINE_MANAGEMENT_USER=${{ENGINE_MANAGEMENT_USER}} export ENGINE_MANAGEMENT_PASSWORD=${{ENGINE_MANAGEMENT_PASSWORD}} 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 e65329da..5ec25823 100644 --- a/packages/docker/src/main/docker/docker-install.sh +++ b/packages/docker/src/main/docker/docker-install.sh @@ -4,7 +4,7 @@ # ============LICENSE_START======================================================= # Installation Package # ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -369,26 +369,32 @@ 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 + 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 - 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 + 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 [[ -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) if [ ! -r ${BASE_TGZ} ]; then @@ -861,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 @@ -876,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/packages/install/src/files/base.conf b/packages/install/src/files/base.conf index d92abed0..f1a37d0f 100644 --- a/packages/install/src/files/base.conf +++ b/packages/install/src/files/base.conf @@ -2,7 +2,7 @@ # ============LICENSE_START======================================================= # ONAP POLICY # ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ # SYSTEM software configuration POLICY_HOME=/opt/app/policy +POLICY_LOGS=/opt/app/policy/logs JAVA_HOME=/opt/jdk1.8.0_77 M2_HOME=/opt/app/policy/3rdparty/apache-maven-3.3.1 |