Browse Source

adjusted dockerfile, jenkinsfile, setting files for tomcat

xiaoct 6 years ago
parent
commit
a7d4b21eae
4 changed files with 85 additions and 3 deletions
  1. 2 0
      Dockerfile
  2. 10 3
      Jenkinsfile
  3. 26 0
      context.xml
  4. 47 0
      tomcat-users.xml

+ 2 - 0
Dockerfile

@@ -36,6 +36,8 @@ ENV JAVA_HOME=/usr/lib/jvm/java-8-oracle
 ENV JRE_HOME=/usr/lib/jvm/java-8-oracle/jre
 ADD ca.crt ./
 COPY ./additional_jars ./additional_jars
+COPY tomcat-users.xml ${CATALINA_HOME}/conf/tomcat-users.xml
+COPY context.xml ${CATALINA_HOME}/webapps/manager/META-INF/context.xml
 RUN keytool -import -trustcacerts -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit -noprompt -alias maven2.ca -file ca.crt
 RUN keytool -import -trustcacerts -keystore $JAVA_HOME/jre/lib/security/jssecacerts -storepass changeit -noprompt -alias maven2.ca -file ca.crt
 RUN mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.2.0.1.0 -Dpackaging=jar -Dfile=./additional_jars/ojdbc7.jar

+ 10 - 3
Jenkinsfile

@@ -14,9 +14,7 @@ pipeline {
         }
         stage('Maven Test and Deploy') {
             steps {
-                    sh "mvn -version"
-                    sh "mvn test"
-                    sh "mvn deploy"
+                    sh "mvn clean package"
             }
         }
         stage('SonarQube Analysis') {
@@ -24,6 +22,15 @@ pipeline {
                 sh 'sonar-scanner'
             }
         }
+        stage('Import to Webapps')
+            steps {
+                sh 'cp ./target/BI.war /apache-tomcat9/webapps'
+            }
+        stage('Start Tomcat9'){
+            steps {
+                sh '/apache-tomcat9/bin/startup.sh'
+            }
+        }
         stage('Deliver'){
             steps {
                 input message: 'Finished using the server site? (Click "Proceed" to continue)'

+ 26 - 0
context.xml

@@ -0,0 +1,26 @@
+  GNU nano 2.9.3                                                                                       ./context.xml                                                                                                  
+
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<Context antiResourceLocking="false" privileged="true" >
+  <Valve className="org.apache.catalina.valves.RemoteAddrValve"
+         allow=".*" />
+  <Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/>
+</Context>
+
+

+ 47 - 0
tomcat-users.xml

@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<tomcat-users xmlns="http://tomcat.apache.org/xml"
+              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+              xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
+              version="1.0">
+<!--
+  NOTE:  By default, no user is included in the "manager-gui" role required
+  to operate the "/manager/html" web application.  If you wish to use this app,
+  you must define such a user - the username and password are arbitrary. It is
+  strongly recommended that you do NOT use one of the users in the commented out
+  section below since they are intended for use with the examples web
+  application.
+-->
+<!--
+  NOTE:  The sample user and role entries below are intended for use with the
+  examples web application. They are wrapped in a comment and thus are ignored
+  when reading this file. If you wish to configure these users for use with the
+  examples web application, do not forget to remove the <!.. ..> that surrounds
+  them. You will also need to set the passwords to something appropriate.
+-->
+<!--
+  <role rolename="tomcat"/>
+  <role rolename="role1"/>
+  <user username="tomcat" password="<must-be-changed>" roles="tomcat"/>
+  <user username="both" password="<must-be-changed>" roles="tomcat,role1"/>
+  <user username="role1" password="<must-be-changed>" roles="role1"/>
+-->
+<role rolename="manager-gui"/>
+<role rolename="manager-script"/>
+<user username="tomcat" password="tomcat" roles="manager-gui, manger-script"/>
+</tomcat-users>