cancel
Showing results for 
Search instead for 
Did you mean: 

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

venur
Star Contributor
Star Contributor

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 ACCEPTED ANSWERS

kaynezhang
World-Class Innovator
World-Class Innovator
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 answer in original post

abhinavmishra14
World-Class Innovator
World-Class Innovator

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, Azure Admin)

View answer in original post

11 REPLIES 11

kaynezhang
World-Class Innovator
World-Class Innovator

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

venur
Star Contributor
Star Contributor

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.

kaynezhang
World-Class Innovator
World-Class Innovator

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

abhinavmishra14
World-Class Innovator
World-Class Innovator

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, Azure Admin)

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

@abhinavmishra14 Thnx for great explanation.