cancel
Showing results for 
Search instead for 
Did you mean: 

Prototyping latest Alfresco on Docker on CentOS 7

joko71
Confirmed Champ
Confirmed Champ

I've managed to start latest Alfresco on Docker on CentOS 7.

I have plenty of experience in Alfresco environment in old fashioned way, but zero in the new reality so be kind to me. Smiley Happy

So, this is dockered Alfresco, and I'd like to do some prototyping in developing some test web scripts.

How do I do it, for example in Eclipse dev environment?

TIA!

1 ACCEPTED ANSWER

joko71
Confirmed Champ
Confirmed Champ

I did it finally!

Several things were wrong in my setup, so it may help some unfortunate soul:

1. Your DB URI/name is not "localhost" or "127.0.0.1", but how you name it in your docker-compose file. My DB:

   database:
        image: mysql:5.7
        mem_limit: 512m

...

2. Wherever you reference DB, use that name, for example in alfresco service in docker-compose,yml file:

JAVA_OPTS
...
-Ddb.url=\"jdbc:mysql://database:3306/alfresco?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=true\"

In YOUR OWN alfresco-global.properties file:

##
# MySQL
##
db.name=alfresco
db.username=alfresco
db.password=alfresco
db.driver=com.mysql.cj.jdbc.Driver
db.url=jdbc:mysql://database/${db.name}?useUnicode=true&characterEncoding=UTF-8
db.master.url=jdbc:mysql://database/
db.master.username=${db.username}
db.master.password=${db.password}
db.drop.command=drop database if exists ${db.name}
db.create.command=create database ${db.name} CHARACTER SET utf8 COLLATE utf8_bin;

2. Volumes for alfresco service (watch out for writing permissions if on Linux!):

        volumes:
           - ./volumes/data/alf_data:/usr/local/tomcat/alf_data
           - ./mysql-connector-java-8.0.25.jar:/usr/local/tomcat/lib/mysql-connector-java-8.0.25.jar
           - ./alfresco-global.properties:/usr/local/tomcat/shared/classes/alfresco-global.properties

3. My complete database service (with volumes):

    database:
        image: mysql:5.7
        mem_limit: 512m
        environment:
            - MYSQL_ROOT_PASSWORD=root
            - MYSQL_DATABASE=alfresco
            - MYSQL_USER=alfresco
            - MYSQL_PASSWORD=alfresco
        command: --explicit_defaults_for_timestamp
        ports:
            - 3306:3306
        security_opt:
            - seccomp:unconfined
        cap_add:
            - SYS_NICE  # CAP_SYS_NICE
        volumes:
        - ./volumes/data/mysql_data:/var/lib/mysql
        - ./volumes/logs/mysql:/var/log/mysql

I'm happy, officially! Smiley Happy

View answer in original post

12 REPLIES 12

Maybe I'm using "volumes" keyword in a wrong way? I'm trying to use it to inject files into containers. For example, in Alfresco container:

        volumes:
            - ./mysql-connector-java-8.0.25.jar:/usr/local/tomcat/lib/mysql-connector-java-8.0.25.jar
            - ./mysql-connector-java-8.0.25.jar:/usr/local/tomcat/webapps/alfresco/WEB-INF/lib/mysql-connector-java-8.0.25.jar
            - ./alfresco-global.properties:/usr/local/tomcat/shared/classes/alfresco-global.properties

joko71
Confirmed Champ
Confirmed Champ

I did it finally!

Several things were wrong in my setup, so it may help some unfortunate soul:

1. Your DB URI/name is not "localhost" or "127.0.0.1", but how you name it in your docker-compose file. My DB:

   database:
        image: mysql:5.7
        mem_limit: 512m

...

2. Wherever you reference DB, use that name, for example in alfresco service in docker-compose,yml file:

JAVA_OPTS
...
-Ddb.url=\"jdbc:mysql://database:3306/alfresco?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=true\"

In YOUR OWN alfresco-global.properties file:

##
# MySQL
##
db.name=alfresco
db.username=alfresco
db.password=alfresco
db.driver=com.mysql.cj.jdbc.Driver
db.url=jdbc:mysql://database/${db.name}?useUnicode=true&characterEncoding=UTF-8
db.master.url=jdbc:mysql://database/
db.master.username=${db.username}
db.master.password=${db.password}
db.drop.command=drop database if exists ${db.name}
db.create.command=create database ${db.name} CHARACTER SET utf8 COLLATE utf8_bin;

2. Volumes for alfresco service (watch out for writing permissions if on Linux!):

        volumes:
           - ./volumes/data/alf_data:/usr/local/tomcat/alf_data
           - ./mysql-connector-java-8.0.25.jar:/usr/local/tomcat/lib/mysql-connector-java-8.0.25.jar
           - ./alfresco-global.properties:/usr/local/tomcat/shared/classes/alfresco-global.properties

3. My complete database service (with volumes):

    database:
        image: mysql:5.7
        mem_limit: 512m
        environment:
            - MYSQL_ROOT_PASSWORD=root
            - MYSQL_DATABASE=alfresco
            - MYSQL_USER=alfresco
            - MYSQL_PASSWORD=alfresco
        command: --explicit_defaults_for_timestamp
        ports:
            - 3306:3306
        security_opt:
            - seccomp:unconfined
        cap_add:
            - SYS_NICE  # CAP_SYS_NICE
        volumes:
        - ./volumes/data/mysql_data:/var/lib/mysql
        - ./volumes/logs/mysql:/var/log/mysql

I'm happy, officially! Smiley Happy

EddieMay
World-Class Innovator
World-Class Innovator

Hi @joko71 

Great news - so pleased you're happy! Also, thank you for taking the time to outline how you got it working - really invaluable & may help others in a similar situation. I'll mark your thread as answered - that will also help others.

Onwards & upwards with Alfresco!

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!