Skip to content

Commit

Permalink
test: update for Arch Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
myii committed Feb 18, 2021
1 parent ac90357 commit 20d4499
Show file tree
Hide file tree
Showing 5 changed files with 206 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test/integration/default/controls/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# Default values for `control 'Tomcat Catalina temp dir'`
catalina_tmpdir = '/var/cache/tomcat/temp'
catalina_tmpdir_user_and_group = 'tomcat'
catalina_tmpdir_mode = '0755'
# Default values for `control 'Tomcat `server.xml` config'`
conf_dir = '/etc/tomcat'
server_xml_user_and_group = 'tomcat'
Expand Down Expand Up @@ -58,7 +59,13 @@
end
when 'linux'
case platform_finger
when 'arch-5'
when 'arch-base-latest'
main_config_file = '/usr/lib/systemd/system/tomcat8.service'
catalina_tmpdir = '/var/tmp/tomcat8/temp'
catalina_tmpdir_user_and_group = 'tomcat8'
catalina_tmpdir_mode = '0775'
conf_dir = '/etc/tomcat8'
server_xml_user_and_group = 'tomcat8'
end
end

Expand All @@ -85,7 +92,7 @@
it { should be_directory }
it { should be_owned_by catalina_tmpdir_user_and_group }
it { should be_grouped_into catalina_tmpdir_user_and_group }
its('mode') { should cmp '0755' }
its('mode') { should cmp catalina_tmpdir_mode }
end
end

Expand Down
5 changes: 5 additions & 0 deletions test/integration/default/controls/packages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
end
when 'redhat', 'fedora', 'suse'
%w[tomcat]
when 'linux'
case platform_finger
when 'arch-base-latest'
%w[tomcat8]
end
end

packages.each do |p|
Expand Down
5 changes: 5 additions & 0 deletions test/integration/default/controls/services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
end
when 'redhat', 'fedora', 'suse'
%w[tomcat]
when 'linux'
case platform_finger
when 'arch-base-latest'
%w[tomcat8]
end
end

services.each do |s|
Expand Down
39 changes: 39 additions & 0 deletions test/integration/default/files/main_config/arch-base-latest
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This file is managed by salt. Manual changes risk being overwritten.
# Modify the values passed to the tomcat pillar instead.

[Unit]
Description=Tomcat 8 servlet container
After=network.target

[Service]
Type=forking
PIDFile=/var/run/tomcat8.pid
Environment=CATALINA_PID=/var/run/tomcat8.pid
Environment=TOMCAT_JAVA_HOME=/usr/lib/jvm/default-runtime
Environment=CATALINA_HOME=/usr/share/tomcat8
Environment=CATALINA_BASE=/usr/share/tomcat8
Environment="CATALINA_OPTS=-Djava.awt.headless=true -Xmx128m -XX:MaxPermSize=256m -Dlog4j.configuration=file:/tmp/log4j.properties -Dlogback.configurationFile=/tmp/logback.xml"
Environment=ERRFILE=SYSLOG
Environment=OUTFILE=SYSLOG

ExecStart=/usr/bin/jsvc \
-Dcatalina.home=${CATALINA_HOME} \
-Dcatalina.base=${CATALINA_BASE} \
-Djava.io.tmpdir=/var/tmp/tomcat8/temp \
-cp /usr/share/java/commons-daemon.jar:/usr/share/java/eclipse-ecj.jar:${CATALINA_HOME}/bin/bootstrap.jar:${CATALINA_HOME}/bin/tomcat-juli.jar \
-user tomcat8 \
-java-home ${TOMCAT_JAVA_HOME} \
-pidfile /var/run/tomcat8.pid \
-errfile ${ERRFILE} \
-outfile ${OUTFILE} \
${CATALINA_OPTS} \
org.apache.catalina.startup.Bootstrap

ExecStop=/usr/bin/jsvc \
-pidfile /var/run/tomcat8.pid \
-stop \
org.apache.catalina.startup.Bootstrap

[Install]
WantedBy=multi-user.target

148 changes: 148 additions & 0 deletions test/integration/default/files/server_xml/arch-base-latest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
<?xml version='1.0' encoding='utf-8'?>
<!--
This file is managed/autogenerated by salt.
Manual changes risk being overwritten.
Modify the salt pillar for the tomcat formula
that generates this file instead.
-->
<!--
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.
-->
<!-- Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" at this level.
Documentation at /docs/config/server.html
-->
<Server port="8005" shutdown="SHUTDOWN">
<!-- Security listener. Documentation at /docs/config/listeners.html
<Listener className="org.apache.catalina.security.SecurityListener" />
-->

<!--APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />




<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

<!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->
<GlobalNamingResources>


<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>

<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" Note: A "Service" is not itself a "Container",
so you may not define subcomponents such as "Valves" at this level.
Documentation at /docs/config/service.html
-->
<Service name="Catalina">
<Connector

port="8443"
protocol="org.apache.coyote.http11.Http11Protocol"
connectionTimeout="20000"
URIEncoding="UTF-8"
redirectPort="8443"
maxHttpHeaderSize="8192"
maxThreads="150"
minSpareThreads="25"
enableLookups="false"
disableUploadTimeout="true"
acceptCount="100"
scheme="https"
secure="true"
clientAuth="false"
sslProtocol="TLS"
SSLEnabled="false"
keystoreFile="/path/to/keystoreFile"
keystorePass="somerandomtext"
/>


<Engine name="Catalina" defaultHost="localhost">

<!-- Use the LockOutRealm to prevent attempts to guess user passwords
via a brute-force attack -->
<Realm className="org.apache.catalina.realm.LockOutRealm">
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>



<Host name="tomcat-server"
unpackWARs="true"
autoDeploy="true"
deployXML="false">
<Context path=""
docBase="../webapps/myapp"
debug="0"
reloadable="true"
/>

<Alias>www.example.com</Alias>

</Host>

<Host name="example.net"
unpackWARs="true"
autoDeploy="true">
<Context path=""
docBase="../webapps/myapp2"
debug="0"
reloadable="true"
/>

<Alias>www.example.net</Alias>

<Valve
className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
prefix="localhost_access_log."
fileDateFormat="yyyy-MM-dd-HH"
suffix=".log"
pattern="%h %l %u %t &quot;%m http://%v%U %H&quot; %s %b &quot;%{Referer}i&quot; &quot;%{User-Agent}i&quot; %D" />
<Valve
className="org.apache.catalina.authenticator.SingleSignOn" />

</Host>


</Engine>
</Service>
</Server>

0 comments on commit 20d4499

Please sign in to comment.