Session Timeout

cancel
Showing results for 
Search instead for 
Did you mean: 
sanjaybandhniya
Intermediate

Session Timeout

Jump to solution

How Can I Increase/Decrease session timeout in docker environment?

1 Solution

Accepted Solutions
abhinavmishra14
Advanced

Re: Session Timeout

Jump to solution

Timeouts can be set for tickets and overall container session. 

If you are looking for increasing/decreasing alfresco alf_ticket timeout then refer following properties:

# Do authentication tickets expire or live for ever?
authentication.ticket.ticketsExpire=true
# If ticketsEpire is true then how they should expire?
# Valid values are: AFTER_INACTIVITY, AFTER_FIXED_TIME, DO_NOT_EXPIRE
# The default is AFTER_FIXED_TIME
authentication.ticket.expiryMode=AFTER_INACTIVITY
# If authentication.ticket.ticketsExpire is true and
# authentication.ticket.expiryMode is AFTER_FIXED_TIME or AFTER_INACTIVITY,
# this controls the minimum period for which tickets are valid. 
# The default is PT1H for one hour.
authentication.ticket.validDuration=PT1H

These properties can be passed as follows: 

ervices:
  alfresco:
    image: alfresco/alfresco-content-repository-community:7.2.0
    mem_limit: 2g
    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=jdbc:postgresql://postgres:5432/alfresco
        -Dsolr.host=solr6
        -Dsolr.port=8983
        -Dsolr.http.connection.timeout=1000
        -Dsolr.secureComms=secret
        -Dsolr.sharedSecret=secret
        -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
	-Dauthentication.ticket.ticketsExpire=true
	-Dauthentication.ticket.expiryMode=AFTER_INACTIVITY
	-Dauthentication.ticket.validDuration=PT1H
        -XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80
        "

If you are looking to set the timeout at servlet container level, you need to set the following:

[For example Share] tomcat\webapps\share\WEB-INF\web.xml 

<session-config>
<!-- default --> <session-timeout>60</session-timeout> </session-config>

In dockerized environment, if you have to add above config then you need to use combination of DockerFile and docker-compose.yml. for example:

ARG SHARE_TAG

FROM alfresco/alfresco-share:${SHARE_TAG}

ARG TOMCAT_DIR=/usr/local/tomcat

# In base image it tries to write logs at root directory which requires 'root' user access.
RUN sed -i "s|log4j.appender.File.File\=share.log|log4j.appender.File.File\=logs/share.log |g" $TOMCAT_DIR/webapps/share/WEB-INF/classes/log4j.properties ;

# Update session timeout config from default 60 minutes to 30 minutes:
RUN sed -i 's@<session-timeout>60</session-timeout>@<session-timeout>30</session-timeout>@' \
	$TOMCAT_DIR/webapps/share/WEB-INF/web.xml

# Copy and apply amp add-ons
COPY Dockerfile add-ons/*.amp $TOMCAT_DIR/amps_share/
RUN java -jar $TOMCAT_DIR/alfresco-mmt/alfresco-mmt*.jar install \
              $TOMCAT_DIR/amps_share $TOMCAT_DIR/webapps/share -directory -nobackup -force
			  
#TODO:: Add more steps as needed
 share:
        build:
          dockerfile: ./Dockerfile
          context: ./configs-to-override/share
          args:
            SHARE_TAG: ${SHARE_TAG}
        mem_limit: 2g
        environment:
            REPO_HOST: "alfresco"
            REPO_PORT: "7080"
            JAVA_OPTS: "
                -XX:MinRAMPercentage=50
                -XX:MaxRAMPercentage=80
                -Dalfresco.host=localhost
                -Dalfresco.port=7080
                -Dalfresco.context=alfresco
                -Dalfresco.protocol=http
                "

You can refer this project as a reference: 

https://github.com/abhinavmishra14/change-acs-share-port-demo/blob/master/configs-to-override/share/...

https://github.com/abhinavmishra14/change-acs-share-port-demo/blob/master/docker-compose.yml#L70

 

 

 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

View solution in original post

1 Reply
abhinavmishra14
Advanced

Re: Session Timeout

Jump to solution

Timeouts can be set for tickets and overall container session. 

If you are looking for increasing/decreasing alfresco alf_ticket timeout then refer following properties:

# Do authentication tickets expire or live for ever?
authentication.ticket.ticketsExpire=true
# If ticketsEpire is true then how they should expire?
# Valid values are: AFTER_INACTIVITY, AFTER_FIXED_TIME, DO_NOT_EXPIRE
# The default is AFTER_FIXED_TIME
authentication.ticket.expiryMode=AFTER_INACTIVITY
# If authentication.ticket.ticketsExpire is true and
# authentication.ticket.expiryMode is AFTER_FIXED_TIME or AFTER_INACTIVITY,
# this controls the minimum period for which tickets are valid. 
# The default is PT1H for one hour.
authentication.ticket.validDuration=PT1H

These properties can be passed as follows: 

ervices:
  alfresco:
    image: alfresco/alfresco-content-repository-community:7.2.0
    mem_limit: 2g
    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=jdbc:postgresql://postgres:5432/alfresco
        -Dsolr.host=solr6
        -Dsolr.port=8983
        -Dsolr.http.connection.timeout=1000
        -Dsolr.secureComms=secret
        -Dsolr.sharedSecret=secret
        -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
	-Dauthentication.ticket.ticketsExpire=true
	-Dauthentication.ticket.expiryMode=AFTER_INACTIVITY
	-Dauthentication.ticket.validDuration=PT1H
        -XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80
        "

If you are looking to set the timeout at servlet container level, you need to set the following:

[For example Share] tomcat\webapps\share\WEB-INF\web.xml 

<session-config>
<!-- default --> <session-timeout>60</session-timeout> </session-config>

In dockerized environment, if you have to add above config then you need to use combination of DockerFile and docker-compose.yml. for example:

ARG SHARE_TAG

FROM alfresco/alfresco-share:${SHARE_TAG}

ARG TOMCAT_DIR=/usr/local/tomcat

# In base image it tries to write logs at root directory which requires 'root' user access.
RUN sed -i "s|log4j.appender.File.File\=share.log|log4j.appender.File.File\=logs/share.log |g" $TOMCAT_DIR/webapps/share/WEB-INF/classes/log4j.properties ;

# Update session timeout config from default 60 minutes to 30 minutes:
RUN sed -i 's@<session-timeout>60</session-timeout>@<session-timeout>30</session-timeout>@' \
	$TOMCAT_DIR/webapps/share/WEB-INF/web.xml

# Copy and apply amp add-ons
COPY Dockerfile add-ons/*.amp $TOMCAT_DIR/amps_share/
RUN java -jar $TOMCAT_DIR/alfresco-mmt/alfresco-mmt*.jar install \
              $TOMCAT_DIR/amps_share $TOMCAT_DIR/webapps/share -directory -nobackup -force
			  
#TODO:: Add more steps as needed
 share:
        build:
          dockerfile: ./Dockerfile
          context: ./configs-to-override/share
          args:
            SHARE_TAG: ${SHARE_TAG}
        mem_limit: 2g
        environment:
            REPO_HOST: "alfresco"
            REPO_PORT: "7080"
            JAVA_OPTS: "
                -XX:MinRAMPercentage=50
                -XX:MaxRAMPercentage=80
                -Dalfresco.host=localhost
                -Dalfresco.port=7080
                -Dalfresco.context=alfresco
                -Dalfresco.protocol=http
                "

You can refer this project as a reference: 

https://github.com/abhinavmishra14/change-acs-share-port-demo/blob/master/configs-to-override/share/...

https://github.com/abhinavmishra14/change-acs-share-port-demo/blob/master/docker-compose.yml#L70

 

 

 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)