Monday, November 03, 2008

Alfresco on EC2

Over the weekend, I created a Alfresco Labs 3b AMI on EC2, Amazon's cloud computing platform.

I took one of the Alestic Ubuntu 8.10 base images, added my own ec2-tools_0.1.deb package, and built out an AMI with Labs 3b running on the system tomcat5.5, instead of the bundled tomcat instance. That part was far more brutal than using EC2. You have to make quiet a few changes to the catalina policy to get things working.

I made an Alfresco package, that installs an /etc/tomcat5.5/policy.d/60alfresco.policy file that looks like this:
grant { 
permission java.lang.RuntimePermission "*";

permission java.lang.RuntimePermission "accessDeclaredMembers";
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
permission java.util.PropertyPermission "alfresco.jmx.dir", "read,write";
permission java.util.PropertyPermission "webapp.root", "read,write";
permission "/usr/share/java/servlet-api-2.4.jar", "read";

grant codeBase "file:${catalina.home}/bin/tomcat-juli.jar" {
permission "/usr/share/tomcat5.5/webapps/alfresco/WEB-INF/classes/", "read";
permission "/var/lib/tomcat5.5/temp/-", "read,write,delete,execute";
permission "/var/lib/tomcat5.5/temp", "read,write,execute";
All of my AMIs have a script that can quickly upload an updated AMI. It looks something like this:

umount /var/local
ec2-bundle-vol -u $ACCOUNTID -c $CERTFILE -k $KEYFILE -p ubuntu-8.10-appsuite-1.0-20081101 --ec2cert /etc/ec2/amitools/cert-ec2.pem -r i386
ec2-upload-bundle -b -m /tmp/ubuntu-8.10-appsuite-1.0-20081101.manifest.xml -a $ACCESSKEY -s $SECRETKEY
This made life a bit easier as I made changes to the image and uploaded them. I unmount /var/local at the start of the script as that's where I mount my EBS volume.