Important: Tested with Pentaho Server CE v8 only - quite likely it won't work with many other versions. Also only tested so far with PostgreSQL, but MySQl should work as well. The plan for now is to only support PostgreSQL and MySQL backend DBs. If you do not provide the additional config templates, only the vanilla Pentaho Server will be available (with the built-in HSQL database) - which is not suitable for scaling across multiple nodes.
Before using this Docker image, you have to understand that this is not a ready-to-go image: You will have to still prepare the configuration templates (as outlined below) and spin up an extra container for the backend database (MySQL or PostgreSQL).
Configuration Templates for External Pentaho Server Repository Database
The Docker Image has confd installed. This offers an easy way of supplying config templates to the container.
Create etc
folder within a new dedicated project folder. This folder must contain following confd configs and templates:
etc
└── confd
├── conf.d
│ ├── context.xml.toml
│ ├── hibernate-settings.xml.toml
│ ├── mysql5.hibernate.cfg.xml.toml
│ ├── postgresql.hibernate.cfg.xml.toml
│ ├── quartz.properties.toml
│ ├── repository.xml.toml
│ ├── server.properties.toml
│ ├── server.xml.toml
│ └── systemListeners.xml.toml
└── templates
├── context.xml.tmpl
├── hibernate-settings.xml.tmpl
├── mysql5.hibernate.cfg.xml.tmpl
├── postgresql.hibernate.cfg.xml.tmpl
├── quartz.properties.tmpl
├── repository.xml.tmpl
├── server.properties.tmpl
├── server.xml.tmpl
└── systemListeners.xml.tmpl
The names of the variables used in the config templates are listed below (see docker run
command). They should be fairly self-explanatory.
Run interactively:
$ docker run --rm -it -p 8080:8080 \
-e JAVA_OPTS="-Xms1024m -Xmx4096m" \
-e HIBERNATE_DB_ENGINE=postgresql \
-e HIBERNATE_DB_TYPE_CFG=postgresql.hibernate.cfg.xml \
-e HIBERNATE_JDBC_DRIVER=org.postgresql.Driver \
-e HIBERNATE_JDBC_URL=jdbc:postgresql://127.0.0.1:5432/hibernate \
-e HIBERNATE_JDBC_USERNAME=hibuser \
-e HIBERNATE_JDBC_PASSWORD=password \
-e HIBERNATE_SQL_DIALECT=org.hibernate.dialect.PostgreSQLDialect \
-e HIBERNATE_RESOURCE=hibernate/postgresql.hbm.xml \
-e JCR_DB_ENGINE=postgresql \
-e JCR_JDBC_DRIVER=org.postgresql.Driver \
-e JCR_JDBC_URL=jdbc:postgresql://127.0.0.1:5432/jackrabbit \
-e JCR_JDBC_USERNAME=jcr_user \
-e JCR_JDBC_PASSWORD=password \
-e JCR_PERSISTENCE_MANAGER_CLASS=org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager \
-e QUARTZ_JDBC_DRIVER=org.postgresql.Driver \
-e QUARTZ_JDBC_URL=jdbc:postgresql://127.0.0.1:5432/quartz \
-e QUARTZ_JDBC_USERNAME=pentaho_user \
-e QUARTZ_JDBC_PASSWORD=password \
-e QUARTZ_DRIVER_DELEGATE_CLASS=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate \
-e QUARTZ_IS_CLUSTERED=false \
-e TOMCAT_INSTANCE_UNIQUE_ID=231422 \
-e TOMCAT_PORT=8080 \
-e TOMCAT_REDIRECT_PORT=8443 \
-e TOMCAT_AJP_PORT=8009 \
-e TOMCAT_AJP_REDIRECT_PORT=8443 \
-e PENTAHO_SERVER_FULLY_QUALIFIED_URL=http://localhost:8080/pentaho/
pentaho-server
Run as a daemon replace the --rm -it
flags with -d
.
Testing Container with Local/Host Database
To connect from the container to your local database you have to define --net="host"
with the docker run
command:
sudo docker run --rm -it --net="host" \
-e JAVA_OPTS="-Xms1024m -Xmx4096m" \
-e JAVA_OPTS="-Xms1024m -Xmx4096m" \
-e HIBERNATE_DB_ENGINE=postgresql \
-e HIBERNATE_DB_TYPE_CFG=postgresql.hibernate.cfg.xml \
-e HIBERNATE_JDBC_DRIVER=org.postgresql.Driver \
-e HIBERNATE_JDBC_URL=jdbc:postgresql://127.0.0.1:5432/hibernate \
-e HIBERNATE_JDBC_USERNAME=hibuser \
-e HIBERNATE_JDBC_PASSWORD=password \
-e HIBERNATE_SQL_DIALECT=org.hibernate.dialect.PostgreSQLDialect \
-e HIBERNATE_RESOURCE=hibernate/postgresql.hbm.xml \
-e JCR_DB_ENGINE=postgresql \
-e JCR_JDBC_DRIVER=org.postgresql.Driver \
-e JCR_JDBC_URL=jdbc:postgresql://127.0.0.1:5432/jackrabbit \
-e JCR_JDBC_USERNAME=jcr_user \
-e JCR_JDBC_PASSWORD=password \
-e JCR_PERSISTENCE_MANAGER_CLASS=org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager \
-e QUARTZ_JDBC_DRIVER=org.postgresql.Driver \
-e QUARTZ_JDBC_URL=jdbc:postgresql://127.0.0.1:5432/quartz \
-e QUARTZ_JDBC_USERNAME=pentaho_user \
-e QUARTZ_JDBC_PASSWORD=password \
-e QUARTZ_DRIVER_DELEGATE_CLASS=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate \
-e QUARTZ_IS_CLUSTERED=false \
-e TOMCAT_INSTANCE_UNIQUE_ID=231422 \
-e TOMCAT_PORT=8080 \
-e TOMCAT_REDIRECT_PORT=8443 \
-e TOMCAT_AJP_PORT=8009 \
-e TOMCAT_AJP_REDIRECT_PORT=8443 \
-e PENTAHO_SERVER_FULLY_QUALIFIED_URL=http://localhost:8080/pentaho/ \
-v ${PWD}/etc/confd:/etc/confd \
pentaho-server
Note: Since the container uses the network of the host now, there is no need to define any port mappings with the
docker run
command.
Add Repository Content
The easiest way to add the repository content (JDBC connections, Mondrian schemas, reports, etc) is using the Pentaho Server REST APIs.
External Database
This section is just for background info.
PostgreSQL
Important: You must set
listen_addresses = '*'
so that other containers will be able to access postgres. This is set as default for this image.
To run some sql scripts, make them available in the /docker-entrypoint-initdb.d
folder. This feature will enable us to run the required SQL statements to create the Jackrabbit, Quartz and Hibernate datbases for the Pentaho Server:
docker run --rm -it \
--name postgresql-instance \
-e POSTGRES_PASSWORD=mysecretpassword \
-e PGDATA=/var/lib/postgresql/data/pgdata \
-v ${PWD}/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d:z \
postgres:10.3-alpine
Finally, let's also try to persist the data:
Important: If you want to persist the PostgreSQL data, you can mount the volume to
/var/lib/postgresql/data
. In this case, it usually will contain alost+found
folder, whichinitdb
dislikes. The recommendation is to store the data in a subfolder of this directory. Hence set the environment variablePGDATA
to/var/lib/postgresql/data/pgdata
(in example).
docker run --rm -it \
--name postgresql-instance \
-e POSTGRES_PASSWORD=mysecretpassword \
-e PGDATA=/var/lib/postgresql/data/pgdata \
-v ${PWD}/pgdata:/var/lib/postgresql/data:z \
-v ${PWD}/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d:z \
postgres:10.3-alpine