Studio Developer Manual / Version 2406.1
Table Of ContentsFor the database connection and schema evolution for the Editorial Comments feature Hibernate and Liquibase are used. Both frameworks support multiple databases and therefore must be configured correctly.
For each database CoreMedia delivers the appropriate configuration in an extra Maven module. The database driver for MySQL and PostgreSQL are already provided as runtime dependencies in the studio-server-app module. The Maven dependency has to be added to the studio-server-app and contains the properties to be set and a transitive dependency to the driver. Furthermore, the database schema and the database user are expected to be setup. The required schema name, username and password differs for each database and can be found in the detailed descriptions.
Further configuration options can be found in Section 3.4.9, “Editorial Comments Configuration” in Deployment Manual.
Note
In case you want to provide a schema or username, different to cm_editorial_comments
(current default), use the properties
editorial.comments.db.username
, editorial.comments.db.schema
and editorial.comments.db.password
.
MySQL
To configure MySQL, prepare the database as described in Database requirements and set the property
editorial.comments.datasource.url
.
Database requirements:
schema: cm_editorial_comments |
username: cm_editorial_comments |
password: cm_editorial_comments |
Maven Dependency:
<dependency> <groupId>com.coremedia.blueprint</groupId> <artifactId>database-drivers</artifactId> <type>pom</type> <scope>runtime</scope> </dependency> </dependencies>
Required properties:
editorial.comments.datasource.url=jdbc:mysql://${host}:${port}/cm_editorial_comments?useUnicode=yes&characterEncoding=UTF-8 |
PostgreSQL
To configure PostgreSQL, prepare the database as described in Database requirements and set the property editorial.comments.datasource.url.
Database requirements:
schema: cm_editorial_comments |
username: cm_editorial_comments |
password: cm_editorial_comments |
Maven Dependency:
<dependency> <groupId>com.coremedia.blueprint</groupId> <artifactId>database-drivers</artifactId> <type>pom</type> <scope>runtime</scope> </dependency> </dependencies>
Required Properties:
editorial.comments.datasource.url=jdbc:postgresql://${host}:${port}/coremedia |
Note
Should you use PostgreSQL hosted on Azure, it is necessary to provide a postfix with the domain to the username.
Use editorial.comments.db.username
to set the username with the postfix:
editorial.comments.db.username=cm_editorial_comments@domain |
editorial.comments.db.schema=cm_editorial_comments |
MariaDB
To configure MariaDB, prepare the database as described in Database requirements, add the Maven dependency and set
the property editorial.comments.datasource.url
.
Database requirements:
schema: cm_editorial_comments |
username: cm_editorial_comments |
password: cm_editorial_comments |
Ensure Proper Character Set And Collation
To ensure proper encoding and collation behavior, ensure using
character set utf8mb4
and collation
utf8mb4_bin
for your created database.
Maven Dependency:
<dependency> <groupId>com.coremedia.cms</groupId> <artifactId>editorial-comments-data-mariadb</artifactId> </dependency>
Required Properties, replace username and password if required:
editorial.comments.datasource.url=jdbc:mariadb://${host}:${port}/cm_editorial_comments |
Respect Password Check Plugins
MariaDB Enterprise Server comes with a password check plugin enabled by default. Ensure, that your password meets the requirements of that password check plugin.
Microsoft SQL Server
To configure Microsoft SQL Server, prepare the database as described in Database requirements, add the Maven dependency and set the property editorial.comments.datasource.url.
Database requirements:
schema: cm_editorial_comments |
username: cm_editorial_comments |
password: cm_editorial_comments |
Maven Dependency:
<dependency> <groupId>com.coremedia.cms</groupId> <artifactId>editorial-comments-data-mssql</artifactId> </dependency>
Required Properties, replace username and password if required:
editorial.comments.datasource.url=jdbc:sqlserver://${host}:${db.port};DatabaseName=cm_editorial_comments;username=sa;password=admin |
Oracle
To configure Oracle DB, prepare the database as described in Database requirements, add the Maven dependency and set
the property editorial.comments.datasource.url
.
Database requirements:
schema: cm_editorial_comments |
username: cm_editorial_comments |
password: cm_editorial_comments |
Maven Dependencies:
<dependency> <groupId>com.coremedia.cms</groupId> <artifactId>editorial-comments-data-oracle</artifactId> </dependency>
Required Properties:
editorial.comments.datasource.url=jdbc:oracle:thin:@${host}:${port}:COMMENTS |
Working with Liquibase
Run modes
Liquibase can run either on startup of each server automatically or get executed manually. The default for the Studio-Server is the automatic run on each server startup. This means that on each startup liquibase checks if the schema contains all entries of the defined changesets. During startup of the Studio-Server Liquibase sets a lock in the database if the actual schema is not fully applied. If the Studio-Server startup is interrupted during the process of applying the schema, the lock might be left in the database. This is very unlikely but if this occurs the lock can be released. For instructions see Section “Release locks”.
Even if it is recommended to run Liquibase automatically in some deployment scenarios it might make sense to execute Liquibase manually.
To reach this, automatic runs can be disabled by setting the property editorial.comments.liquibase.enabled=false
.
Afterwards you have to take care to run an database schema upgrade on each upgrade of CMCC.
This can be done by either running a Studio Server instance once with the property editorial.comments.liquibase.enabled=true
or by
using the Liquibase command line tool.
The following example shows a liquibase.properties file for a MySQL setup used by the command line tool:
changeLogFile=db/changelog/db.changelog-editorial-comments.xml username=cm_editorial_comments password=cm_editorial_comments driver=com.mysql.cj.jdbc.Driver url=jdbc:mysql://localhost:3306/cm_editorial_comments ?useUnicode=yes&characterEncoding=UTF-8 classpath=>pathToMySqlDriver>/mysql-connector-j-8.2.0.jar :<pathTo_editorial-comments-data-jar>editorial-comments-data-1-SNAPSHOT.jar
Example 3.1. Running Liquibase via cmd tool
Release locks
By default liquibase runs automatically on Studio Server startup. In very rare cases (e.g. interruption on startup) the database might contain a lock entry that has not been cleaned up. As a result starting Studio Servers is blocked by Liquibase. The lock can either be removed manually manually or with the Liquibase cmd tool which can be also executed via Docker:
docker run --rm -e INSTALL_MYSQL=true liquibase/liquibase \ --url="jdbc:mysql://host:port/cm_editorial_comments" \ --username=cm_editorial_comments \ --password=cm_editorial_comments \ releaseLocks
Example 3.2. Release lock via docker-container