diff --git a/openkm/data/OpenKM.cfg b/openkm/data/OpenKM.cfg new file mode 100644 index 0000000..f13df93 --- /dev/null +++ b/openkm/data/OpenKM.cfg @@ -0,0 +1,7 @@ +#OpenKM Hibernate configuration values +hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect +hibernate.hbm2ddl=create + +# Logback configuration file +# logback.config=logback.xml + diff --git a/openkm/data/OpenKM.xml b/openkm/data/OpenKM.xml new file mode 100644 index 0000000..ff97493 --- /dev/null +++ b/openkm/data/OpenKM.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + java.naming.referral + + follow + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/openkm/data/server.xml b/openkm/data/server.xml new file mode 100644 index 0000000..20c7855 --- /dev/null +++ b/openkm/data/server.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/openkm/data/simple_importer.bsh b/openkm/data/simple_importer.bsh new file mode 100644 index 0000000..ea14315 --- /dev/null +++ b/openkm/data/simple_importer.bsh @@ -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() + "
"); + for (File file : fldpath.listFiles()) { + print("Importing " + file.getName() + "
"); + try { + if (file.isDirectory()) { + try { + folder.createSimple(token, okmPath + file.getName()); + } catch (ItemExistsException ie) { + print("folder already exists
"); + // 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() + "
"); + } catch (Exception e) { + print ("Exception:" + e + "
"); + // Something bad happened to prevent import. Skip to next file. + continue; + } + file.delete(); + } + } catch (Exception e) { + print("Exception: " + e + "
"); + } +} + +autoImport("/okm:root/Imported Items/Scans/", new File("/import/DocumentImport/Live")); diff --git a/openkm/docker-compose.yml b/openkm/docker-compose.yml new file mode 100644 index 0000000..0473bea --- /dev/null +++ b/openkm/docker-compose.yml @@ -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