Using Docker
Docker is a software platform that allows you to build, test, and deploy applications quickly. Docker packages software into standardized units called containers that have everything the software needs to run including libraries, system tools, code, and runtime. Using Docker, you can quickly deploy and scale applications into any environment and know your code will run.
There is a public Docker image available at https://hub.docker.com/repository/docker/openkm/openkm-ce and it is the easiest way yo get OpenKM running on your server.
Please, refer to Docker documentation for installation instructions and to learn more about Docker.
Once Docker has been installed, just execute this command to get your OpenKM CE instance:
$ docker run --name openkm-ce -p 8080:8080 openkm/openkm-ce
And after that, point your browser at http://localhost:8080/. The default user and password is "okmAdmin" / "admin".
Using other databases
The default database used in this image is H2 which is an embedded which we don't recommend for production. To use another database you need to customize a couple of files and make available to Docker container:
- OpenKM.cfg
- conf/server.xml
These databases are supported:
- MariaDB
- MySQL
- Oracle
- PostgreSQL
- SQL Server
Sample configuration
This Docker Compose will start OpenKM with MySQL:
version: '3.2'
services:
openkm:
image: openkm/openkm-ce:6.3.9
ports:
- 8080:8080
volumes:
- ${PWD}/server.xml:/opt/tomcat/conf/server.xml
- ${PWD}/OpenKM.cfg:/opt/tomcat/OpenKM.cfg
- ${PWD}/repository:/opt/tomcat/repository
links:
- mysql:mysql
mysql:
image: mysql:8.0.13
command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8 --collation-server=utf8_bin
environment:
- MYSQL_DATABASE=okmdb
- MYSQL_USER=openkm
- MYSQL_PASSWORD=openkm
- MYSQL_ROOT_PASSWORD=openkm
security_opt:
- seccomp:unconfined
volumes:
- ${PWD}/mysql:/var/lib/mysql
This would be the content of the OpenKM.cfg file:
# OpenKM Hibernate configuration values
hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
hibernate.hbm2ddl=create
# Logback configuration file
logback.config=logback.xml
And this is the content of the server.xml file:
<?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.smtp.host="localhost" mail.from="noreply@openkm.com"/>
</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>
Once configured, you can start OpenKM and the database with Docker Compose:
$ docker-compose up -d
And check the logs with:
$ docker-compose logs -f