Skip to content

Commit 91ea4f5

Browse files
committed
chore:docker new cerberus-as-tomcat-4.19 version
1 parent 42b712c commit 91ea4f5

File tree

6 files changed

+320
-1
lines changed

6 files changed

+320
-1
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
FROM tomcat:9-jre11-temurin
2+
3+
ENV LOG_ROOT_PATH /usr/local/tomcat/logs/
4+
5+
ENV CATALINA_OPTS="-Dorg.cerberus.environment=prd -Dorg.cerberus.authentification=none -Xmx1024m"
6+
7+
ENV DATABASE_HOST cerberus-db-mysql
8+
ENV DATABASE_PORT 3306
9+
ENV DATABASE_NAME cerberus
10+
ENV DATABASE_USER cerberus
11+
ENV DATABASE_PASSWORD toto
12+
13+
ARG CERBERUS_NAME=cerberus-core
14+
ARG CERBERUS_VERSION=4.19
15+
ARG CERBERUS_PACKAGE_NAME=${CERBERUS_NAME}-${CERBERUS_VERSION}
16+
17+
ARG MYSQL_JAVA_CONNECTOR_VERSION=9.0.0
18+
ARG MYSQL_JAVA_CONNECTOR_NAME=mysql-connector-j-${MYSQL_JAVA_CONNECTOR_VERSION}
19+
20+
21+
RUN apt-get update -qqy \
22+
&& apt-get -qqy install \
23+
unzip dos2unix \
24+
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
25+
26+
# Download & install MySQL JDBC Drivers
27+
RUN echo "Download & install MySQL JDBC Drivers" && \
28+
wget -P /tmp/ https://downloads.mysql.com/archives/get/p/3/file/${MYSQL_JAVA_CONNECTOR_NAME}.zip && \
29+
unzip -q -d /tmp/ /tmp/${MYSQL_JAVA_CONNECTOR_NAME}.zip && \
30+
mv /tmp/${MYSQL_JAVA_CONNECTOR_NAME}/${MYSQL_JAVA_CONNECTOR_NAME}.jar /usr/local/tomcat/lib/ && \
31+
echo "Clean temp directory" && \
32+
rm /tmp/* -rf
33+
#COPY mysql-connector-java-5.1.20-bin.jar /usr/local/tomcat/lib/
34+
35+
# Only for debug purpose
36+
#RUN ls -al /usr/local/tomcat/lib/
37+
38+
# Download & install Cerberus Application
39+
RUN echo "Download & install Cerberus Application" && \
40+
wget -P /tmp/ https://github.com/cerberustesting/cerberus-source/releases/download/cerberus-testing-${CERBERUS_VERSION}/cerberus-core-${CERBERUS_VERSION}.zip && \
41+
unzip -q -d /tmp /tmp/${CERBERUS_PACKAGE_NAME}.zip && \
42+
rm -rf /usr/local/tomcat/webapps/* && \
43+
cp /tmp/${CERBERUS_PACKAGE_NAME}/${CERBERUS_PACKAGE_NAME}.war /usr/local/tomcat/webapps/ROOT.war && \
44+
echo "Clean temp directory" && \
45+
rm /tmp/* -rf
46+
#COPY Cerberus-3.12-SNAPSHOT.war /usr/local/tomcat/webapps/ROOT.war
47+
48+
# Only for debug purpose
49+
#RUN ls -al /usr/local/tomcat/webapps/
50+
51+
# Configure Tomcat for Cerberus need.
52+
COPY *.xml /usr/local/tomcat/conf/
53+
54+
# Only for debug purpose
55+
#RUN echo ${CATALINA_OPTS}
56+
57+
COPY entrypoint.sh /entrypoint.sh
58+
RUN dos2unix /entrypoint.sh && chmod u+x /entrypoint.sh
59+
ENTRYPOINT ["/entrypoint.sh"]
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Licensed to the Apache Software Foundation (ASF) under one or more
4+
contributor license agreements. See the NOTICE file distributed with
5+
this work for additional information regarding copyright ownership.
6+
The ASF licenses this file to You under the Apache License, Version 2.0
7+
(the "License"); you may not use this file except in compliance with
8+
the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
-->
18+
<!-- The contents of this file will be loaded for each web application -->
19+
<Context path="/Cerberus">
20+
21+
<!-- Default set of monitored resources. If one of these changes, the -->
22+
<!-- web application will be reloaded. -->
23+
<WatchedResource>WEB-INF/web.xml</WatchedResource>
24+
<WatchedResource>WEB-INF/tomcat-web.xml</WatchedResource>
25+
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
26+
27+
28+
<!-- <Valve className="org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve"/> -->
29+
30+
<ResourceLink name="jdbc/cerberusprd"
31+
global="jdbc/cerberusprd"
32+
type="javax.sql.DataSource"/>
33+
34+
<!-- Uncomment this to disable session persistence across Tomcat restarts -->
35+
<!--
36+
<Manager pathname="" />
37+
-->
38+
</Context>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
# Cerberus Copyright (C) 2016 Cerberus Testing
3+
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
#
5+
# This file is part of Cerberus.
6+
#
7+
# Cerberus is free software: you can redistribute it and/or modify
8+
# it under the terms of the GNU General Public License as published by
9+
# the Free Software Foundation, either version 3 of the License, or
10+
# (at your option) any later version.
11+
#
12+
# Cerberus is distributed in the hope that it will be useful,
13+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# GNU General Public License for more details.
16+
#
17+
# You should have received a copy of the GNU General Public License
18+
# along with Cerberus. If not, see <http://www.gnu.org/licenses/>.
19+
20+
# Cerberus Glassfish configuration
21+
22+
23+
# test add realm
24+
25+
26+
# export CATALINA_OPTS="$CATALINA_OPTS -DDATABASE_HOST=$DATABASE_HOST -DDATABASE_PORT=$DATABASE_PORT -DDATABASE_NAME=$DATABASE_NAME -DDATABASE_USER=$DATABASE_USER -DDATABASE_PASSWORD=$DATABASE_PASSWORD"
27+
28+
export CATALINA_OPTS="$CATALINA_OPTS -DDATABASE_HOST=$DATABASE_HOST -DDATABASE_PORT=$DATABASE_PORT -DDATABASE_NAME=$DATABASE_NAME -DDATABASE_USER=$DATABASE_USER -DDATABASE_PASSWORD=$DATABASE_PASSWORD"
29+
30+
/usr/local/tomcat/bin/catalina.sh start
31+
32+
tail -F /usr/local/tomcat/logs/catalina.out
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Licensed to the Apache Software Foundation (ASF) under one or more
4+
contributor license agreements. See the NOTICE file distributed with
5+
this work for additional information regarding copyright ownership.
6+
The ASF licenses this file to You under the Apache License, Version 2.0
7+
(the "License"); you may not use this file except in compliance with
8+
the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
-->
18+
<!-- Note: A "Server" is not itself a "Container", so you may not
19+
define subcomponents such as "Valves" at this level.
20+
Documentation at /docs/config/server.html
21+
-->
22+
<Server port="8005" shutdown="SHUTDOWN">
23+
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
24+
<!-- Security listener. Documentation at /docs/config/listeners.html
25+
<Listener className="org.apache.catalina.security.SecurityListener" />
26+
-->
27+
<!--APR library loader. Documentation at /docs/apr.html -->
28+
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
29+
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
30+
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
31+
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
32+
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
33+
34+
<!-- Global JNDI resources
35+
Documentation at /docs/jndi-resources-howto.html
36+
-->
37+
<GlobalNamingResources>
38+
39+
<Resource name="UserDatabase" auth="Container"
40+
type="org.apache.catalina.UserDatabase"
41+
description="User database that can be updated and saved"
42+
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
43+
pathname="conf/tomcat-users.xml" />
44+
45+
<Resource name="jdbc/cerberusprd"
46+
global="jdbc/cerberusprd"
47+
auth="Container"
48+
type="javax.sql.DataSource"
49+
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
50+
maxTotal="100"
51+
maxIdle="30"
52+
maxWaitMillis="10000"
53+
validationQuery="select 1"
54+
validationInterval="30000"
55+
testOnBorrow="true"
56+
testWhileIdle="true"
57+
username="${DATABASE_USER}"
58+
password="${DATABASE_PASSWORD}"
59+
driverClassName="com.mysql.cj.jdbc.Driver"
60+
url="jdbc:mysql://${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME}"/>
61+
62+
63+
</GlobalNamingResources>
64+
65+
<!-- A "Service" is a collection of one or more "Connectors" that share
66+
a single "Container" Note: A "Service" is not itself a "Container",
67+
so you may not define subcomponents such as "Valves" at this level.
68+
Documentation at /docs/config/service.html
69+
-->
70+
<Service name="Catalina">
71+
72+
<!--The connectors can use a shared executor, you can define one or more named thread pools-->
73+
<!--
74+
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
75+
maxThreads="150" minSpareThreads="4"/>
76+
-->
77+
78+
79+
<!-- A "Connector" represents an endpoint by which requests are received
80+
and responses are returned. Documentation at :
81+
Java HTTP Connector: /docs/config/http.html
82+
Java AJP Connector: /docs/config/ajp.html
83+
APR (HTTP/AJP) Connector: /docs/apr.html
84+
Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
85+
-->
86+
<Connector port="8080" protocol="HTTP/1.1"
87+
connectionTimeout="20000"
88+
redirectPort="8443" maxSavePostSize ="2097152"/>
89+
<!-- A "Connector" using the shared thread pool-->
90+
<!--
91+
<Connector executor="tomcatThreadPool"
92+
port="8080" protocol="HTTP/1.1"
93+
connectionTimeout="20000"
94+
redirectPort="8443" />
95+
-->
96+
<!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
97+
This connector uses the NIO implementation. The default
98+
SSLImplementation will depend on the presence of the APR/native
99+
library and the useOpenSSL attribute of the
100+
AprLifecycleListener.
101+
Either JSSE or OpenSSL style configuration may be used regardless of
102+
the SSLImplementation selected. JSSE style configuration is used below.
103+
-->
104+
<!--
105+
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
106+
maxThreads="150" SSLEnabled="true">
107+
<SSLHostConfig>
108+
<Certificate certificateKeystoreFile="conf/localhost-rsa.jks"
109+
type="RSA" />
110+
</SSLHostConfig>
111+
</Connector>
112+
-->
113+
<!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443 with HTTP/2
114+
This connector uses the APR/native implementation which always uses
115+
OpenSSL for TLS.
116+
Either JSSE or OpenSSL style configuration may be used. OpenSSL style
117+
configuration is used below.
118+
-->
119+
<!--
120+
<Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
121+
maxThreads="150" SSLEnabled="true" >
122+
<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
123+
<SSLHostConfig>
124+
<Certificate certificateKeyFile="conf/localhost-rsa-key.pem"
125+
certificateFile="conf/localhost-rsa-cert.pem"
126+
certificateChainFile="conf/localhost-rsa-chain.pem"
127+
type="RSA" />
128+
</SSLHostConfig>
129+
</Connector>
130+
-->
131+
132+
<!-- Define an AJP 1.3 Connector on port 8009 -->
133+
<!--
134+
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
135+
-->
136+
137+
<!-- An Engine represents the entry point (within Catalina) that processes
138+
every request. The Engine implementation for Tomcat stand alone
139+
analyzes the HTTP headers included with the request, and passes them
140+
on to the appropriate Host (virtual host).
141+
Documentation at /docs/config/engine.html -->
142+
143+
<!-- You should set jvmRoute to support load-balancing via AJP ie :
144+
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
145+
-->
146+
<Engine name="Catalina" defaultHost="localhost">
147+
148+
<!--For clustering, please take a look at documentation at:
149+
/docs/cluster-howto.html (simple how to)
150+
/docs/config/cluster.html (reference documentation) -->
151+
<!--
152+
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
153+
-->
154+
155+
<!-- Use the LockOutRealm to prevent attempts to guess user passwords
156+
via a brute-force attack -->
157+
158+
<Realm className="org.apache.catalina.realm.JDBCRealm"
159+
driverName="com.mysql.cj.jdbc.Driver"
160+
connectionURL="jdbc:mysql://${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME}?user=${DATABASE_USER}&amp;password=${DATABASE_PASSWORD}"
161+
userTable="user"
162+
userNameCol="Login"
163+
userCredCol="Password"
164+
userRoleTable="userrole"
165+
roleNameCol="Role">
166+
<CredentialHandler className="org.apache.catalina.realm.MessageDigestCredentialHandler" algorithm="SHA-1" />
167+
</Realm>
168+
169+
170+
<Host name="localhost" appBase="webapps"
171+
unpackWARs="true" autoDeploy="true">
172+
173+
<!-- SingleSignOn valve, share authentication between web applications
174+
Documentation at: /docs/config/valve.html -->
175+
<!--
176+
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
177+
-->
178+
179+
<!-- Access log processes all example.
180+
Documentation at: /docs/config/valve.html
181+
Note: The pattern used is equivalent to using pattern="common" -->
182+
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
183+
prefix="localhost_access_log" suffix=".txt"
184+
pattern="%h %l %u %t &quot;%r&quot; %s %b" />
185+
186+
</Host>
187+
</Engine>
188+
</Service>
189+
</Server>

docker/images/cerberus-as-tomcat/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Hereafter list of available tags:
1111
Tag | Description | Source
1212
--------|------------------------------------|-------------------------------
1313
latest | Use the latest Cerberus version | [latest/Dockerfile](https://github.com/cerberustesting/cerberus-source/blob/master/docker/images/cerberus-as-tomcat/latest/Dockerfile)
14+
4.19 | Use the 4.19 Cerberus version | [4.19/Dockerfile](https://github.com/cerberustesting/cerberus-source/blob/master/docker/images/cerberus-as-tomcat/4.19/Dockerfile)
1415
4.18 | Use the 4.18 Cerberus version | [4.18/Dockerfile](https://github.com/cerberustesting/cerberus-source/blob/master/docker/images/cerberus-as-tomcat/4.18/Dockerfile)
1516
4.17 | Use the 4.17 Cerberus version | [4.17/Dockerfile](https://github.com/cerberustesting/cerberus-source/blob/master/docker/images/cerberus-as-tomcat/4.17/Dockerfile)
1617
4.16 | Use the 4.16 Cerberus version | [4.16/Dockerfile](https://github.com/cerberustesting/cerberus-source/blob/master/docker/images/cerberus-as-tomcat/4.16/Dockerfile)

docker/images/cerberus-as-tomcat/latest/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ENV DATABASE_USER cerberus
1111
ENV DATABASE_PASSWORD toto
1212

1313
ARG CERBERUS_NAME=cerberus-core
14-
ARG CERBERUS_VERSION=4.18
14+
ARG CERBERUS_VERSION=4.19
1515
ARG CERBERUS_PACKAGE_NAME=${CERBERUS_NAME}-${CERBERUS_VERSION}
1616

1717
ARG MYSQL_JAVA_CONNECTOR_VERSION=9.0.0

0 commit comments

Comments
 (0)