How to run alfresco and share containers in a specific time zone

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

How to run alfresco and share containers in a specific time zone

Jump to solution

Hi

my alfresco and share containers running by default in GMT. Which is causing some timestamp specific custom jobs run at wrong timings that required time. 

how can i make it running in ET zone?

2 Solutions

Accepted Solutions
Highlighted
Advanced

Re: How to run alfresco and share containers in a specific time zone

Jump to solution
you can set the time zone in your host machine then you can map your local time to the container through volume mapping. Like this,
 volumes: 
   - /etc/localtime:/etc/localtime 

View solution in original post

Highlighted
Moderator
Moderator

Re: How to run alfresco and share containers in a specific time zone

Jump to solution

So there are two things. One- synchronize the time/timezone etc. with host machine to containers. Two - Set the timezone for containers. In the first case, whatever time/timezone is set on host machine, it will be synchronized to containers. 

In second case, you can use different timezone on host machine but can set a specific time zone for containers. 

In case of synchronization, we bind mount host machine's localtime file. Which is true for linux but for windows it may not work. 

In case of setting time zone, it is independent of host machine, whether it is windows or linux. 

Try below settings and see if it works for you on "developer system" and "ubuntu dev server" both as reported by you.

For EDT timezone:

environment:
            TZ: "America/New_York"

or
environment: - TZ=America/New_York

A service level example:

alfresco:
        build:
          dockerfile: ./Dockerfile
          context: ./configs-to-override/alfresco
        mem_limit: 8g
        environment:
            JAVA_OPTS: "
                -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.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/
                -Dalfresco-pdf-renderer.url=http://transform-core-aio:8090/
                -Djodconverter.url=http://transform-core-aio:8090/
                -Dimg.url=http://transform-core-aio:8090/
                -Dtika.url=http://transform-core-aio:8090/
                -Dtransform.misc.url=http://transform-core-aio:8090/
                -Dcsrf.filter.enabled=false
                -Xms8g -Xmx8g
                "
         TZ: "America/New_York"
	 volumes:
	    - ./alfresco/alf_data:/usr/local/tomcat/alf_data

Second e.g.

postgres:
        image: postgres:11.7
        mem_limit: 1g
        environment:
            - POSTGRES_PASSWORD=alfresco
            - POSTGRES_USER=alfresco
            - POSTGRES_DB=alfresco
            - TZ=America/New_York
        command: postgres -c max_connections=300 -c log_min_messages=LOG
        ports:
            - 5432:5432
	volumes:
            - ./postgres/data:/var/lib/postgresql/data

 

~Abhinav
(ACSCE, AWS SAA-C02, GAIQ)

View solution in original post

11 Replies
Highlighted
Advanced

Re: How to run alfresco and share containers in a specific time zone

Jump to solution
you can set the time zone in your host machine then you can map your local time to the container through volume mapping. Like this,
 volumes: 
   - /etc/localtime:/etc/localtime 

View solution in original post

Highlighted
Active Member II

Re: How to run alfresco and share containers in a specific time zone

Jump to solution

Tx @kaynezhang , I tried adding the instructions in docker compose for acs service. And when i launching containers, acs is failing without any trace of errors. in docker ps result i am not seeing acs. Not seeing any log why failing. when i am removing the instructions, it is starting fine.

I try on our ubuntu dev server. I will update results

Highlighted
Advanced

Re: How to run alfresco and share containers in a specific time zone

Jump to solution

There maybe something wrong with your docker compose file ,please paste it here

Highlighted
Active Member II

Re: How to run alfresco and share containers in a specific time zone

Jump to solution

hi @kaynezhang 

So when tried on ubuntu server it worked but not working on developer system. We are using docker desktop on developer system.

find the compose file :

services:
    alfresco:
        build:
          dockerfile: ./Dockerfile
          context: ./configs-to-override/alfresco
        mem_limit: 8g
        environment:
            JAVA_OPTS: "
                -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.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/
                -Dalfresco-pdf-renderer.url=http://transform-core-aio:8090/
                -Djodconverter.url=http://transform-core-aio:8090/
                -Dimg.url=http://transform-core-aio:8090/
                -Dtika.url=http://transform-core-aio:8090/
                -Dtransform.misc.url=http://transform-core-aio:8090/
                -Dcsrf.filter.enabled=false
                -Xms8g -Xmx8g
                "
	 volumes:
	    - ./alfresco/alf_data:/usr/local/tomcat/alf_data
            - /etc/localtime:/etc/localtime

    transform-core-aio:
        image: alfresco/alfresco-transform-core-aio:2.3.4
        mem_limit: 1536m
        environment:
            JAVA_OPTS: " -Xms256m -Xmx1536m"
        ports:
            - 8090:8090

    share:
        build:
          dockerfile: ./Dockerfile
          context: ./configs-to-override/share
        mem_limit: 2g
        environment:
            REPO_HOST: "alfresco"
            REPO_PORT: "7080"
            JAVA_OPTS: "
                -Xms2g
                -Xmx2g
                -Dalfresco.host=localhost
                -Dalfresco.port=7080
                -Dalfresco.context=alfresco
                -Dalfresco.protocol=http
                "

    postgres:
        image: postgres:11.7
        mem_limit: 1g
        environment:
            - POSTGRES_PASSWORD=alfresco
            - POSTGRES_USER=alfresco
            - POSTGRES_DB=alfresco
        command: postgres -c max_connections=300 -c log_min_messages=LOG
        ports:
            - 5432:5432
	volumes:
            - ./postgres/data:/var/lib/postgresql/data

    solr6:
        image: alfresco/alfresco-search-services:1.4.2.2
        mem_limit: 2g
        environment:
            #Solr needs to know how to register itself with Alfresco
            - SOLR_ALFRESCO_HOST=alfresco
            - SOLR_ALFRESCO_PORT=7080
            #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
            - "SOLR_JAVA_MEM=-Xms2g -Xmx2g"
        ports:
            - 8083:8983 #Browser port
	volumes:
	    - ./solr6/contentstore:/opt/alfresco-search-services/contentstore
            - ./solr6/data:/opt/alfresco-search-services/data

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

    proxy:
        build:
          dockerfile: ./Dockerfile
          context: ./configs-to-override/proxy
        mem_limit: 256m
        depends_on:
            - alfresco
        ports:
            - 7080:7080
        links:
            - alfresco
            - share
Highlighted
Advanced

Re: How to run alfresco and share containers in a specific time zone

Jump to solution

I am not sure what you mean by  not working on developer system, what is your developer system environment?

Highlighted
Active Member II

Re: How to run alfresco and share containers in a specific time zone

Jump to solution

i mean to say developer system is using docker desktop on windows. It is still not working. Shared the compose file above. Working fine on ubuntu dev server.

Highlighted
Advanced

Re: How to run alfresco and share containers in a specific time zone

Jump to solution

It  dose not work on windows because there is no /etc/timezone on Windows

Highlighted
Moderator
Moderator

Re: How to run alfresco and share containers in a specific time zone

Jump to solution

So there are two things. One- synchronize the time/timezone etc. with host machine to containers. Two - Set the timezone for containers. In the first case, whatever time/timezone is set on host machine, it will be synchronized to containers. 

In second case, you can use different timezone on host machine but can set a specific time zone for containers. 

In case of synchronization, we bind mount host machine's localtime file. Which is true for linux but for windows it may not work. 

In case of setting time zone, it is independent of host machine, whether it is windows or linux. 

Try below settings and see if it works for you on "developer system" and "ubuntu dev server" both as reported by you.

For EDT timezone:

environment:
            TZ: "America/New_York"

or
environment: - TZ=America/New_York

A service level example:

alfresco:
        build:
          dockerfile: ./Dockerfile
          context: ./configs-to-override/alfresco
        mem_limit: 8g
        environment:
            JAVA_OPTS: "
                -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.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/
                -Dalfresco-pdf-renderer.url=http://transform-core-aio:8090/
                -Djodconverter.url=http://transform-core-aio:8090/
                -Dimg.url=http://transform-core-aio:8090/
                -Dtika.url=http://transform-core-aio:8090/
                -Dtransform.misc.url=http://transform-core-aio:8090/
                -Dcsrf.filter.enabled=false
                -Xms8g -Xmx8g
                "
         TZ: "America/New_York"
	 volumes:
	    - ./alfresco/alf_data:/usr/local/tomcat/alf_data

Second e.g.

postgres:
        image: postgres:11.7
        mem_limit: 1g
        environment:
            - POSTGRES_PASSWORD=alfresco
            - POSTGRES_USER=alfresco
            - POSTGRES_DB=alfresco
            - TZ=America/New_York
        command: postgres -c max_connections=300 -c log_min_messages=LOG
        ports:
            - 5432:5432
	volumes:
            - ./postgres/data:/var/lib/postgresql/data

 

~Abhinav
(ACSCE, AWS SAA-C02, GAIQ)

View solution in original post

Highlighted
Active Member II

Re: How to run alfresco and share containers in a specific time zone

Jump to solution

Worked!! I tried today on developer system docker desktop and ubuntu dev sever both. 

@abhinavmishra14 Thnx for great explanation.