Skip to content

Commit

Permalink
Merge branch 'release/5.1.f-1'
Browse files Browse the repository at this point in the history
  • Loading branch information
disaster37 committed May 12, 2016
2 parents 50aa5a5 + e7fb3f5 commit 882f29c
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.git
LICENSE
README.md
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM quay.io/webcenter/rancher-base-image:latest
MAINTAINER Sebastien LANGOUREAUX (linuxworkgroup@hotmail.com)

#Alfresco version
ENV ALF_URL=http://dl.alfresco.com/release/community/201602-build-00005/alfresco-community-installer-201602-linux-x64.bin
ENV ALF_URL=http://dl.alfresco.com/release/community/201604-build-00007/alfresco-community-installer-201604-linux-x64.bin
ENV ALF_HOME=/opt/alfresco


Expand All @@ -25,6 +25,8 @@ RUN /app/assets/install_mysql_connector.sh
RUN mkdir -p ${ALF_HOME}/tomcat/shared/classes/alfresco/extension/subsystems/Authentication/ldap/ldap1/
COPY assets/setup/ldap-authentication.properties ${ALF_HOME}/tomcat/shared/classes/alfresco/extension/subsystems/Authentication/ldap/ldap1/ldap-authentication.properties

# Logrotate
COPY assets/setup/logrotate-alfresco.conf /etc/logrotate.d/alfresco

# init scripts
COPY assets/init.py /app/
Expand All @@ -36,7 +38,7 @@ COPY assets/setup/supervisord-postgresql.conf /etc/supervisor/conf.d/
# CLEAN APT
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

VOLUME ["${ALF_HOME}/alf_data", "${ALF_HOME}/tomcat/logs"]
VOLUME ["${ALF_HOME}/alf_data"]

EXPOSE 21 137 138 139 445 7070 8009 8080

Expand Down
27 changes: 27 additions & 0 deletions assets/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,26 @@ def set_vti_setting(self, host, port):
self.replace_all(ALFRESCO_PATH + '/tomcat/shared/classes/alfresco-global.properties', '^#.vti.server.external.port\s*=.*', '#vti.server.external.port=')


def disable_log_rotation(self):

valve_setting = 'prefix="localhost_access_log" suffix=".log" pattern="combined" rotatable="false"'
self.replace_all(ALFRESCO_PATH + '/tomcat/conf/server.xml', 'prefix="localhost_access_log" suffix=".txt"', valve_setting)
self.replace_all(ALFRESCO_PATH + '/tomcat/conf/server.xml', re.escape('pattern="%h %l %u %t "%r" %s %b"'), '')

logging_setting = """
1catalina.org.apache.juli.FileHandler.rotatable = false
2localhost.org.apache.juli.FileHandler.rotatable = false
3manager.org.apache.juli.FileHandler.rotatable = false
4host-manager.org.apache.juli.FileHandler.rotatable = false
1catalina.org.apache.juli.FileHandler.suffix = log
2localhost.org.apache.juli.FileHandler.suffix = log
3manager.org.apache.juli.FileHandler.suffix = log
4host-manager.org.apache.juli.FileHandler.suffix = log
"""

self.add_end_file(ALFRESCO_PATH + '/tomcat/conf/logging.properties', logging_setting)

def replace_all(self, file, searchRegex, replaceExp, is_create = True):
""" Replace String in file with regex
:param file: The file name where you should to modify the string
Expand Down Expand Up @@ -449,9 +469,16 @@ def add_end_file(self, file, line):
# We init share-config
os.system('cp ' + ALFRESCO_PATH + '/tomcat/shared/classes/alfresco/web-extension/share-config-custom.xml.org ' + ALFRESCO_PATH + '/tomcat/shared/classes/alfresco/web-extension/share-config-custom.xml')

# We init tomcat setting
os.system('cp ' + ALFRESCO_PATH + '/tomcat/conf/server.xml.org ' + ALFRESCO_PATH + '/tomcat/conf/server.xml')
os.system('cp ' + ALFRESCO_PATH + '/tomcat/conf/logging.properties.org ' + ALFRESCO_PATH + '/tomcat/conf/logging.properties')

# We init data folder
serviceRun.init_data_folder()

# We remove log rotation to manage them with logrotate
serviceRun.disable_log_rotation()

# We set database
# We check if official Postgresql container is linked as DB
if os.getenv('DB_ENV_POSTGRES_DB') is not None:
Expand Down
4 changes: 4 additions & 0 deletions assets/setup/install_alfresco.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ cp ${ALF_HOME}/tomcat/shared/classes/alfresco/web-extension/share-config-custom.
# We copy the original setting for alfresco to tune them after start
cp ${ALF_HOME}/tomcat/shared/classes/alfresco-global.properties ${ALF_HOME}/tomcat/shared/classes/alfresco-global.properties.org

# We copy the original setting for tomcat to tune them after start
cp ${ALF_HOME}/tomcat/conf/server.xml ${ALF_HOME}/tomcat/conf/server.xml.org
cp ${ALF_HOME}/tomcat/conf/logging.properties ${ALF_HOME}/tomcat/conf/logging.properties.org

# Add account
groupadd alfresco
useradd -s /bin/false -g alfresco -d /opt/alfresco alfresco
Expand Down
9 changes: 9 additions & 0 deletions assets/setup/logrotate-alfresco.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/opt/alfresco/tomcat/logs/*.log {
daily
missingok
rotate 7
compress
copytruncate
dateext
dateformat -%Y-%m-%d
}

0 comments on commit 882f29c

Please # to comment.