Prototyping latest Alfresco on Docker on CentOS 7

cancel
Showing results for 
Search instead for 
Did you mean: 
joko71
Active Member II

Prototyping latest Alfresco on Docker on CentOS 7

Jump to solution

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 Solution

Accepted Solutions
joko71
Active Member II

Re: Prototyping latest Alfresco on Docker on CentOS 7

Jump to solution

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 solution in original post

12 Replies
angelborroy
Alfresco Employee

Re: Prototyping latest Alfresco on Docker on CentOS 7

Jump to solution
joko71
Active Member II

Re: Prototyping latest Alfresco on Docker on CentOS 7

Jump to solution

Yes, that's heavy on the web scripts developing with Maven and creating AMPs, what I'm the most interested is the part of Docker deployment of AMPs on dockered Alfresco, to be precise on Alfresco in docker-compose. I'm as a babe regarding Docker and docker-compose, I need baby food. Smiley Happy

angelborroy
Alfresco Employee

Re: Prototyping latest Alfresco on Docker on CentOS 7

Jump to solution

You can use this project:

https://github.com/alfresco/alfresco-docker-installer

Just copy your AMPS / JARS to the "modules" folder and it's done.

Hyland Developer Evangelist
joko71
Active Member II

Re: Prototyping latest Alfresco on Docker on CentOS 7

Jump to solution

One of dockers in this compose is Postgres as a DB. How can I change it into MySQL?

angelborroy
Alfresco Employee

Re: Prototyping latest Alfresco on Docker on CentOS 7

Jump to solution

I guess you can choose also in alfresco-docker-installer using MySQL / MariaDB. You can change it in order to understand how that works.

Hyland Developer Evangelist
joko71
Active Member II

Re: Prototyping latest Alfresco on Docker on CentOS 7

Jump to solution

I've tried with in yml:

alfresco:

...

JAVA_OPTS: "
-Ddb.driver=com.mysql.jdbc.Driver
-Ddb.username=alfresco
-Ddb.password=alfresco
-Ddb.url=jdbc:mysql://localhost:3306/alfresco

 

mysql:
image: mysql:8
mem_limit: 512m
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=alfresco
- MYSQL_USER=alfresco
- MYSQL_PASSWORD=alfresco
command: --default-authentication-plugin=mysql_native_password
ports:
- 3306:3306

But there's a problem with solr6, according to log. Maybe I should try with another MySQL image.

Edit:

I tried to downgrade MySQL to 5.7, but still the same error. I still haven't found where docker-compose log is, I can see only stack traces flying in the terminal, but I think I saw alfresco and solr docker images can't find MySQL driver. If that is the case, how and where can I put the MySQL driver?

angelborroy
Alfresco Employee

Re: Prototyping latest Alfresco on Docker on CentOS 7

Jump to solution

This is for MariaDB, found your way for MySQL:

https://github.com/Alfresco/alfresco-docker-installer/blob/master/generators/app/templates/images/al...

Hyland Developer Evangelist
joko71
Active Member II

Re: Prototyping latest Alfresco on Docker on CentOS 7

Jump to solution

I've managed to inject CNF file for MySQL and a MySQL connector JAR in alfresco lib folder, but I still get an error:

Failed to obtain JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Communications link failure

MySQL log:

Attaching to docker-alfresco_mysql_1
mysql_1               | 2021-05-17 11:29:05+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.34-1debian10 started.
mysql_1               | 2021-05-17 11:29:05+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
mysql_1               | 2021-05-17 11:29:05+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.34-1debian10 started.
mysql_1               | 2021-05-17T11:29:06.068670Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
mysql_1               | 2021-05-17T11:29:06.071282Z 0 [Note] mysqld (mysqld 5.7.34-log) starting as process 1 ...
mysql_1               | 2021-05-17T11:29:06.076392Z 0 [Note] InnoDB: PUNCH HOLE support available
mysql_1               | 2021-05-17T11:29:06.076415Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
mysql_1               | 2021-05-17T11:29:06.076420Z 0 [Note] InnoDB: Uses event mutexes
mysql_1               | 2021-05-17T11:29:06.076426Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
mysql_1               | 2021-05-17T11:29:06.076434Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
mysql_1               | 2021-05-17T11:29:06.076439Z 0 [Note] InnoDB: Using Linux native AIO
mysql_1               | 2021-05-17T11:29:06.076860Z 0 [Note] InnoDB: Number of pools: 1
mysql_1               | 2021-05-17T11:29:06.077037Z 0 [Note] InnoDB: Not using CPU crc32 instructions
mysql_1               | 2021-05-17T11:29:06.080509Z 0 [Note] InnoDB: Initializing buffer pool, total size = 6G, instances = 4, chunk size = 128M
mysql_1               | 2021-05-17T11:29:07.090310Z 0 [Note] InnoDB: Completed initialization of buffer pool
mysql_1               | 2021-05-17T11:29:07.864463Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
mysql_1               | 2021-05-17T11:29:08.071740Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
mysql_1               | 2021-05-17T11:29:09.494924Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
mysql_1               | 2021-05-17T11:29:09.495035Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
mysql_1               | 2021-05-17T11:29:09.552300Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
mysql_1               | 2021-05-17T11:29:09.808329Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
mysql_1               | 2021-05-17T11:29:09.808353Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
mysql_1               | 2021-05-17T11:29:09.810595Z 0 [Note] InnoDB: Waiting for purge to start
mysql_1               | 2021-05-17T11:29:09.880423Z 0 [Note] InnoDB: 5.7.34 started; log sequence number 12665468
mysql_1               | 2021-05-17T11:29:09.886387Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
mysql_1               | 2021-05-17T11:29:10.026337Z 0 [Note] Plugin 'FEDERATED' is disabled.
mysql_1               | 2021-05-17T11:29:10.588875Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
mysql_1               | 2021-05-17T11:29:10.588910Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
mysql_1               | 2021-05-17T11:29:10.593498Z 0 [Warning] CA certificate ca.pem is self signed.
mysql_1               | 2021-05-17T11:29:10.593578Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
mysql_1               | 2021-05-17T11:29:10.593726Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
mysql_1               | 2021-05-17T11:29:10.593775Z 0 [Note] IPv6 is available.
mysql_1               | 2021-05-17T11:29:10.593790Z 0 [Note]   - '::' resolves to '::';
mysql_1               | 2021-05-17T11:29:10.598342Z 0 [Note] Server socket created on IP: '::'.
mysql_1               | 2021-05-17T11:29:10.604447Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
mysql_1               | 2021-05-17T11:29:10.684322Z 0 [Note] InnoDB: Buffer pool(s) load completed at 210517 11:29:10
mysql_1               | 2021-05-17T11:29:10.909582Z 0 [Note] Event Scheduler: Loaded 0 events
mysql_1               | 2021-05-17T11:29:10.922655Z 0 [Note] mysqld: ready for connections.
mysql_1               | Version: '5.7.34-log'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)

My Mysql CNF file:

#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
# 
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port		= 3306
socket		= /var/run/mysqld/mysqld.sock

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
#socket		= /var/run/mysqld/mysqld.sock
nice		= 0

[mysqld]
ft_min_word_len=3
#
# * Basic Settings
#
user		= mysql
pid-file	= /var/run/mysqld/mysqld.pid
socket		= /var/run/mysqld/mysqld.sock
port		= 3306
basedir		= /usr
datadir		= /var/lib/mysql
tmpdir		= /tmp
# DEPRECATED language	= /usr/share/mysql/english
lc-messages-dir	= /usr/share/mysql
skip-external-locking
#Added by Frane
init_connect='SET collation_connection = utf8_general_ci; SET NAMES utf8;'
#default-character-set=utf8
character-set-server = utf8
collation-server = utf8_general_ci
#ibdata growth step
innodb_autoextend_increment=512
#End Added by Frane
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address		= 127.0.0.1

#
# * Fine Tuning
#
# key_buffer		= 64M
max_allowed_packet	= 16M
thread_stack		= 256K
thread_cache_size = 20

low_priority_updates=1
concurrent_insert=ALWAYS
tmp_table_size = 64M
max_heap_table_size = 64M

# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover-options = BACKUP
max_connections        = 180
#table_cache            = 64
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit = 4M
query_cache_size = 128M

join_buffer_size = 1M

#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
#log		= /var/log/mysql/mysql.log
#
# Error logging goes to syslog. This is a Debian improvement :)
#
# Here you can see queries with especially long duration
#log_slow_queries	= /var/log/mysql/mysql-slow.log
# DEPRECATED! log_slow_queries	= mysql-slow.log
slow_query_log = 1
slow_query_log_file = mysql-slow.log
long_query_time = 5
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id		= 1
#log_bin			= /var/log/mysql/mysql-bin.log
expire_logs_days	= 10
max_binlog_size         = 100M
#binlog_do_db		= include_database_name
#binlog_ignore_db	= include_database_name
#
# * BerkeleyDB
#
# Using BerkeleyDB is now discouraged as its support will cease in 5.1.12.
#skip-bdb
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
# You might want to disable InnoDB to shrink the mysqld process by circa 100MB.
#skip-innodb
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem

# Set buffer pool size to 50-80% of your computer's memory
# Needed to solve migration bug: http://forums.alfresco.com/en/viewtopic.php?f=8&t=35238, http://issues.alfresco.com/jira/browse/ALF-3779
innodb_buffer_pool_size = 6G
innodb_buffer_pool_instances = 4

#InnoDB lock wait time
innodb_lock_wait_timeout = 120

innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_thread_concurrency = 0

innodb_flush_log_at_trx_commit = 2
innodb_flush_method = O_DIRECT
innodb_log_file_size = 50M
innodb_log_buffer_size = 8M

innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90

[mysqldump]
quick
quote-names
max_allowed_packet	= 16M

[mysql]
#no-auto-rehash	# faster start of mysql but no tab completition

[isamchk]
# key_buffer = 64M

#
# * NDB Cluster
#
# See /usr/share/doc/mysql-server-*/README.Debian for more information.
#
# The following configuration is read by the NDB Data Nodes (ndbd processes)
# not from the NDB Management Nodes (ndb_mgmd processes).
#
# [MYSQL_CLUSTER]
# ndb-connectstring=127.0.0.1


#
# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#
# !includedir /etc/mysql/conf.d/

interactive_timeout=180 # "No.of sec. a server waits for activity on interactive connection before closing it"
wait_timeout=180 # "No. of sec. a server waits for an activity on a connection before closing it"
connect_timeout=60

My alfresco global file:

###############################
## Common Alfresco Properties #
###############################

#
# Content and index data location
#
dir.root=/var/alfresco/data

#
# Database connection properties
#
db.username=alfresco
db.password=alfresco

#
# Property to control whether schema updates are performed automatically.
# Updates must be enabled during upgrades as, apart from the static upgrade scripts,
# there are also auto-generated update scripts that will need to be executed.  After
# upgrading to a new version, this can be disabled.
#
db.schema.update=false

db.pool.max=200

#
# MySQL connection
#
#db.driver=org.gjt.mm.mysql.Driver
#db.url=jdbc:mysql://localhost/alfresco

# ######################################### #
# Index Recovery and Tracking Configuration #
# ######################################### #
#
# Recovery types are:
#    NONE:     Ignore
#    VALIDATE: Checks that the first and last transaction for each store is represented in the indexes
#    AUTO:     Validates and auto-recovers if validation fails
#    FULL:     Full index rebuild, processing all transactions in order.  The server is temporarily suspended.
index.recovery.mode=AUTO
#index.recovery.mode=FULL


 

angelborroy
Alfresco Employee

Re: Prototyping latest Alfresco on Docker on CentOS 7

Jump to solution

Some other sample:

https://github.com/keensoft/docker-alfresco/wiki/Using-MariaDB-instead-of-PostgreSQL-as-database

You don't need a CFN file at all...

Hyland Developer Evangelist