Skip to content

Using MariaDB instead of PostgreSQL as database

Angel Borroy edited this page Nov 13, 2018 · 2 revisions

Following instructions describe how to configure MariaDB instead of PostgreSQL as Alfresco Repository Database.

  1. Replace postgres service by mariadb service in docker-compose.yml
    db:
      image: mariadb:latest
      container_name: mariadb
      volumes:
        - ./volumes/data/mariadb_data:/var/lib/mysql
        - ./volumes/logs/mariadb:/var/log/mysql
      environment:
        - MYSQL_ROOT_PASSWORD=alfresco
        - MYSQL_DATABASE=alfresco
        - MYSQL_USER=alfresco
        - MYSQL_PASSWORD=alfresco
      networks:
        - internal
      command: [mysqld, --character-set-server=utf8, --collation-server=utf8_bin, --wait_timeout=28800]
  1. Modify database connection properties in alfresco service in docker-compose.yml
    alfresco:
        build: ./alfresco
        container_name: alfresco
        depends_on:
            - db
        environment:
            JAVA_OPTS : '
                -Ddb.driver=org.mariadb.jdbc.Driver
                -Ddb.username=alfresco
                -Ddb.password=alfresco
                -Ddb.url=jdbc:mariadb://db:3306/alfresco?useUnicode=true\&characterEncoding=UTF-8
...
                '
  1. Download MariaDB Connector/J and copy driver to a new folder tomcat/lib under alfresco Dockerfile folder

Below a sample command is included:

$ mkdir docker-alfresco/alfresco/tomcat/lib
$ cp mariadb-java-client-2.2.3.jar docker-alfresco/tomcat/lib
  1. Include these lines at the end of Alfresco Dockerfile to copy the driver inside Tomcat Lib
# Install MariaDB Driver
COPY tomcat/lib $TOMCAT_DIR/lib