mirror of
https://github.com/paradizelost/docker.git
synced 2024-11-28 20:33:59 -06:00
Adding openkm data
This commit is contained in:
parent
250a4011c4
commit
6b1b9e46a5
7
openkm/data/OpenKM.cfg
Normal file
7
openkm/data/OpenKM.cfg
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#OpenKM Hibernate configuration values
|
||||||
|
hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
|
||||||
|
hibernate.hbm2ddl=create
|
||||||
|
|
||||||
|
# Logback configuration file
|
||||||
|
# logback.config=logback.xml
|
||||||
|
|
61
openkm/data/OpenKM.xml
Normal file
61
openkm/data/OpenKM.xml
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans"
|
||||||
|
xmlns:security="http://www.springframework.org/schema/security"
|
||||||
|
xmlns:task="http://www.springframework.org/schema/task"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||||
|
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
|
http://www.springframework.org/schema/security
|
||||||
|
http://www.springframework.org/schema/security/spring-security.xsd
|
||||||
|
http://www.springframework.org/schema/task
|
||||||
|
http://www.springframework.org/schema/task/spring-task.xsd">
|
||||||
|
|
||||||
|
<security:authentication-manager alias="authenticationManager">
|
||||||
|
<security:authentication-provider ref="ldapAuthProvider" />
|
||||||
|
</security:authentication-manager>
|
||||||
|
|
||||||
|
<beans:bean id="contextSource" class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">
|
||||||
|
<beans:constructor-arg value="ldap://10.0.0.15:389"/>
|
||||||
|
<beans:property name="userDn" value="AUTHUSERDN"/>
|
||||||
|
<beans:property name="password" value="PASSWORD"/>
|
||||||
|
<beans:property name="baseEnvironmentProperties">
|
||||||
|
<beans:map>
|
||||||
|
<beans:entry>
|
||||||
|
<beans:key>
|
||||||
|
<beans:value>java.naming.referral</beans:value>
|
||||||
|
</beans:key>
|
||||||
|
<beans:value>follow</beans:value>
|
||||||
|
</beans:entry>
|
||||||
|
</beans:map>
|
||||||
|
</beans:property>
|
||||||
|
</beans:bean>
|
||||||
|
|
||||||
|
<beans:bean id="ldapAuthProvider" class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider">
|
||||||
|
<beans:constructor-arg>
|
||||||
|
<beans:bean class="org.springframework.security.ldap.authentication.BindAuthenticator">
|
||||||
|
<beans:constructor-arg ref="contextSource"/>
|
||||||
|
<beans:property name="userSearch" ref="userSearch"/>
|
||||||
|
</beans:bean>
|
||||||
|
</beans:constructor-arg>
|
||||||
|
<beans:constructor-arg>
|
||||||
|
<beans:bean class="org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator">
|
||||||
|
<beans:constructor-arg ref="contextSource"/>
|
||||||
|
<beans:constructor-arg value="DC=DOMAIN,DC=net"/>
|
||||||
|
<beans:property name="groupSearchFilter" value="member={0}"/>
|
||||||
|
<beans:property name="groupRoleAttribute" value="cn"/>
|
||||||
|
<beans:property name="searchSubtree" value="true" />
|
||||||
|
<beans:property name="convertToUpperCase" value="false" />
|
||||||
|
<beans:property name="rolePrefix" value="" />
|
||||||
|
</beans:bean>
|
||||||
|
</beans:constructor-arg>
|
||||||
|
</beans:bean>
|
||||||
|
|
||||||
|
<beans:bean id="userSearch" class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch">
|
||||||
|
<beans:constructor-arg index="0" value="DC=lan,DC=hamik,DC=net" />
|
||||||
|
<beans:constructor-arg index="1" value="(&(sAMAccountName={0})(|(memberOf=CN=ROLE_ADMIN,CN=Users,DC=DOMAIN,DC=net)(memberOf=CN=ROLE_USERS,CN=Users,DC=DOMAIN,DC=net)))" />
|
||||||
|
<beans:constructor-arg index="2" ref="contextSource" />
|
||||||
|
<beans:property name="searchSubtree" value="true" />
|
||||||
|
</beans:bean>
|
||||||
|
|
||||||
|
</beans:beans>
|
||||||
|
|
72
openkm/data/server.xml
Normal file
72
openkm/data/server.xml
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<Server port="8005" shutdown="SHUTDOWN">
|
||||||
|
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
|
||||||
|
<!--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-->
|
||||||
|
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
|
||||||
|
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
|
||||||
|
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
|
||||||
|
|
||||||
|
<!-- Global JNDI resources -->
|
||||||
|
<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" />
|
||||||
|
|
||||||
|
<Resource name="jdbc/OpenKMDS" auth="Container" type="javax.sql.DataSource"
|
||||||
|
maxTotal="100" maxIdle="30" maxWaitMillis="10000" validationQuery="select 1"
|
||||||
|
username="openkm" password="openkm" driverClassName="com.mysql.cj.jdbc.Driver"
|
||||||
|
url="jdbc:mysql://mysql:3306/okmdb?useSSL=false&autoReconnect=true&useUnicode=true&characterEncoding=UTF8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC"/>
|
||||||
|
|
||||||
|
|
||||||
|
<Resource name="mail/OpenKM" auth="Container" type="javax.mail.Session"
|
||||||
|
mail.transport.protocol="smtp"
|
||||||
|
mail.smtp.auth="false"
|
||||||
|
mail.smtp.host="smtp.midco.net"
|
||||||
|
mail.smtp.port="25"
|
||||||
|
mail.smtp.from="FROM_EMAIL_ADDRESS"
|
||||||
|
mail.smtp.quitwait="false"
|
||||||
|
mail.smtp.starttls.enable="false"
|
||||||
|
mail.debug="true"/>
|
||||||
|
</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="8080" address="0.0.0.0" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
|
||||||
|
|
||||||
|
<!-- Define an AJP 1.3 Connector on port 8009 -->
|
||||||
|
<Connector port="8009" address="127.0.0.1" protocol="AJP/1.3" redirectPort="8443" />
|
||||||
|
|
||||||
|
<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="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
|
||||||
|
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
|
||||||
|
prefix="localhost_access_log" suffix=".txt"
|
||||||
|
pattern="%h %l %u %t "%r" %s %b" />
|
||||||
|
|
||||||
|
<!-- External resources -->
|
||||||
|
<!-- <Context docBase="${catalina.home}/custom" path="/OpenKM/custom" reloadable="true"/> -->
|
||||||
|
</Host>
|
||||||
|
</Engine>
|
||||||
|
</Service>
|
||||||
|
</Server>
|
||||||
|
|
46
openkm/data/simple_importer.bsh
Normal file
46
openkm/data/simple_importer.bsh
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
import com.openkm.core.*;
|
||||||
|
import com.openkm.api.*;
|
||||||
|
import java.io.*;
|
||||||
|
import com.openkm.module.db.stuff.DbSessionManager;
|
||||||
|
|
||||||
|
String token = DbSessionManager.getInstance().getSystemToken();
|
||||||
|
OKMDocument document = OKMDocument.getInstance();
|
||||||
|
OKMFolder folder = OKMFolder.getInstance();
|
||||||
|
|
||||||
|
public void autoImport(String okmPath, File fldpath){
|
||||||
|
try {
|
||||||
|
print("Scanning " + fldpath.getName() + "<br>");
|
||||||
|
for (File file : fldpath.listFiles()) {
|
||||||
|
print("Importing " + file.getName() + "<br>");
|
||||||
|
try {
|
||||||
|
if (file.isDirectory()) {
|
||||||
|
try {
|
||||||
|
folder.createSimple(token, okmPath + file.getName());
|
||||||
|
} catch (ItemExistsException ie) {
|
||||||
|
print("folder already exists<br>");
|
||||||
|
// Folder already exists - just ignore exception
|
||||||
|
}
|
||||||
|
autoImport( okmPath + file.getName() + "/", file);
|
||||||
|
} else {
|
||||||
|
// Check if file is still being written to
|
||||||
|
long length = file.length();
|
||||||
|
Thread.sleep(1000);
|
||||||
|
if (file.length() > length) continue; // Skip file this time
|
||||||
|
FileInputStream fis = new FileInputStream(file);
|
||||||
|
document.createSimple(token, okmPath + file.getName(), fis);
|
||||||
|
fis.close();
|
||||||
|
}
|
||||||
|
print("Created " + okmPath + file.getName() + "<br>");
|
||||||
|
} catch (Exception e) {
|
||||||
|
print ("Exception:" + e + "<br>");
|
||||||
|
// Something bad happened to prevent import. Skip to next file.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
print("Exception: " + e + "<br>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
autoImport("/okm:root/Imported Items/Scans/", new File("/import/DocumentImport/Live"));
|
34
openkm/docker-compose.yml
Normal file
34
openkm/docker-compose.yml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
version: '3.2'
|
||||||
|
|
||||||
|
services:
|
||||||
|
openkm:
|
||||||
|
container_name: openkm
|
||||||
|
hostname: openkm
|
||||||
|
image: openkm/openkm-ce:6.3.9
|
||||||
|
ports:
|
||||||
|
- 8095:8080
|
||||||
|
volumes:
|
||||||
|
- ./data/server.xml:/opt/tomcat/conf/server.xml
|
||||||
|
- ./data/OpenKM.cfg:/opt/tomcat/OpenKM.cfg
|
||||||
|
- ./data/OpenKM.xml:/opt/tomcat/OpenKM.xml
|
||||||
|
- ./data/repository:/opt/tomcat/repository
|
||||||
|
- ./data/import:/import
|
||||||
|
environment:
|
||||||
|
CATALINA_OPTS: "-Duser.timezone=America/Chicago"
|
||||||
|
links:
|
||||||
|
- mysql:mysql
|
||||||
|
|
||||||
|
mysql:
|
||||||
|
container_name: openkmdb
|
||||||
|
hostname: openkmdb
|
||||||
|
image: mysql:8.0.13
|
||||||
|
command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8 --collation-server=utf8_bin
|
||||||
|
environment:
|
||||||
|
MYSQL_DATABASE: ${MYSQL_DATABASE}
|
||||||
|
MYSQL_USER: ${MYSQL_USER}
|
||||||
|
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
|
||||||
|
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
||||||
|
security_opt:
|
||||||
|
- seccomp:unconfined
|
||||||
|
volumes:
|
||||||
|
- ./data/mysql:/var/lib/mysql
|
Loading…
Reference in New Issue
Block a user