summaryrefslogtreecommitdiffstats
path: root/rulemgt-standalone
diff options
context:
space:
mode:
Diffstat (limited to 'rulemgt-standalone')
-rw-r--r--rulemgt-standalone/pom.xml2
-rw-r--r--rulemgt-standalone/src/main/assembly/Dockerfile66
-rw-r--r--rulemgt-standalone/src/main/assembly/bin/initDB.sh4
-rw-r--r--rulemgt-standalone/src/main/assembly/bin/run.sh13
-rw-r--r--rulemgt-standalone/src/main/assembly/nginx.conf (renamed from rulemgt-standalone/src/main/assembly/holmes.nginx.conf)2
5 files changed, 46 insertions, 41 deletions
diff --git a/rulemgt-standalone/pom.xml b/rulemgt-standalone/pom.xml
index 44c7245..68467a9 100644
--- a/rulemgt-standalone/pom.xml
+++ b/rulemgt-standalone/pom.xml
@@ -130,7 +130,7 @@
<directory>src/main/assembly/</directory>
<filtering>false</filtering>
<includes>
- <include>holmes.nginx.conf</include>
+ <include>nginx.conf</include>
</includes>
</resource>
</resources>
diff --git a/rulemgt-standalone/src/main/assembly/Dockerfile b/rulemgt-standalone/src/main/assembly/Dockerfile
index 4714770..03265a6 100644
--- a/rulemgt-standalone/src/main/assembly/Dockerfile
+++ b/rulemgt-standalone/src/main/assembly/Dockerfile
@@ -1,48 +1,50 @@
-FROM ubuntu:16.04
+FROM openresty/openresty:alpine
MAINTAINER "Guangrong Fu" <fu.guangrong@zte.com.cn>
EXPOSE 9101 9104 9201
-#install openjdk-1.8
-#RUN sed -i 's#http://archive.ubuntu.com#http://mirrors.163.com#g' /etc/apt/sources.list
-RUN apt-get update
-RUN apt-get install -y openjdk-8-jdk
+ENV HOSTNAME holmes-rule-mgmt
-#configure the JDK
-RUN sed -i 's|#networkaddress.cache.ttl=-1|networkaddress.cache.ttl=10|' /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/java.security
-ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
-ENV PATH $PATH:/usr/lib/jvm/java-8-openjdk-amd64/jre/bin:/usr/lib/jvm/java-8-openjdk-amd64/bin
-ENV CLASSPATH .:${JAVA_HOME}/lib:${JRE_HOME}/lib
-ENV JRE_HOME ${JAVA_HOME}/jre
+ENV LANG C.UTF-8
-#install neccessary tools
-RUN apt-get install -y bash curl vim
-
-#install nginx
-RUN apt-get install -y wget build-essential libtool libpcre3 libpcre3-dev zlib1g-dev openssl
-RUN wget http://nginx.org/download/nginx-1.14.0.tar.gz
-RUN tar -zxvf nginx-1.14.0.tar.gz
-RUN rm nginx-1.14.0.tar.gz
-WORKDIR /nginx-1.14.0
-RUN ./configure --prefix=/usr/local/nginx
-RUN make install
-RUN ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx
-RUN rm -rf /nginx-1.14.0
-ADD holmes-rulemgt-frontend-*.tar.gz /usr/local/nginx/html
-ADD holmes.nginx.conf /usr/local/nginx/conf
+#install java-1.8-openjdk
+# add a simple script that can auto-detect the appropriate JAVA_HOME value
+# based on whether the JDK or only the JRE is installed
+RUN { \
+ echo '#!/bin/sh'; \
+ echo 'set -e'; \
+ echo; \
+ echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
+ } > /usr/local/bin/docker-java-home \
+ && chmod +x /usr/local/bin/docker-java-home
+ENV JAVA_HOME /usr/lib/jvm/java-1.8-openjdk
+ENV PATH $PATH:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin
-ENV HOSTNAME holmes-rule-mgmt
+ENV JAVA_ALPINE_VERSION 8.171.11-r0
+
+RUN set -x \
+ && apk add --no-cache \
+ openjdk8="$JAVA_ALPINE_VERSION" \
+ && [ "$JAVA_HOME" = "$(docker-java-home)" ]
-#add holmes related resources to the docker image
+#install neccessary tools
+RUN apk upgrade \
+ && apk update \
+ && apk add --no-cache curl \
+ && apk add --no-cache postgresql-client=10.4-r0
+
+#add the frontend pacakge to the docker images
+RUN rm /etc/nginx/conf.d/default.conf
+ADD holmes-rulemgt-frontend-*.tar.gz /usr/local/openresty/nginx/html
+ADD nginx.conf /usr/local/openresty/nginx/conf
+
+#add the backend package to the docker image
RUN mkdir /home/holmes
WORKDIR /home/holmes
ADD holmes-rulemgt-standalone-*-linux64.tar.gz /home/holmes/
RUN chmod 755 /home/holmes/bin/*.sh
-#install the postgres client
-RUN apt-get install -y postgresql-client-9.5 postgresql-contrib-9.5
-
-ENTRYPOINT /home/holmes/bin/run.sh
+CMD ["sh", "/home/holmes/bin/run.sh"]
diff --git a/rulemgt-standalone/src/main/assembly/bin/initDB.sh b/rulemgt-standalone/src/main/assembly/bin/initDB.sh
index b52b228..82fbea6 100644
--- a/rulemgt-standalone/src/main/assembly/bin/initDB.sh
+++ b/rulemgt-standalone/src/main/assembly/bin/initDB.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright 2017 ZTE Corporation.
#
@@ -40,7 +40,7 @@ psql -U $user -p $port -h $host -d $dbname -f $main_path/dbscripts/postgresql/on
psql -U $user -p $port -h $host -d $dbname --command 'select * from aplus_rule;'
sql_result=$?
unset PGPASSWORD
-cat "sql_result="$sql_result
+echo "sql_result=$sql_result"
if [ $sql_result != 0 ] ; then
echo "failed to init rulemgt database!"
exit 1
diff --git a/rulemgt-standalone/src/main/assembly/bin/run.sh b/rulemgt-standalone/src/main/assembly/bin/run.sh
index c8bae4c..fb7c164 100644
--- a/rulemgt-standalone/src/main/assembly/bin/run.sh
+++ b/rulemgt-standalone/src/main/assembly/bin/run.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright 2017 ZTE Corporation.
@@ -25,8 +25,8 @@ JAVA="$JAVA_HOME/bin/java"
echo @JAVA@ $JAVA
main_path=$RUNHOME/..
cd $main_path
-JAVA_OPTS="-Xms50m -Xmx128m -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9201"
-port=8312
+JAVA_OPTS="-Xms50m -Xmx128m"
+port=9201
#JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=$port,server=y,suspend=n"
echo @JAVA_OPTS@ $JAVA_OPTS
@@ -80,7 +80,10 @@ sed -i "s|keyStorePassword:.*|keyStorePassword: $KEY_PASSWORD|" "$main_path/conf
./bin/initDB.sh $JDBC_USERNAME $JDBC_PASSWORD $DB_NAME $DB_PORT "${URL_JDBC%:*}"
-#Start nginx
-nginx -c /usr/local/nginx/conf/holmes.nginx.conf
+
+#Register the frontend to MSB
+
+
+nginx -c /usr/local/openresty/nginx/conf/nginx.conf
"$JAVA" $JAVA_OPTS -classpath "$class_path" org.onap.holmes.rulemgt.RuleActiveApp server "$main_path/conf/rulemgt.yml"
diff --git a/rulemgt-standalone/src/main/assembly/holmes.nginx.conf b/rulemgt-standalone/src/main/assembly/nginx.conf
index 575b5a2..3714419 100644
--- a/rulemgt-standalone/src/main/assembly/holmes.nginx.conf
+++ b/rulemgt-standalone/src/main/assembly/nginx.conf
@@ -32,7 +32,7 @@ http {
server_name localhost;
location / {
- root html;
+ root /usr/local/openresty/nginx/html;
}
location ~*.(htm|html){