diff options
author | GuangrongFu <fu.guangrong@zte.com.cn> | 2018-07-23 16:47:42 +0800 |
---|---|---|
committer | GuangrongFu <fu.guangrong@zte.com.cn> | 2018-07-23 16:47:42 +0800 |
commit | 7c10ad301cd3fea79af61f1d092b2a3103f7ec11 (patch) | |
tree | abacc5fe0f43906b42b7c061eb4c2dc919d5566b /rulemgt-standalone | |
parent | a966da9a6108017711152fc69725397c8779fd08 (diff) |
Added nginx
Change-Id: Iffc0e337cbf59f9cae514d85eb3e1c83d0f664f9
Issue-ID: HOLMES-111
Signed-off-by: GuangrongFu <fu.guangrong@zte.com.cn>
Diffstat (limited to 'rulemgt-standalone')
-rw-r--r-- | rulemgt-standalone/pom.xml | 20 | ||||
-rw-r--r-- | rulemgt-standalone/src/main/assembly/Dockerfile | 19 | ||||
-rw-r--r-- | rulemgt-standalone/src/main/assembly/bin/run.sh | 3 | ||||
-rw-r--r-- | rulemgt-standalone/src/main/assembly/holmes.nginx.conf | 43 |
4 files changed, 84 insertions, 1 deletions
diff --git a/rulemgt-standalone/pom.xml b/rulemgt-standalone/pom.xml index 6fc8a98..44c7245 100644 --- a/rulemgt-standalone/pom.xml +++ b/rulemgt-standalone/pom.xml @@ -117,6 +117,26 @@ <overwrite>true</overwrite> </configuration> </execution> + <execution> + <id>copy-nginx-conf-file</id> + <phase>process-resources</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>target/version</outputDirectory> + <resources> + <resource> + <directory>src/main/assembly/</directory> + <filtering>false</filtering> + <includes> + <include>holmes.nginx.conf</include> + </includes> + </resource> + </resources> + <overwrite>true</overwrite> + </configuration> + </execution> </executions> </plugin> <plugin> diff --git a/rulemgt-standalone/src/main/assembly/Dockerfile b/rulemgt-standalone/src/main/assembly/Dockerfile index 457f4ab..d069616 100644 --- a/rulemgt-standalone/src/main/assembly/Dockerfile +++ b/rulemgt-standalone/src/main/assembly/Dockerfile @@ -2,7 +2,7 @@ FROM ubuntu:16.04 MAINTAINER "Guangrong Fu" <fu.guangrong@zte.com.cn> -EXPOSE 9101 +EXPOSE 9101 9104 #install openjdk-1.8 #RUN sed -i 's#http://archive.ubuntu.com#http://mirrors.163.com#g' /etc/apt/sources.list @@ -16,6 +16,23 @@ ENV PATH $PATH:/usr/lib/jvm/java-8-openjdk-amd64/jre/bin:/usr/lib/jvm/java-8-ope ENV CLASSPATH .:${JAVA_HOME}/lib:${JRE_HOME}/lib ENV JRE_HOME ${JAVA_HOME}/jre +#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 + + ENV HOSTNAME holmes-rule-mgmt #add holmes related resources to the docker image diff --git a/rulemgt-standalone/src/main/assembly/bin/run.sh b/rulemgt-standalone/src/main/assembly/bin/run.sh index 8d52c04..c8bae4c 100644 --- a/rulemgt-standalone/src/main/assembly/bin/run.sh +++ b/rulemgt-standalone/src/main/assembly/bin/run.sh @@ -80,4 +80,7 @@ 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 + "$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/holmes.nginx.conf new file mode 100644 index 0000000..575b5a2 --- /dev/null +++ b/rulemgt-standalone/src/main/assembly/holmes.nginx.conf @@ -0,0 +1,43 @@ +#user nobody; +worker_processes 1; + +error_log logs/error.log; +error_log logs/error.log notice; +error_log logs/error.log info; + +pid logs/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + #access_log logs/access.log main; + + sendfile on; + + keepalive_timeout 65; + + server { + listen 9104; + server_name localhost; + + location / { + root html; + } + + location ~*.(htm|html){ + add_header Cache-Control no-cache; + root html; + } + } +} |