Alfresco setup in Ubuntu 8.10 with git

Alfresco

My goal was to install Alfresco in Ubuntu-8.10 and store the Alfresco install and config in git excluding the application data in such a way that I am able to checkout my Alfresco git repo on a new Ubuntu install and have Alfresco running immediately.

This turned out to be fairly easy and makes testing new configuration changes very simple.

There is plenty of information on configuring Alfresco on the Alfresco wiki, and most of my setup is based on the install tutorial for Ubuntu-8.04. So I will only cover the differences in the way I setup Alfresco.

Alfresco dependencies in Ubuntu

I chose to use puppet for taking care of dependencies as it is already in deployment for all the servers I use. The other common way of taking way of taking care of dependencies is to create a script that installs the dependencies and store it in the root Alfresco dir managed by git. If you do not want to setup puppet then see the initialize.sh file below. My puppet rule as follows also installs lighttpd and phpmyadmin.

class alfresco_base {
        package { [
                imagemagick,
                lighttpd,
                mysql-server,
                'openoffice.org-headless',
                php5-cgi,
                swftools]:
                        ensure => installed;

                phpmyadmin:
                        ensure => installed,
                        require => [Package['php5-cgi'], Package['lighttpd']],
                        notify => File['50-phpmyadmin.conf'];

                sun-java6-jre:
                        ensure => installed,
                        require => Exec[preseed-licence-dlj];
        }

        file {
                '50-phpmyadmin.conf':
                        name => "/etc/lighttpd/conf-available/50-phpmyadmin.conf",
                        ensure => "/etc/phpmyadmin/lighttpd.conf",
                        notify => Exec[lighttpd-enable-phpmyadmin]
        }

        exec {
                "lighttpd-enable-phpmyadmin":
                        command => "lighty-enable-mod fastcgi phpmyadmin",
                        refreshonly => true,
                        notify => Exec[lighttpd-restart];

                "lighttpd-restart":
                        command => "/etc/init.d/lighttpd restart",
                        refreshonly => true;

                "preseed-licence-dlj":
                        command => "echo sun-java5-jdk shared/accepted-sun-dlj-v1-1 boolean true | debconf-set-selections";
        }
}

Initially installing Alfresco

To have something to put into the git repo we first must install Alfresco the usual way for your platform. If you are installing on a 64bit install you will need to install ia32libs first too.

  • ./Alfresco-Labs-3Stable-Linux-x86-Install --mode console

Once installed turn your install into a git repo.

  • cd Alfresco
  • git init
  • git add .
  • git commit -m "Initial install of Alfresco Labs 3 Stable"

Now we need to define some exclusions for files that are changed or defined after install such as log folders and user data.

  • echo "alf-backstop-*
    alf_data/
    alfresco.log
    tomcat/logs/
    tomcat/temp/
    tomcat/conf/tomcat-users.xml
    tomcat/webapps/alfresco/
    tomcat/webapps/share/
    tomcat/webapps/studio/
    tomcat/work/
    virtual-tomcat/logs/
    virtual-tomcat/work/
    alfresco.log.*
    tomcat/webapps/alfresco.war-*" >> .git/info/exclude

Your git repo is now ready to be uploaded to you preferred place of storing git repos such as a file server or gitosis. I’m using a file server via ssh.

  • ssh git@fileserver "mkdir Alfresco; cd Alfresco; git init"
  • git remote add origin git@fileserver:Alfresco
  • git push origin master
  • scp .git/info/exclude git@fileserver:Alfresco/.git/info/exclude

Congratulations! You now have a fresh install of Alfresco stored in git on your fileserver.

Initial configuration

Before checking out on a new server there are a few changes we needed to commit.

File: initialize.sh:

#!/bin/sh
ALF_HOME=/opt/Alfresco
# Uncomment the following line if not using puppet
#apt-get install imagemagick mysql-server openoffice.org-headless php5-cgi swftools sun-java6-jre
echo "Creating init.d links"
ln -s $ALF_HOME/alfresco.sh /etc/init.d/alfresco
ln -s $ALF_HOME/virtual_alf.sh /etc/init.d/virtual_alf
update-rc.d alfresco defaults
ln -s $ALF_HOME/alfresco.sh /etc/init.d/alfresco
ln -s $ALF_HOME/virtual_alf.sh /etc/init.d/virtual_alf
update-rc.d alfresco defaults
update-rc.d virtual_alf defaults
echo "Creating MySQL database tables - Password for MySQL root user:"
mysql -u root -p < $ALF_HOME/extras/databases/mysql/db_setup.sql
[ ! -d $ALF_HOME/tomcat/logs ] || mkdir $ALF_HOME/tomcat/logs
[ ! -d $ALF_HOME/virtual-tomcat/logs ] || mkdir $ALF_HOME/virtual-tomcat/logs

initialize.sh links alfresco into /etc/init.d, sets it to start at boot time and creates the alfresco mysql user. If you are using the puppet recipe above then the default mysql root password is blank and should be changed either at the command line or from phpmyadmin (http://localhost/phpmyadmin/). If you are not using puppet then uncomment the apt-get line at the top of the file and customise the dependencies for your needs.

File: alfresco.sh and virtual_alf.sh

Change @@ALFRESCO_DIR@@ to your install dir, eg: /opt/Alfresco
Change @@JAVA_HOME@@ to your jvm dir, eg: /usr/lib/jvm/java-6-sun/

File: tomcat/webapps/alfresco/WEB-INF/classes/alfresco/repository.properties

There is a conflict with the port used by the virtual server that needs to be changed else the virtual server will not start a second time and complain that the port is already in use (and it is).

Change avm.rmi.service.port=50501 to avm.rmi.service.port=50509

Commit

First get a list of files you have changed:

  • git status

If you want to commit all those changed files then commit like:

  • git commit -a -m "You commit message"

Or if you only want to commit a couple of the changes, eg:

  • git add initialize.sh alfresco.sh virtual_alf.sh
  • git commit -m "Your commit message"

Now push the changes:

  • git push origin master

And you will find you use that process fairly often to start with. I also found myself using branching to test larger changes or changes I wanted to keep separate for now. But documenting all of those commands is beyond this post. Other changes I made were changing the database backend to mysql and authentication to active directory.

Checkout Initialize Run

Now lets test it. Lets assume your using a clean install of Ubuntu again (with a puppet client setup already).

  • sudo git clone git@fileserver:Alfresco /opt/Alfresco
  • sudo scp git@fileserver:Alfresco/.git/info/exclude /opt/Alfresco/.git/info/exclude
  • sudo /opt/Alfresco/initialize.sh
  • sudo /etc/init.d/alfresco start

Your Alfresco server should start after a few minutes and be ready for testing. You can commit and push changes from any checkout too.

There may be other files or directories you need to add to the exclude file too. You will see most of these after starting Alfresco the running git status.

Stay tuned for: Active Directory integration

This entry was posted in Alfresco and tagged , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

2 Comments

  1. Tiago Faria
    February 27, 2009 8:08 am

    If you tag posts with ‘git’ or have a ‘git’ category and you’re interested on http://www.planetgit.org let me know.

  2. February 27, 2009 11:17 am

    .gitignore is a better place to store ignores than .git/info/ignore as .gitignore will be tracked by git and checked out automatically.

One Trackback

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>