This is an automated email from the ASF dual-hosted git repository. danhaywood pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/isis.git
commit b6c4c59cf78ee380ae0e2da3365958e1f7474e8e Author: danhaywood <d...@haywood-associates.co.uk> AuthorDate: Sun Jul 22 10:46:50 2018 +0100 ISIS-1969: adds webdocker module to create a Docker image containing the Isis JARs as a Tomcat shared lib. --- core/pom.xml | 3 +- core/webdocker/pom.xml | 267 +++++++++++++++++++++ core/webdocker/src/main/assembly/assembly.xml | 17 ++ .../conf/Catalina/localhost/host-manager.xml | 4 + .../conf/Catalina/localhost/manager.xml | 4 + .../catalina_home/conf/catalina.properties | 148 ++++++++++++ .../resources/catalina_home/conf/tomcat-users.xml | 50 ++++ .../webdocker/src/main/resources/docker/Dockerfile | 20 ++ 8 files changed, 512 insertions(+), 1 deletion(-) diff --git a/core/pom.xml b/core/pom.xml index 9dd1c05..e8ba185 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -2530,7 +2530,8 @@ ${license.additional-notes} <!-- to break cyclic dependencies some tests needed to be moved to their own modules --> <module>unittestsupport-test</module> - + + <module>webdocker</module> </modules> </project> diff --git a/core/webdocker/pom.xml b/core/webdocker/pom.xml new file mode 100644 index 0000000..3a93733 --- /dev/null +++ b/core/webdocker/pom.xml @@ -0,0 +1,267 @@ +<?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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.isis.core</groupId> + <artifactId>isis</artifactId> + <version>${revision}</version> + </parent> + + <groupId>org.apache.isis.core</groupId> + <artifactId>isis-webdocker</artifactId> + <name>Apache Isis WebDocker</name> + + <description>Assembles all of the </description> + + <packaging>jar</packaging> + + <properties> + <isis-maven-plugin.appManifest> + domainapp.application.manifest.DomainAppAppManifest + </isis-maven-plugin.appManifest> + + <jetty-console-maven-plugin.backgroundImage> + ${basedir}/src/main/jettyconsole/isis-banner.png + </jetty-console-maven-plugin.backgroundImage> + + <assembly-plugin.finalName>core-${revision}</assembly-plugin.finalName> + + <docker-plugin.imageName>apacheisis/core</docker-plugin.imageName> + <docker-plugin.imageTag>${project.version}</docker-plugin.imageTag> + <docker-plugin.resource.zip>${assembly-plugin.finalName}.zip</docker-plugin.resource.zip> + <docker-plugin.resource.tomcat-users.xml>classes/catalina_home/conf/tomcat-users.xml</docker-plugin.resource.tomcat-users.xml> + <docker-plugin.resource.catalina.properties>classes/catalina_home/conf/catalina.properties</docker-plugin.resource.catalina.properties> + <docker-plugin.resource.manager.xml>classes/catalina_home/conf/Catalina/localhost/manager.xml</docker-plugin.resource.manager.xml> + <docker-plugin.resource.host-manager.xml>classes/catalina_home/conf/Catalina/localhost/host-manager.xml</docker-plugin.resource.host-manager.xml> + + <docker-plugin.serverId>docker-hub</docker-plugin.serverId> + <docker-plugin.registryUrl>https://index.docker.io/v1/</docker-plugin.registryUrl> + + <maven-deploy-plugin.version>2.8.1</maven-deploy-plugin.version> + <docker-maven-plugin.version>1.0.0</docker-maven-plugin.version> + + </properties> + + <build> + <resources> + <resource> + <filtering>true</filtering> + <directory>src/main/resources</directory> + <includes> + <include>**</include> + </includes> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <phase>package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <outputDirectory>${project.build.directory}/dependencies/lib</outputDirectory> + <includeScope>compile</includeScope> + <excludeTypes>pom</excludeTypes> + <overWriteReleases>true</overWriteReleases> + <overWriteSnapshots>true</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <version>2.2.1</version> + <executions> + <execution> + <id>assemble-dependencies</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + <configuration> + <descriptors> + <descriptor>src/main/assembly/assembly.xml</descriptor> + </descriptors> + <finalName>${assembly-plugin.finalName}</finalName> + <appendAssemblyId>false</appendAssemblyId> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.apache.isis.mavendeps</groupId> + <artifactId>isis-mavendeps-webapp</artifactId> + <type>pom</type> + </dependency> + + <dependency> + <groupId>org.apache.isis.core</groupId> + <artifactId>isis-core-applib</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.isis.core</groupId> + <artifactId>isis-core-plugins-codegen-bytebuddy</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.isis.core</groupId> + <artifactId>isis-core-plugins-discovery-reflections</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.isis.core</groupId> + <artifactId>isis-core-plugins-jdo-datanucleus-5</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.isis.core</groupId> + <artifactId>isis-core-plugins-eventbus-axon</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.isis.core</groupId> + <artifactId>isis-core-plugins-jaxrs-resteasy-3</artifactId> + </dependency> + + </dependencies> + + <profiles> + <profile> + <id>jdbc-hsqldb</id> + <activation> + <property> + <name>!skip.jdbc-hsqldb</name> + </property> + </activation> + <dependencies> + <dependency> + <groupId>org.hsqldb</groupId> + <artifactId>hsqldb</artifactId> + </dependency> + </dependencies> + </profile> + + <profile> + <id>mavenmixin-docker-install</id> + <activation> + <property> +<!-- + <name>-Dskip.package-docker</name> +--> + <name>package-docker</name> + </property> + </activation> + + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-deploy-plugin</artifactId> + <version>${maven-deploy-plugin.version}</version> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + <plugin> + <groupId>com.spotify</groupId> + <artifactId>docker-maven-plugin</artifactId> + <version>${docker-maven-plugin.version}</version> + <executions> + <execution> + <id>build-image</id> + <phase>package</phase> + <goals> + <goal>build</goal> + </goals> + <configuration> + <imageName>${docker-plugin.imageName}</imageName> + </configuration> + </execution> + <execution> + <id>tag-image</id> + <phase>install</phase> + <goals> + <goal>tag</goal> + </goals> + <configuration> + <image>${docker-plugin.imageName}</image> + <newName>${docker-plugin.imageName}:${docker-plugin.imageTag}</newName> + </configuration> + </execution> + <execution> + <id>push-image-tagged</id> + <phase>deploy</phase> + <goals> + <goal>push</goal> + </goals> + <configuration> + <imageName>${docker-plugin.imageName}:${docker-plugin.imageTag}</imageName> + </configuration> + </execution> + <execution> + <id>push-image-latest</id> + <phase>deploy</phase> + <goals> + <goal>push</goal> + </goals> + <configuration> + <imageName>${docker-plugin.imageName}:latest</imageName> + </configuration> + </execution> + </executions> + <configuration> + <dockerDirectory>${project.build.outputDirectory}/docker</dockerDirectory> + <resources> + <resource> + <targetPath>.</targetPath> + <directory>${project.build.directory}</directory> + <include>${docker-plugin.resource.zip}</include> + <include>${docker-plugin.resource.tomcat-users.xml}</include> + <include>${docker-plugin.resource.catalina.properties}</include> + <include>${docker-plugin.resource.manager.xml}</include> + <include>${docker-plugin.resource.host-manager.xml}</include> + </resource> + </resources> + <serverId>${docker-plugin.serverId}</serverId> + <registryUrl>${docker-plugin.registryUrl}</registryUrl> + </configuration> + </plugin> + </plugins> + </build> + </profile> + + </profiles> + +</project> diff --git a/core/webdocker/src/main/assembly/assembly.xml b/core/webdocker/src/main/assembly/assembly.xml new file mode 100644 index 0000000..8afdfe6 --- /dev/null +++ b/core/webdocker/src/main/assembly/assembly.xml @@ -0,0 +1,17 @@ +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>bin</id> + <includeBaseDirectory>false</includeBaseDirectory> + <formats> + <format>zip</format> + </formats> + <fileSets> + <fileSet> + <directory>${project.build.directory}/dependencies/lib</directory> + <outputDirectory>lib</outputDirectory> + <includes> + <include>*.jar</include> + </includes> + </fileSet> + </fileSets> +</assembly> \ No newline at end of file diff --git a/core/webdocker/src/main/resources/catalina_home/conf/Catalina/localhost/host-manager.xml b/core/webdocker/src/main/resources/catalina_home/conf/Catalina/localhost/host-manager.xml new file mode 100644 index 0000000..bdb7b8e --- /dev/null +++ b/core/webdocker/src/main/resources/catalina_home/conf/Catalina/localhost/host-manager.xml @@ -0,0 +1,4 @@ +<Context privileged="true" antiResourceLocking="false" + docBase="${catalina.home}/webapps/host-manager"> + <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="^.*$" /> +</Context> \ No newline at end of file diff --git a/core/webdocker/src/main/resources/catalina_home/conf/Catalina/localhost/manager.xml b/core/webdocker/src/main/resources/catalina_home/conf/Catalina/localhost/manager.xml new file mode 100644 index 0000000..73b8e13 --- /dev/null +++ b/core/webdocker/src/main/resources/catalina_home/conf/Catalina/localhost/manager.xml @@ -0,0 +1,4 @@ +<Context privileged="true" antiResourceLocking="false" + docBase="${catalina.home}/webapps/manager"> + <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="^.*$" /> +</Context> \ No newline at end of file diff --git a/core/webdocker/src/main/resources/catalina_home/conf/catalina.properties b/core/webdocker/src/main/resources/catalina_home/conf/catalina.properties new file mode 100644 index 0000000..232a65a --- /dev/null +++ b/core/webdocker/src/main/resources/catalina_home/conf/catalina.properties @@ -0,0 +1,148 @@ +# 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. + +# +# List of comma-separated packages that start with or equal this string +# will cause a security exception to be thrown when +# passed to checkPackageAccess unless the +# corresponding RuntimePermission ("accessClassInPackage."+package) has +# been granted. +package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.jasper.,org.apache.tomcat. +# +# List of comma-separated packages that start with or equal this string +# will cause a security exception to be thrown when +# passed to checkPackageDefinition unless the +# corresponding RuntimePermission ("defineClassInPackage."+package) has +# been granted. +# +# by default, no packages are restricted for definition, and none of +# the class loaders supplied with the JDK call checkPackageDefinition. +# +package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,\ +org.apache.jasper.,org.apache.naming.,org.apache.tomcat. + +# +# +# List of comma-separated paths defining the contents of the "common" +# classloader. Prefixes should be used to define what is the repository type. +# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute. +# If left as blank,the JVM system loader will be used as Catalina's "common" +# loader. +# Examples: +# "foo": Add this folder as a class repository +# "foo/*.jar": Add all the JARs of the specified folder as class +# repositories +# "foo/bar.jar": Add bar.jar as a class repository +# +# Note: Values are enclosed in double quotes ("...") in case either the +# ${catalina.base} path or the ${catalina.home} path contains a comma. +# Because double quotes are used for quoting, the double quote character +# may not appear in a path. +common.loader="${catalina.base}/lib","${catalina.base}/lib/*.jar","${catalina.home}/lib","${catalina.home}/lib/*.jar" + +# +# List of comma-separated paths defining the contents of the "server" +# classloader. Prefixes should be used to define what is the repository type. +# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute. +# If left as blank, the "common" loader will be used as Catalina's "server" +# loader. +# Examples: +# "foo": Add this folder as a class repository +# "foo/*.jar": Add all the JARs of the specified folder as class +# repositories +# "foo/bar.jar": Add bar.jar as a class repository +# +# Note: Values may be enclosed in double quotes ("...") in case either the +# ${catalina.base} path or the ${catalina.home} path contains a comma. +# Because double quotes are used for quoting, the double quote character +# may not appear in a path. +server.loader= + +# +# List of comma-separated paths defining the contents of the "shared" +# classloader. Prefixes should be used to define what is the repository type. +# Path may be relative to the CATALINA_BASE path or absolute. If left as blank, +# the "common" loader will be used as Catalina's "shared" loader. +# Examples: +# "foo": Add this folder as a class repository +# "foo/*.jar": Add all the JARs of the specified folder as class +# repositories +# "foo/bar.jar": Add bar.jar as a class repository +# Please note that for single jars, e.g. bar.jar, you need the URL form +# starting with file:. +# +# Note: Values may be enclosed in double quotes ("...") in case either the +# ${catalina.base} path or the ${catalina.home} path contains a comma. +# Because double quotes are used for quoting, the double quote character +# may not appear in a path. +shared.loader="${catalina.base}/isis/lib","${catalina.base}/isis/lib/*.jar" + +# Default list of JAR files that should not be scanned using the JarScanner +# functionality. This is typically used to scan JARs for configuration +# information. JARs that do not contain such information may be excluded from +# the scan to speed up the scanning process. This is the default list. JARs on +# this list are excluded from all scans. The list must be a comma separated list +# of JAR file names. +# The list of JARs to skip may be over-ridden at a Context level for individual +# scan types by configuring a JarScanner with a nested JarScanFilter. +# The JARs listed below include: +# - Tomcat Bootstrap JARs +# - Tomcat API JARs +# - Catalina JARs +# - Jasper JARs +# - Tomcat JARs +# - Common non-Tomcat JARs +# - Test JARs (JUnit, Cobertura and dependencies) +tomcat.util.scan.StandardJarScanFilter.jarsToSkip=\ +bootstrap.jar,commons-daemon.jar,tomcat-juli.jar,\ +annotations-api.jar,el-api.jar,jsp-api.jar,servlet-api.jar,websocket-api.jar,\ +jaspic-api.jar,\ +catalina.jar,catalina-ant.jar,catalina-ha.jar,catalina-storeconfig.jar,\ +catalina-tribes.jar,\ +jasper.jar,jasper-el.jar,ecj-*.jar,\ +tomcat-api.jar,tomcat-util.jar,tomcat-util-scan.jar,tomcat-coyote.jar,\ +tomcat-dbcp.jar,tomcat-jni.jar,tomcat-websocket.jar,\ +tomcat-i18n-en.jar,tomcat-i18n-es.jar,tomcat-i18n-fr.jar,tomcat-i18n-ja.jar,\ +tomcat-juli-adapters.jar,catalina-jmx-remote.jar,catalina-ws.jar,\ +tomcat-jdbc.jar,\ +tools.jar,\ +commons-beanutils*.jar,commons-codec*.jar,commons-collections*.jar,\ +commons-dbcp*.jar,commons-digester*.jar,commons-fileupload*.jar,\ +commons-httpclient*.jar,commons-io*.jar,commons-lang*.jar,commons-logging*.jar,\ +commons-math*.jar,commons-pool*.jar,\ +jstl.jar,taglibs-standard-spec-*.jar,\ +geronimo-spec-jaxrpc*.jar,wsdl4j*.jar,\ +ant.jar,ant-junit*.jar,aspectj*.jar,jmx.jar,h2*.jar,hibernate*.jar,httpclient*.jar,\ +jmx-tools.jar,jta*.jar,log4j*.jar,mail*.jar,slf4j*.jar,\ +xercesImpl.jar,xmlParserAPIs.jar,xml-apis.jar,\ +junit.jar,junit-*.jar,hamcrest-*.jar,easymock-*.jar,cglib-*.jar,\ +objenesis-*.jar,ant-launcher.jar,\ +cobertura-*.jar,asm-*.jar,dom4j-*.jar,icu4j-*.jar,jaxen-*.jar,jdom-*.jar,\ +jetty-*.jar,oro-*.jar,servlet-api-*.jar,tagsoup-*.jar,xmlParserAPIs-*.jar,\ +xom-*.jar + +# Default list of JAR files that should be scanned that overrides the default +# jarsToSkip list above. This is typically used to include a specific JAR that +# has been excluded by a broad file name pattern in the jarsToSkip list. +# The list of JARs to scan may be over-ridden at a Context level for individual +# scan types by configuring a JarScanner with a nested JarScanFilter. +tomcat.util.scan.StandardJarScanFilter.jarsToScan=\ +log4j-web*.jar,log4j-taglib*.jar,log4javascript*.jar,slf4j-taglib*.jar + +# String cache configuration. +tomcat.util.buf.StringCache.byte.enabled=true +#tomcat.util.buf.StringCache.char.enabled=true +#tomcat.util.buf.StringCache.trainThreshold=500000 +#tomcat.util.buf.StringCache.cacheSize=5000 diff --git a/core/webdocker/src/main/resources/catalina_home/conf/tomcat-users.xml b/core/webdocker/src/main/resources/catalina_home/conf/tomcat-users.xml new file mode 100644 index 0000000..be7599f --- /dev/null +++ b/core/webdocker/src/main/resources/catalina_home/conf/tomcat-users.xml @@ -0,0 +1,50 @@ +<?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="admin-gui"/> + <role rolename="admin-script"/> + <role rolename="manager-gui"/> + <role rolename="manager-script"/> + <user username="admin" password="password" roles="manager-gui,manager-script,admin-gui,admin-script"/> + + <!-- + <role rolename="role1"/> + <user username="both" password="<must-be-changed>" roles="tomcat,role1"/> + <user username="role1" password="<must-be-changed>" roles="role1"/> + --> + +</tomcat-users> diff --git a/core/webdocker/src/main/resources/docker/Dockerfile b/core/webdocker/src/main/resources/docker/Dockerfile new file mode 100644 index 0000000..0f5aee6 --- /dev/null +++ b/core/webdocker/src/main/resources/docker/Dockerfile @@ -0,0 +1,20 @@ +FROM tomcat:9.0.10-jre8-alpine + +RUN rm -rf ${CATALINA_HOME}/webapps/examples +RUN rm -rf ${CATALINA_HOME}/webapps/docs +RUN rm -rf ${CATALINA_HOME}/webapps/ROOT + +RUN mkdir -p ${CATALINA_HOME}/conf/Catalina/localhost + +COPY ${docker-plugin.resource.tomcat-users.xml} ${CATALINA_HOME}/conf/. +COPY ${docker-plugin.resource.catalina.properties} ${CATALINA_HOME}/conf/. +# RUN sed -i 's|shared.loader=$|shared.loader="${catalina.base}/isis/lib","${catalina.base}/isis/lib/*.jar"|g' ${CATALINA_HOME}/conf/catalina.properties + +COPY ${docker-plugin.resource.manager.xml} ${CATALINA_HOME}/conf/Catalina/localhost/. +COPY ${docker-plugin.resource.host-manager.xml} ${CATALINA_HOME}/conf/Catalina/localhost/. + +RUN mkdir -p ${CATALINA_HOME}/isis/lib +COPY ${docker-plugin.resource.zip} ${CATALINA_HOME}/isis/${assembly-plugin.finalName}.zip +RUN unzip ${CATALINA_HOME}/isis/${assembly-plugin.finalName}.zip -d ${CATALINA_HOME}/isis/. + +EXPOSE 8080 \ No newline at end of file