cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco 7.0, docker compose Trouble with alfresco-global properties and restoring content store

John1244
Champ on-the-rise
Champ on-the-rise

I have resently installed alfresco 7 usin docker compose and i am trying to restore the content store and content store deleted folders. I have found that i need to change the dir.root in alfresco global properties, but i have found a total of 4 alfresco global properties, 2 being blank and the other two saying:
#
# Disable load of sample site
#
sample.site.disabled=false

Secoundly besides the alfresco global properties I also have an issue with changing the volume in the docker-compose file when I do i get this error:

ERROR: The Compose file './docker-compose.yml' is invalid because:
Unsupported config option for services.volumes: 'volumes/data/alf-repo-data'
services.alfresco.environment.volumes contains ["./volumes/data/alf-repo-data:/usr/local/tomcat/alf_data"], which is an invalid type, it should be a string, number, or a null

Also this is what my docker-compose.yml file looks like:

# This docker-compose file will spin up an ACS cluster on a local host or on a server and it requires a minimum of 12GB Memory to distribute among containers.
# Limit container memory and assign X percentage to JVM. There are couple of ways to allocate JVM Memory for ACS Containers
# For example: 'JAVA_OPTS: "$JAVA_OPTS -XX:+PrintFlagsFinal -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"'
# See Oracle docs (https://docs.oracle.com/javase/9/gctuning/parallel-collector1.htm#JSGCT-GUID-CAB83393-3438-44ED-98F0...).
# If the container memory is not explicitly set then the flags above will set the max heap default to 1/4 of the container's memory, which may not be ideal.
# For performance tuning, assign the container memory and give a percentage of it to the JVM.

# Using version 2 as 3 does not support resource constraint options (cpu_*, mem_* limits) for non swarm mode in Compose
version: "2"

services:
alfresco:
image: alfresco/alfresco-content-repository-community:7.0.0
mem_limit: 1500m
environment:
JAVA_TOOL_OPTIONS: "
-Dencryption.keystore.type=JCEKS
-Dencryption.cipherAlgorithm=DESede/CBC/PKCS5Padding
-Dencryption.keyAlgorithm=DESede
-Dencryption.keystore.location=/usr/local/tomcat/shared/classes/alfresco/extension/keystore/keystore
-Dmetadata-keystore.password=mp6yc0UD9e
-Dmetadata-keystore.aliases=metadata
-Dmetadata-keystore.metadata.password=oKIWzVdEdA
-Dmetadata-keystore.metadata.algorithm=DESede
"
JAVA_OPTS: "
-Ddb.driver=org.postgresql.Driver
-Ddb.username=alfresco
-Ddb.password=alfresco
-Ddb.url=jdbcSmiley Tongueostgresql://postgres:5432/alfresco
-Dsolr.host=solr6
-Dsolr.port=8983
-Dsolr.http.connection.timeout=1000
-Dsolr.secureComms=none
-Dsolr.base.url=/solr
-Dindex.subsystem.name=solr6
-Dshare.host=127.0.0.1
-Dshare.port=8080
-Dalfresco.host=localhost
-Dalfresco.port=8080
-Daos.baseUrlOverwrite=http://localhost:8080/alfresco/aos
-Dmessaging.broker.url=\"failoverSmiley Sadnio://activemq:61616)?timeout=3000&jms.useCompression=true\"
-Ddeployment.method=DOCKER_COMPOSE
-DlocalTransform.core-aio.url=http://transform-core-aio:8090/
-Dcsrf.filter.enabled=false
-XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80
"
volumes:
- ./volumes/data/alf-repo-data:/usr/local/tomcat/alf_data


transform-core-aio:
image: alfresco/alfresco-transform-core-aio:2.3.10
mem_limit: 1536m
environment:
JAVA_OPTS: " -XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80"
ports:
- 8090:8090

share:
image: alfresco/alfresco-share:7.0.0
mem_limit: 1g
environment:
REPO_HOST: "alfresco"
REPO_PORT: "8080"
JAVA_OPTS: "
-XX:MinRAMPercentage=50
-XX:MaxRAMPercentage=80
-Dalfresco.host=localhost
-Dalfresco.port=8080
-Dalfresco.context=alfresco
-Dalfresco.protocol=http
"

postgres:
image: postgres:13.1
mem_limit: 512m
environment:
- POSTGRES_PASSWORD=alfresco
- POSTGRES_USER=alfresco
- POSTGRES_DB=alfresco
command: postgres -c max_connections=300 -c log_min_messages=LOG
ports:
- 5432:5432

solr6:
image: alfresco/alfresco-search-services:2.0.1
mem_limit: 2g
environment:
#Solr needs to know how to register itself with Alfresco
- SOLR_ALFRESCO_HOST=alfresco
- SOLR_ALFRESCO_PORT=8080
#Alfresco needs to know how to call solr
- SOLR_SOLR_HOST=solr6
- SOLR_SOLR_PORT=8983
#Create the default alfresco and archive cores
- SOLR_CREATE_ALFRESCO_DEFAULTS=alfresco,archive
#HTTP by default
- ALFRESCO_SECURE_COMMS=none
ports:
- 8083:8983 #Browser port

activemq:
image: alfresco/alfresco-activemq:5.16.1
mem_limit: 1g
ports:
- 8161:8161 # Web Console
- 5672:5672 # AMQP
- 61616:61616 # OpenWire
- 61613:61613 # STOMP

proxy:
image: alfresco/alfresco-acs-nginx:3.1.1
mem_limit: 128m
environment:
DISABLE_PROMETHEUS: "true"
DISABLE_SYNCSERVICE: "true"
DISABLE_ADW: "true"
depends_on:
- alfresco
ports:
- 8080:8080
links:
- alfresco
- share
volumes:
volumes/data/alf-repo-data:

1 ACCEPTED ANSWER

abhinavmishra14
World-Class Innovator
World-Class Innovator

@John1244 wrote:

I have resently installed alfresco 7 usin docker compose and i am trying to restore the content store and content store deleted folders. I have found that i need to change the dir.root in alfresco global properties, but i have found a total of 4 alfresco global properties, 2 being blank and the other two saying:
#
# Disable load of sample site
#
sample.site.disabled=false

Secoundly besides the alfresco global properties I also have an issue with changing the volume in the docker-compose file when I do i get this error:

ERROR: The Compose file './docker-compose.yml' is invalid because:
Unsupported config option for services.volumes: 'volumes/data/alf-repo-data'
services.alfresco.environment.volumes contains ["./volumes/data/alf-repo-data:/usr/local/tomcat/alf_data"], which is an invalid type, it should be a string, number, or a null

Also this is what my docker-compose.yml file looks like:

# This docker-compose file will spin up an ACS cluster on a local host or on a server and it requires a minimum of 12GB Memory to distribute among containers.
# Limit container memory and assign X percentage to JVM. There are couple of ways to allocate JVM Memory for ACS Containers
# For example: 'JAVA_OPTS: "$JAVA_OPTS -XX:+PrintFlagsFinal -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"'
# See Oracle docs (https://docs.oracle.com/javase/9/gctuning/parallel-collector1.htm#JSGCT-GUID-CAB83393-3438-44ED-98F0...).
# If the container memory is not explicitly set then the flags above will set the max heap default to 1/4 of the container's memory, which may not be ideal.
# For performance tuning, assign the container memory and give a percentage of it to the JVM.

# Using version 2 as 3 does not support resource constraint options (cpu_*, mem_* limits) for non swarm mode in Compose
version: "2"

services:
alfresco:
image: alfresco/alfresco-content-repository-community:7.0.0
mem_limit: 1500m
environment:
JAVA_TOOL_OPTIONS: "
-Dencryption.keystore.type=JCEKS
-Dencryption.cipherAlgorithm=DESede/CBC/PKCS5Padding
-Dencryption.keyAlgorithm=DESede
-Dencryption.keystore.location=/usr/local/tomcat/shared/classes/alfresco/extension/keystore/keystore
-Dmetadata-keystore.password=mp6yc0UD9e
-Dmetadata-keystore.aliases=metadata
-Dmetadata-keystore.metadata.password=oKIWzVdEdA
-Dmetadata-keystore.metadata.algorithm=DESede
"
JAVA_OPTS: "
-Ddb.driver=org.postgresql.Driver
-Ddb.username=alfresco
-Ddb.password=alfresco
-Ddb.url=jdbcSmiley Tongueostgresql://postgres:5432/alfresco
-Dsolr.host=solr6
-Dsolr.port=8983
-Dsolr.http.connection.timeout=1000
-Dsolr.secureComms=none
-Dsolr.base.url=/solr
-Dindex.subsystem.name=solr6
-Dshare.host=127.0.0.1
-Dshare.port=8080
-Dalfresco.host=localhost
-Dalfresco.port=8080
-Daos.baseUrlOverwrite=http://localhost:8080/alfresco/aos
-Dmessaging.broker.url=\"failoverSmiley Sadnio://activemq:61616)?timeout=3000&jms.useCompression=true\"
-Ddeployment.method=DOCKER_COMPOSE
-DlocalTransform.core-aio.url=http://transform-core-aio:8090/
-Dcsrf.filter.enabled=false
-XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80
"
volumes:
- ./volumes/data/alf-repo-data:/usr/local/tomcat/alf_data


transform-core-aio:
image: alfresco/alfresco-transform-core-aio:2.3.10
mem_limit: 1536m
environment:
JAVA_OPTS: " -XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80"
ports:
- 8090:8090

share:
image: alfresco/alfresco-share:7.0.0
mem_limit: 1g
environment:
REPO_HOST: "alfresco"
REPO_PORT: "8080"
JAVA_OPTS: "
-XX:MinRAMPercentage=50
-XX:MaxRAMPercentage=80
-Dalfresco.host=localhost
-Dalfresco.port=8080
-Dalfresco.context=alfresco
-Dalfresco.protocol=http
"

postgres:
image: postgres:13.1
mem_limit: 512m
environment:
- POSTGRES_PASSWORD=alfresco
- POSTGRES_USER=alfresco
- POSTGRES_DB=alfresco
command: postgres -c max_connections=300 -c log_min_messages=LOG
ports:
- 5432:5432

solr6:
image: alfresco/alfresco-search-services:2.0.1
mem_limit: 2g
environment:
#Solr needs to know how to register itself with Alfresco
- SOLR_ALFRESCO_HOST=alfresco
- SOLR_ALFRESCO_PORT=8080
#Alfresco needs to know how to call solr
- SOLR_SOLR_HOST=solr6
- SOLR_SOLR_PORT=8983
#Create the default alfresco and archive cores
- SOLR_CREATE_ALFRESCO_DEFAULTS=alfresco,archive
#HTTP by default
- ALFRESCO_SECURE_COMMS=none
ports:
- 8083:8983 #Browser port

activemq:
image: alfresco/alfresco-activemq:5.16.1
mem_limit: 1g
ports:
- 8161:8161 # Web Console
- 5672:5672 # AMQP
- 61616:61616 # OpenWire
- 61613:61613 # STOMP

proxy:
image: alfresco/alfresco-acs-nginx:3.1.1
mem_limit: 128m
environment:
DISABLE_PROMETHEUS: "true"
DISABLE_SYNCSERVICE: "true"
DISABLE_ADW: "true"
depends_on:
- alfresco
ports:
- 8080:8080
links:
- alfresco
- share
volumes:
volumes/data/alf-repo-data:


Checkout this post : https://hub.alfresco.com/t5/alfresco-content-services-blog/upgrading-from-alfresco-5-2-installer-to-... , It will give you some idea about upgrade if this is something you are looking towards.

I can see you need to put dir.root properties in JAVA_OPTS, as suggested by @cristinamr you can do it just like other properties you can see under the alfresco service. 

Syntax:

JAVA_OPTS: "

   -D[propertyName]=[propertyVal]

"

Here is an example, see in bold:

JAVA_OPTS: "
                -Ddir.root=./alf_data
		-Ddb.driver=org.postgresql.Driver
		-Ddb.username=alfresco
		-Ddb.password=alfresco
		-Ddb.url=jdbc:postgresql://postgres:5555/alfresco
		-Dsolr.host=solr6
		-Dsolr.port=9999
		-Dsolr.http.connection.timeout=1000
		-Dsolr.secureComms=none
		-Dsolr.base.url=/solr
		-Dindex.subsystem.name=solr6
		-Dshare.host=127.0.0.1
		-Dshare.port=7080
		-Dalfresco.host=localhost
		-Dalfresco.port=7080
		-Daos.baseUrlOverwrite=http://localhost:7080/alfresco/aos
		-Dmessaging.broker.url=\"failover:(nio://activemq:61616)?timeout=3000&jms.useCompression=true\"
		-Ddeployment.method=DOCKER_COMPOSE
		-DlocalTransform.core-aio.url=http://transform-core-aio:8090/
		-Dcsrf.filter.enabled=false                
		-XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80
		"

Second issue is that you seems to be using the bind mount but trying to declare volume in the docker-compose. 

This part is wrong at the end of the file:

volumes:
   volumes/data/alf-repo-data:

You don't need that when using bind mount. It is used for named volumes (can be external), and your syntax is also wrong. 

To use bind mount the syntax is like:

volumes:
          #Bind mount SHORT SYNTAX - [SOURCE:]TARGET[:MODE]
          #SOURCE can be a named volume or a (relative or absolute) path on the host system. 
          #TARGET is an absolute path in the container where the volume is mounted. 
          #MODE is a mount option which can be read-only (ro) or read-write (rw) (default).
# Example: ./data/alf_data:/usr/local/tomcat/alf_data/:rw - ./data/alf_data:/usr/local/tomcat/alf_data

For named volume syntax is:

At service level:

volumes:
          - alffresco-volume:/usr/local/tomcat/alf_data

--------------------------------------------------

At the end of all services:

# Named docker volumes top-level
# Docker compose external named volumes can be used across the Docker installation and 
# they need to be created by the user (otherwise fails) using the docker volume create command.
volumes:
  alffresco-volume:
    #If not sharing the volume yet, when plan to share volume between services, enable 'external'
    #external: true

For more details read : https://docs.docker.com/compose/compose-file/compose-file-v2/

Here is an example of docker-compose with the above stated details:

# Using version 2 as 3 does not support resource constraint options (cpu_*, mem_* limits) for non swarm mode in Compose
version: "2"

services:
    alfresco:
        image: alfresco/alfresco-content-repository-community:7.0.0
        mem_limit: 1500m
        environment:
            JAVA_TOOL_OPTIONS: "
                -Dencryption.keystore.type=JCEKS
                -Dencryption.cipherAlgorithm=DESede/CBC/PKCS5Padding
                -Dencryption.keyAlgorithm=DESede
                -Dencryption.keystore.location=/usr/local/tomcat/shared/classes/alfresco/extension/keystore/keystore
                -Dmetadata-keystore.password=mp6yc0UD9e
                -Dmetadata-keystore.aliases=metadata
                -Dmetadata-keystore.metadata.password=oKIWzVdEdA
                -Dmetadata-keystore.metadata.algorithm=DESede
                "
            JAVA_OPTS: "
		-Ddir.root=./alf_data
                -Ddb.driver=org.postgresql.Driver
                -Ddb.username=alfresco
                -Ddb.password=alfresco
                -Ddb.url=jdbc:postgresql://postgres:5432/alfresco
                -Dsolr.host=solr6
                -Dsolr.port=8983
                -Dsolr.http.connection.timeout=1000
                -Dsolr.secureComms=none
                -Dsolr.base.url=/solr
                -Dindex.subsystem.name=solr6
                -Dshare.host=127.0.0.1
                -Dshare.port=8080
                -Dalfresco.host=localhost
                -Dalfresco.port=8080
                -Daos.baseUrlOverwrite=http://localhost:8080/alfresco/aos
                -Dmessaging.broker.url=\"failover:(nio://activemq:61616)?timeout=3000&jms.useCompression=true\"
                -Ddeployment.method=DOCKER_COMPOSE
                -DlocalTransform.core-aio.url=http://transform-core-aio:8090/
                -Dcsrf.filter.enabled=false
                -XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80
                "
	volumes:
          #Bind mount SHORT SYNTAX - [SOURCE:]TARGET[:MODE]
          #SOURCE can be a named volume or a (relative or absolute) path on the host system. 
          #TARGET is an absolute path in the container where the volume is mounted. 
          #MODE is a mount option which can be read-only (ro) or read-write (rw) (default).
          #Example: ./data/alfresco/alf_data:/usr/local/tomcat/alf_data/:rw
          - ./data/alfresco/alf_data:/usr/local/tomcat/alf_data

    transform-core-aio:
        image: alfresco/alfresco-transform-core-aio:2.3.10
        mem_limit: 1536m
        environment:
            JAVA_OPTS: " -XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80"
        ports:
            - 8090:8090

    share:
        image: alfresco/alfresco-share:7.0.0
        mem_limit: 1g
        environment:
            REPO_HOST: "alfresco"
            REPO_PORT: "8080"
            JAVA_OPTS: "
                -XX:MinRAMPercentage=50
                -XX:MaxRAMPercentage=80
                -Dalfresco.host=localhost
                -Dalfresco.port=8080
                -Dalfresco.context=alfresco
                -Dalfresco.protocol=http
                "

    postgres:
        image: postgres:13.1
        mem_limit: 512m
        environment:
            - POSTGRES_PASSWORD=alfresco
            - POSTGRES_USER=alfresco
            - POSTGRES_DB=alfresco
        command: postgres -c max_connections=300 -c log_min_messages=LOG
        ports:
            - 5432:5432

    solr6:
        image: alfresco/alfresco-search-services:2.0.1
        mem_limit: 2g
        environment:
            #Solr needs to know how to register itself with Alfresco
            - SOLR_ALFRESCO_HOST=alfresco
            - SOLR_ALFRESCO_PORT=8080
            #Alfresco needs to know how to call solr
            - SOLR_SOLR_HOST=solr6
            - SOLR_SOLR_PORT=8983
            #Create the default alfresco and archive cores
            - SOLR_CREATE_ALFRESCO_DEFAULTS=alfresco,archive
            #HTTP by default
            - ALFRESCO_SECURE_COMMS=none
        ports:
            - 8083:8983 #Browser port

    activemq:
        image: alfresco/alfresco-activemq:5.16.1
        mem_limit: 1g
        ports:
            - 8161:8161 # Web Console
            - 5672:5672 # AMQP
            - 61616:61616 # OpenWire
            - 61613:61613 # STOMP

    proxy:
        image: alfresco/alfresco-acs-nginx:3.1.1
        mem_limit: 128m
        environment:
            DISABLE_PROMETHEUS: "true"
            DISABLE_SYNCSERVICE: "true"
            DISABLE_ADW: "true"
        depends_on:
            - alfresco
        ports:
            - 8080:8080
        links:
            - alfresco
            - share
~Abhinav
(ACSCE, AWS SAA, Azure Admin)

View answer in original post

9 REPLIES 9

cristinamr
World-Class Innovator
World-Class Innovator

Hi @John1244 

If you are moving only alf_data to another server but not your database, without the old database new instance won't work.

Ideally, to migrate Alfresco you should take the backup of the followings

1. Alfresco database

2. alf_data

3. indexes

4. customization and configurations you have made

You can then restore the backup into new Alfresco instance.

BTW, instead of use alfresco-global.properties is better to use docker-compose.yml inside of JAVA_OPTS block.

Please let us know if you have further questions.

Cheers,

Cris

--
VenziaIT: helping companies since 2005! Our ECM products: AQuA & Seidoc

Okay so if I want to restore the content store I first need to restore the database backup. (As for cuztomizations, don't think there were any, same for indexes).

you also mentioned to use java_opts in the docker-compse file instead of alfresco-global properties, but how exactly do i do that is it the samething just typing : dir.root=/usr/local/tomcat/alf_data  
or something else, can u be specific please.

I also still don't know what this error is what does it mean, I get it when i try to import volumes in the docker-compose file:
ERROR: The Compose file './docker-compose.yml' is invalid because:
Unsupported config option for services.volumes: 'volumes/data/alf-repo-data'
services.alfresco.environment.volumes contains ["./volumes/data/alf-repo-data:/usr/local/tomcat/alf_data"], which is an invalid type, it should be a string, number, or a null

Thank you in advance and have a nice day.

abhinavmishra14
World-Class Innovator
World-Class Innovator

@John1244 wrote:

I have resently installed alfresco 7 usin docker compose and i am trying to restore the content store and content store deleted folders. I have found that i need to change the dir.root in alfresco global properties, but i have found a total of 4 alfresco global properties, 2 being blank and the other two saying:
#
# Disable load of sample site
#
sample.site.disabled=false

Secoundly besides the alfresco global properties I also have an issue with changing the volume in the docker-compose file when I do i get this error:

ERROR: The Compose file './docker-compose.yml' is invalid because:
Unsupported config option for services.volumes: 'volumes/data/alf-repo-data'
services.alfresco.environment.volumes contains ["./volumes/data/alf-repo-data:/usr/local/tomcat/alf_data"], which is an invalid type, it should be a string, number, or a null

Also this is what my docker-compose.yml file looks like:

# This docker-compose file will spin up an ACS cluster on a local host or on a server and it requires a minimum of 12GB Memory to distribute among containers.
# Limit container memory and assign X percentage to JVM. There are couple of ways to allocate JVM Memory for ACS Containers
# For example: 'JAVA_OPTS: "$JAVA_OPTS -XX:+PrintFlagsFinal -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"'
# See Oracle docs (https://docs.oracle.com/javase/9/gctuning/parallel-collector1.htm#JSGCT-GUID-CAB83393-3438-44ED-98F0...).
# If the container memory is not explicitly set then the flags above will set the max heap default to 1/4 of the container's memory, which may not be ideal.
# For performance tuning, assign the container memory and give a percentage of it to the JVM.

# Using version 2 as 3 does not support resource constraint options (cpu_*, mem_* limits) for non swarm mode in Compose
version: "2"

services:
alfresco:
image: alfresco/alfresco-content-repository-community:7.0.0
mem_limit: 1500m
environment:
JAVA_TOOL_OPTIONS: "
-Dencryption.keystore.type=JCEKS
-Dencryption.cipherAlgorithm=DESede/CBC/PKCS5Padding
-Dencryption.keyAlgorithm=DESede
-Dencryption.keystore.location=/usr/local/tomcat/shared/classes/alfresco/extension/keystore/keystore
-Dmetadata-keystore.password=mp6yc0UD9e
-Dmetadata-keystore.aliases=metadata
-Dmetadata-keystore.metadata.password=oKIWzVdEdA
-Dmetadata-keystore.metadata.algorithm=DESede
"
JAVA_OPTS: "
-Ddb.driver=org.postgresql.Driver
-Ddb.username=alfresco
-Ddb.password=alfresco
-Ddb.url=jdbcSmiley Tongueostgresql://postgres:5432/alfresco
-Dsolr.host=solr6
-Dsolr.port=8983
-Dsolr.http.connection.timeout=1000
-Dsolr.secureComms=none
-Dsolr.base.url=/solr
-Dindex.subsystem.name=solr6
-Dshare.host=127.0.0.1
-Dshare.port=8080
-Dalfresco.host=localhost
-Dalfresco.port=8080
-Daos.baseUrlOverwrite=http://localhost:8080/alfresco/aos
-Dmessaging.broker.url=\"failoverSmiley Sadnio://activemq:61616)?timeout=3000&jms.useCompression=true\"
-Ddeployment.method=DOCKER_COMPOSE
-DlocalTransform.core-aio.url=http://transform-core-aio:8090/
-Dcsrf.filter.enabled=false
-XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80
"
volumes:
- ./volumes/data/alf-repo-data:/usr/local/tomcat/alf_data


transform-core-aio:
image: alfresco/alfresco-transform-core-aio:2.3.10
mem_limit: 1536m
environment:
JAVA_OPTS: " -XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80"
ports:
- 8090:8090

share:
image: alfresco/alfresco-share:7.0.0
mem_limit: 1g
environment:
REPO_HOST: "alfresco"
REPO_PORT: "8080"
JAVA_OPTS: "
-XX:MinRAMPercentage=50
-XX:MaxRAMPercentage=80
-Dalfresco.host=localhost
-Dalfresco.port=8080
-Dalfresco.context=alfresco
-Dalfresco.protocol=http
"

postgres:
image: postgres:13.1
mem_limit: 512m
environment:
- POSTGRES_PASSWORD=alfresco
- POSTGRES_USER=alfresco
- POSTGRES_DB=alfresco
command: postgres -c max_connections=300 -c log_min_messages=LOG
ports:
- 5432:5432

solr6:
image: alfresco/alfresco-search-services:2.0.1
mem_limit: 2g
environment:
#Solr needs to know how to register itself with Alfresco
- SOLR_ALFRESCO_HOST=alfresco
- SOLR_ALFRESCO_PORT=8080
#Alfresco needs to know how to call solr
- SOLR_SOLR_HOST=solr6
- SOLR_SOLR_PORT=8983
#Create the default alfresco and archive cores
- SOLR_CREATE_ALFRESCO_DEFAULTS=alfresco,archive
#HTTP by default
- ALFRESCO_SECURE_COMMS=none
ports:
- 8083:8983 #Browser port

activemq:
image: alfresco/alfresco-activemq:5.16.1
mem_limit: 1g
ports:
- 8161:8161 # Web Console
- 5672:5672 # AMQP
- 61616:61616 # OpenWire
- 61613:61613 # STOMP

proxy:
image: alfresco/alfresco-acs-nginx:3.1.1
mem_limit: 128m
environment:
DISABLE_PROMETHEUS: "true"
DISABLE_SYNCSERVICE: "true"
DISABLE_ADW: "true"
depends_on:
- alfresco
ports:
- 8080:8080
links:
- alfresco
- share
volumes:
volumes/data/alf-repo-data:


Checkout this post : https://hub.alfresco.com/t5/alfresco-content-services-blog/upgrading-from-alfresco-5-2-installer-to-... , It will give you some idea about upgrade if this is something you are looking towards.

I can see you need to put dir.root properties in JAVA_OPTS, as suggested by @cristinamr you can do it just like other properties you can see under the alfresco service. 

Syntax:

JAVA_OPTS: "

   -D[propertyName]=[propertyVal]

"

Here is an example, see in bold:

JAVA_OPTS: "
                -Ddir.root=./alf_data
		-Ddb.driver=org.postgresql.Driver
		-Ddb.username=alfresco
		-Ddb.password=alfresco
		-Ddb.url=jdbc:postgresql://postgres:5555/alfresco
		-Dsolr.host=solr6
		-Dsolr.port=9999
		-Dsolr.http.connection.timeout=1000
		-Dsolr.secureComms=none
		-Dsolr.base.url=/solr
		-Dindex.subsystem.name=solr6
		-Dshare.host=127.0.0.1
		-Dshare.port=7080
		-Dalfresco.host=localhost
		-Dalfresco.port=7080
		-Daos.baseUrlOverwrite=http://localhost:7080/alfresco/aos
		-Dmessaging.broker.url=\"failover:(nio://activemq:61616)?timeout=3000&jms.useCompression=true\"
		-Ddeployment.method=DOCKER_COMPOSE
		-DlocalTransform.core-aio.url=http://transform-core-aio:8090/
		-Dcsrf.filter.enabled=false                
		-XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80
		"

Second issue is that you seems to be using the bind mount but trying to declare volume in the docker-compose. 

This part is wrong at the end of the file:

volumes:
   volumes/data/alf-repo-data:

You don't need that when using bind mount. It is used for named volumes (can be external), and your syntax is also wrong. 

To use bind mount the syntax is like:

volumes:
          #Bind mount SHORT SYNTAX - [SOURCE:]TARGET[:MODE]
          #SOURCE can be a named volume or a (relative or absolute) path on the host system. 
          #TARGET is an absolute path in the container where the volume is mounted. 
          #MODE is a mount option which can be read-only (ro) or read-write (rw) (default).
# Example: ./data/alf_data:/usr/local/tomcat/alf_data/:rw - ./data/alf_data:/usr/local/tomcat/alf_data

For named volume syntax is:

At service level:

volumes:
          - alffresco-volume:/usr/local/tomcat/alf_data

--------------------------------------------------

At the end of all services:

# Named docker volumes top-level
# Docker compose external named volumes can be used across the Docker installation and 
# they need to be created by the user (otherwise fails) using the docker volume create command.
volumes:
  alffresco-volume:
    #If not sharing the volume yet, when plan to share volume between services, enable 'external'
    #external: true

For more details read : https://docs.docker.com/compose/compose-file/compose-file-v2/

Here is an example of docker-compose with the above stated details:

# Using version 2 as 3 does not support resource constraint options (cpu_*, mem_* limits) for non swarm mode in Compose
version: "2"

services:
    alfresco:
        image: alfresco/alfresco-content-repository-community:7.0.0
        mem_limit: 1500m
        environment:
            JAVA_TOOL_OPTIONS: "
                -Dencryption.keystore.type=JCEKS
                -Dencryption.cipherAlgorithm=DESede/CBC/PKCS5Padding
                -Dencryption.keyAlgorithm=DESede
                -Dencryption.keystore.location=/usr/local/tomcat/shared/classes/alfresco/extension/keystore/keystore
                -Dmetadata-keystore.password=mp6yc0UD9e
                -Dmetadata-keystore.aliases=metadata
                -Dmetadata-keystore.metadata.password=oKIWzVdEdA
                -Dmetadata-keystore.metadata.algorithm=DESede
                "
            JAVA_OPTS: "
		-Ddir.root=./alf_data
                -Ddb.driver=org.postgresql.Driver
                -Ddb.username=alfresco
                -Ddb.password=alfresco
                -Ddb.url=jdbc:postgresql://postgres:5432/alfresco
                -Dsolr.host=solr6
                -Dsolr.port=8983
                -Dsolr.http.connection.timeout=1000
                -Dsolr.secureComms=none
                -Dsolr.base.url=/solr
                -Dindex.subsystem.name=solr6
                -Dshare.host=127.0.0.1
                -Dshare.port=8080
                -Dalfresco.host=localhost
                -Dalfresco.port=8080
                -Daos.baseUrlOverwrite=http://localhost:8080/alfresco/aos
                -Dmessaging.broker.url=\"failover:(nio://activemq:61616)?timeout=3000&jms.useCompression=true\"
                -Ddeployment.method=DOCKER_COMPOSE
                -DlocalTransform.core-aio.url=http://transform-core-aio:8090/
                -Dcsrf.filter.enabled=false
                -XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80
                "
	volumes:
          #Bind mount SHORT SYNTAX - [SOURCE:]TARGET[:MODE]
          #SOURCE can be a named volume or a (relative or absolute) path on the host system. 
          #TARGET is an absolute path in the container where the volume is mounted. 
          #MODE is a mount option which can be read-only (ro) or read-write (rw) (default).
          #Example: ./data/alfresco/alf_data:/usr/local/tomcat/alf_data/:rw
          - ./data/alfresco/alf_data:/usr/local/tomcat/alf_data

    transform-core-aio:
        image: alfresco/alfresco-transform-core-aio:2.3.10
        mem_limit: 1536m
        environment:
            JAVA_OPTS: " -XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80"
        ports:
            - 8090:8090

    share:
        image: alfresco/alfresco-share:7.0.0
        mem_limit: 1g
        environment:
            REPO_HOST: "alfresco"
            REPO_PORT: "8080"
            JAVA_OPTS: "
                -XX:MinRAMPercentage=50
                -XX:MaxRAMPercentage=80
                -Dalfresco.host=localhost
                -Dalfresco.port=8080
                -Dalfresco.context=alfresco
                -Dalfresco.protocol=http
                "

    postgres:
        image: postgres:13.1
        mem_limit: 512m
        environment:
            - POSTGRES_PASSWORD=alfresco
            - POSTGRES_USER=alfresco
            - POSTGRES_DB=alfresco
        command: postgres -c max_connections=300 -c log_min_messages=LOG
        ports:
            - 5432:5432

    solr6:
        image: alfresco/alfresco-search-services:2.0.1
        mem_limit: 2g
        environment:
            #Solr needs to know how to register itself with Alfresco
            - SOLR_ALFRESCO_HOST=alfresco
            - SOLR_ALFRESCO_PORT=8080
            #Alfresco needs to know how to call solr
            - SOLR_SOLR_HOST=solr6
            - SOLR_SOLR_PORT=8983
            #Create the default alfresco and archive cores
            - SOLR_CREATE_ALFRESCO_DEFAULTS=alfresco,archive
            #HTTP by default
            - ALFRESCO_SECURE_COMMS=none
        ports:
            - 8083:8983 #Browser port

    activemq:
        image: alfresco/alfresco-activemq:5.16.1
        mem_limit: 1g
        ports:
            - 8161:8161 # Web Console
            - 5672:5672 # AMQP
            - 61616:61616 # OpenWire
            - 61613:61613 # STOMP

    proxy:
        image: alfresco/alfresco-acs-nginx:3.1.1
        mem_limit: 128m
        environment:
            DISABLE_PROMETHEUS: "true"
            DISABLE_SYNCSERVICE: "true"
            DISABLE_ADW: "true"
        depends_on:
            - alfresco
        ports:
            - 8080:8080
        links:
            - alfresco
            - share
~Abhinav
(ACSCE, AWS SAA, Azure Admin)

Thank you for all the help but if i forget my admin user and password how do i restet it.


@John1244 wrote:

Thank you for all the help but if i forget my admin user and password how do i restet it.


By default the username is "admin" and password is also "admin" unless you have changed it. If you have changed the password  and you have db access, follow the steps outlined here: http://keytocontent.blogspot.com/2011/09/resetting-forgotten-alfresco-admin.html

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

Sorry but do u know one for postgreSQL.


@John1244 wrote:

Sorry but do u know one for postgreSQL.


The queries given in the blogpost should work for any database used for alfresco. Just try running following queries in Postgresql query tool or psql terminal. It should set the password for admin user back to 'admin'.

SELECT anp1.node_id,
       anp1.qname_id,
       anp1.string_value as hash_pass,
       anp2.string_value as user_string
FROM alf_node_properties anp1
        INNER JOIN alf_qname aq1
           ON aq1.id       = anp1.qname_id
        INNER JOIN alf_node_properties anp2 
           ON anp2.node_id = anp1.node_id
        INNER JOIN alf_qname aq2            
           ON aq2.id       = anp2.qname_id
WHERE aq1.local_name    = 'password'
AND aq2.local_name    = 'username';
UPDATE alf_node_properties 
 SET string_value='209c6174da490caeb422f3fa5a7ae634'
 WHERE 
 node_id=4
 and
 qname_id=10
~Abhinav
(ACSCE, AWS SAA, Azure Admin)

If you are not aware on how to connect to postgres docker container, here are the steps:

1- Open command promot/power shell or terminal (whatever you are using) and type following command:

docker exec -it <nameOrIdOfContainer> /bin/bash

example:

docker exec -it postgres /bin/bash

or

docker exec -it 048 /bin/bash
Where name of the container is: postgres
and container id: 0482bf706a57

If you are not sure how to get the container name of container id, then first execute the following commands before step 1 above:

docker ps 

Output example:
https://hub.alfresco.com/t5/image/serverpage/image-id/1037i5D397466386337DB/image-size/large?v=v2&px=999

Based on output look for the container name or id (usually first 3 letters are enough to use).

2- After connecting to shell, execute the following, this will open the psql terminal for you to execute the sql queries:

root@0482bf706a57:/# psql -U alfresco

3- Execute the queries given above.

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

Hi @John1244 

Thanks for accepting this solution - helps other users to know it helped.

Cheers,

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