Setting up the Alfresco with Docker

Alfresco is a Documents (Contents) Management System. It is

  • OSS
  • Has Full Text Search
  • Supports Japanese

The Community edition is free. There is Enterprise Edition also.

This article how to deploy the Alfresco Community Edition with the Docker. The Docker Compose templates on the official site doesn’t support the serialize. The Docker Compose templates in this article supports serialize.

System Requirements

The system requirements of this article is below, which is a virtual machine running on the Hyper-V.

  • 2 CPU (Virtual Processor)
  • 13GB RAM
  • 128GB Storage
  • Ubuntu Linux LTS 20.04.1

Install a Docker

First, install a docker into your machine.

$ sudo apt update
$ sudo apt install docker.io docker-compose docker

Create a docker compose file

We use the generator-alfresco-docker-install.

Alfresco/alfresco-docker-installer: Generator to build Docker Compose templates to deploy Alfresco Community

The generator-alfresco-docker-install needs following two packages.

  • Node.js
  • Yeoman

Before install generator, install these packages.

Install Node.js

Install Node.js and npm with apt.

$ sudo apt install nodejs npm

Install Yeoman

Install Yeoman with npm.

$ sudo npm install -g yo

Install generator-alfresco-docker-installer

Install generator with npm.

$ sudo npm install --global generator-alfresco-docker-installer

Generate the compose file

Generate the compose file with the generator. First, create the directory and go into it.

$ mkdir docker-compose
$ cd docker-compose

Next run the generator.

$ yo alfresco-docker-installer

Follow to the generator and input options. I entered values below.

Which ACS version do you want to Use?

6.2

How may GB RAM are available for Alfresco (8 is minimum required)?

8

Do you want to use HTTPs for Web Proxy?

No

What is the name of your server?

doc.rkdev.corp

What HTTP port do you want to use (all the services are using the same port)?

80

Do you want to use FTP (port 2121)?

No

Do you want to use MariaDB instead of PostgreSQL?

No

Are you using different languages (this is the most common scenario)?

Yes

Do you want to create an internal SMTP server?

Yes

Do you want to create an internal LDAP server?

Yes

Select the addons to be installed

Enables following packages.

  • JavaScript Console 0.6
  • Order of the Bee Support Tools 1.0.0.0
  • Share Site Creators 0.0.7

Are you using a Windows host to run Docker?

No

Do you want to use a start script?

No

Create containers

At this time, try to run.

$ sudo docker-compose up -d

Wait until containers are created. After completed, following messages are appeared into your console.

Creating openldap                               ... done
Creating docker-compose_share_1                 ... done
Creating docker-compose_smtp_1                  ... done
Creating docker-compose_alfresco-pdf-renderer_1 ... done
Creating docker-compose_activemq_1              ... done
Creating docker-compose_tika_1                  ... done
Creating docker-compose_solr6_1                 ... done
Creating docker-compose_libreoffice_1           ... done
Creating docker-compose_transform-misc_1        ... done
Creating docker-compose_postgres_1              ... done
Creating docker-compose_imagemagick_1           ... done
Creating docker-compose_alfresco_1              ... done
Creating phpldapadmin                           ... done
Creating docker-compose_content-app_1           ... done
Creating docker-compose_proxy_1                 ... done

Open with the web browser. I set the hostname to doc.rkdev.corp, so the URL is to be http://doc.rkdev.corp/.

Configure permissions

Disables folder mappings temporary

Configure the permission of the data directory for the PostgreSQL and the Solr. Stop containers.

$ sudo docker-compose down

Open the docker-compose.yml and comment out volumes for postgres and solr6.

services:
	postgres:
#		volumes:
#			- ./data/postgres-data:/var/lib/postgresql/data
#			- ./logs/postgres:/var/log/postgresql

	solr6:
#		volumes:
#			- ./data/solr-data:/opt/alfresco-search-services/data

Rebuild containers and run them at here. Data directories in the container will be used because volumes were comment out.

$ sudo docker-compose up --build --force-recreate -d

Get the container name

Get the container name.

$ sudo docker ps

Check the container name of the PostgreSQL and the Solr. On my machine, container name is below.

  • PostgreSQL
    • IMAGE : postgres:11.4
    • NAMES : docker-compose_postgres_1
  • Solr
    • IMAGE : docker-compose_solr6
    • NAMES : docker-compose_solr1_1

Get the UID of the data directory for the PostgreSQL

Go into the container for the PostgreSQL and get the UID of the data directory. docker-compose_postgres_1 is a container name.

$ sudo docker exec -it docker-compose_postgres_1 sh

List up the contents of the /var/lib/postgresql which contains the data directory to check the UID of it. The directory pass is written in compose.yml.

$ ls -la /var/lib/postgresql

On my machine, it exported below and I see the user name is postgres .

total 12
drwxr-xr-x  1 postgres postgres 4096 Jul 17  2019 .
drwxr-xr-x  1 root     root     4096 Jul 17  2019 ..
drwx------ 19 postgres postgres 4096 Nov 22 08:21 data

Get the UID of the postgres.

$ id -u postgres

It exported below and I see the UID is 999 .

999

Exit from the container and shutdown it.

$ exit
$ sudo docker-compose down

Change the UID of directories

Change the UID of directories.

$ sudo chown -R 999 ./data/postgres-data
$ sudo chown -R 999 ./data/postgres

Revert the volumes for the PostgreSQL in the docker-compose.yml file.

postgres:
	volumes:
		- ./data/postgres-data:/var/lib/postgresql/data
		- ./logs/postgres:/var/log/postgresql

To make the directory for the Solr into the container, we should rebuild the containers and run them.

$ sudo docker-compose up --build --force-recreate -d

Wait until launched. Open with the Web browse, now the sing in page will be appeared. If the basic authentication dialog is appeared, you should cancel it.

Open the share with the web browser. The URL is hostname/share/. For example, on may machine, it is http://doc.rkdev.corp/share/. Check the sign in page is appeared.

Share
Share

Get the UID of the data directory for the Solr

Go into the container for the Solr, and get the UID of the data directory. docker-compose_solr6_1 is a container name.

$ sudo docker exec -it docker-compose_solr6_1 sh

List up the contents of the /opt/alfresco-search-services which contains data directory. The directory path is written in the docker-compose.yml file. At this time, you need to make the PostgreSQL can execute.

$ ls -la /opt/alfresco-search-services

On my machine, it exported below and I see the user name is solr.

total 56
drwxr-xr-x 1 solr solr 4096 Nov 22 11:44 .
drwxr-xr-x 1 root root 4096 Aug 21 10:24 ..
drwxr-xr-x 5 solr solr 4096 Nov 22 08:22 data
drwxr-xr-x 2 root root 4096 Aug 21 10:25 keystores
drwxrwxr-x 1 solr solr 4096 Nov 22 11:44 logs
-rw-rw-r-- 1 solr solr 1328 Aug 21 10:11 README.MD
drwxr-xr-x 1 solr solr 4096 Aug 21 10:11 solr
drwxrwxr-x 6 solr solr 4096 Nov 22 08:22 solrhome
-rw-rw-r-- 1 solr solr 6764 Aug 21 10:11 solr.in.cmd
-rw-rw-r-- 1 solr solr 7366 Nov 22 11:44 solr.in.sh

Get the UID of the solr.

$ id -u solr

It exported below and I see the UID is 33007.

33007

Exit from the container and shutdown it.

$ exit
$ sudo docker-compose down

Change the UID of the directory for the Solr

Change the UID of the directory for the Solr.

$ sudo chown -R 33007 ./data/solr-data

Revert the docker-compose.yml file.

solr6:
	volumes:
		- ./data/solr-data:/opt/alfresco-search-services/data

Rebuild containers and run them.

$ sudo docker-compose up --build --force-recreate -d

Wait until launched, and check directories for the Solr were created successfully.

$ ls -la data/solr-data

On my machine, it exported below.

total 20
drwxr-xr-x 5 33007 root  4096 Nov 22 12:06 .
drwxr-xr-x 7 root  root  4096 Nov 22 07:59 ..
drwxr-xr-x 5 33007 33007 4096 Nov 22 12:06 alfresco
drwxr-xr-x 2 33007 33007 4096 Nov 22 12:07 alfrescoModels
drwxr-xr-x 5 33007 33007 4096 Nov 22 12:06 archive

Support Japanese in Office files

Alfresco can preview the contents of the office files such as Word, Excel and so on. However, Japanese characters cannot be displayed because Japanese fonts are missing. To support it, you need following:

  • Create the font folder out of the container, and mount it in the container.
  • Install Japanese fonts into the container for the LibreOffice.

Get the container name

Get the container name for the LibreOffice.

$ sudo docker ps

On my machine, it exported below.

  • IMAGE : alfresco/alfresco-libreoffice:2.1.0
  • NAMES : docker-compose_libreoffice_1

Get the directory path of the fonts

Go into the container.

$ sudo docker exec -it docker-compose\_libreoffice\_1 /bin/bash

List up the contents of the /opt directory, and look up the sub directory for the LibreOffice.

$ ls -la /opt

On my machine, it exported below.

total 12
drwxr-xr-x 1 root root 4096 Oct 28  2019 .
drwxr-xr-x 1 root root 4096 Nov 22 12:24 ..
drwxr-xr-x 7 root root 4096 May  3  2019 libreoffice6.1

I saw the directory is libreoffice6.1. Go down into it and look up the fonts directory. It is usually /opt/libreoffice6.1/share/fonts/truetype/, check fonts are available in it, and exit from the container.

$ ls -la /opt/libreoffice6.1/share/fonts/truetype
$ exit

Shutdown the container.

$ sudo docker-compose down

Create the font folder

Edit the docker-compose.yml file to configure following.

  • Add the libreoffice-fonts-data volume into the container for the libreoffice.
  • Map the libreoffice-fonts-data volume to the fonts directory out of the container.

Add lines from “# START” to “# END” to the docker-compose.yml file.

libreoffice:
        image: alfresco/alfresco-libreoffice:${TRANSFORM_ENGINE_TAG}
        mem_limit: 512m
        environment:
            JAVA_OPTS: " -Xms256m -Xmx512m"
        ports:
            - 8092:8090
# START
        volumes:
            - libreoffice-fonts-data:/opt/libreoffice6.1/share/fonts/truetype/
# END

# ...

# START
volumes:
    libreoffice-fonts-data:
        external: true
# END

Create the volume

Create the volume.

$ sudo docker volume create --name=libreoffice-fonts-data

Rebuild the container and run it

Rebuild the container and run it.

$ sudo docker-compose up --build --force-recreate -d

Install the fonts

Go into the container with root account, and install fonts.

$ sudo docker exec -it --user root docker-comopse_libreoffice_1 /bin/bash

$ yum install -y ipa-gothic-fonts ipa-pgothic-fonts

Copy installed fonts into the fonts directory for the Libreoffice.

$ cp /usr/share/fonts/ipa-gothic/ipag.ttf /opt/libreoffice6.1/share/fonts/truetype/

$ cp /usr/share/fonts/ipa-pgothic/ipagp.ttf /opt/libreoffice6.1/share/fonts/truetype/

Reboot the container

Reboot the container.

$ exit
$ sudo docker-compose down
$ sudo docker-compose up -d

Connect

Congratulation! Sign in with the default account admin. Password is admin too. I recommend the password of the admin and create the normal user at first time.

Sponsored Links
Get the Latest News !

ServerLatest 8 Posts