Since Alfresco Community 4.0.c was quietly slipped out over the Christmas break, I’d been meaning to get round to creating an AMI with the new release. After I was asked by a colleague who was trying to do something similar with our upcoming Enterprise version, I managed to grab a short amount of time to revisit the image creation process that I wrote about back in November.
First off, I decided to reduce some of the complexity by breaking with the past and going for an EBS boot image only, rather than the S3-backed instance-store types that I previously put together. As well as being simpler to create, EBS boot images offer several advantages, the chief one being that by virtue of their EBS-backed storage, they can persist their state when turned off.
From my initial testing, the EBS boot images seem to perform well too, so unless I get any reports of significant problems I’ll be using the same method to create all future AMIs as well.
Running the images
The new 4.0.c image is listed on the Alfresco EC2 Images page. Launching it is easy using the AWS web console.
- Click the icon next to the version you want to run
- Log in using the e-mail and password you registered with Amazon, if you are not already logged in
- Step through the wizard, making sure that you select Small in the instance size
- When you get to the security part, make sure you select a security profile that has inbound SSH (port 22) and HTTP (port 80) enabled, plus any other interfaces you want to allow into Alfresco
After the wizard has completed you can monitor the start-up of your instance in the Instances area of the EC2 web console. To connect to Alfresco Share on your instance, simply paste the public DNS name of the instance into your browser address bar. It may take up to five minutes for the repository to run through the bootstrap process, after which you will be redirected to the normal Share login page.
Creating your own images
There’s nothing to stop you creating your own Alfresco AMIs, using the same procedure that I’ve used here. As I mentioned, when creating EBS boot instances the procedure is much simpler, and there is no need to copy private key files across the network onto the host.
There are a few steps to carry out, but I’ve tried to make these as straightforward as possible
1. Start up your base image
Start by running up a pre-configured Ubuntu or other Linux AMI – see Canonical’s list for the latest official versions. You should pick the right one for your geography and size requirements, but I use the most recent 32-bit EBS boot AMI from the West Europe region.
To start up the image, just click the relevant link in the list, or use the Launch wizard in the EC2 Management Console to pick an alternative Linux-based AMI. The scripts have been tested with Ubuntu 11.10 and 12.04 32-bit instances, so I’d recommend either of those where possible. 64-bit AMIs do not seem to run well on small instances, so if you use one of those then ensure you pick a larger instance size.
2. Log in via SSH
I use PuTTY to connect to the newly-created instance. You’ll need to have created a keypair for your AWS account and have imported it into PuTTY. You can then connect via SSH as the relevant user account (the Ubuntu images use the user ‘ubuntu’) and the correct key file.
There is general information on connecting to Linux instances in the EC2 help and Eric Hammond has a page that explains some more about securely connecting to the official Ubuntu images, which should be accurate for all the AMIs listed on his site.
3. Download and extract the Ubuntu Quickstart scripts
These are now available as a ZIP download from the alfresco-ubuntu-qs project on Google Code. Find the latest version in the Downloads section and right click to copy the download link to your clipboard.
Back in your SSH client you can then download the files using the following commands (modify as needed for the latest version of the scripts), or you can skip the first line by downloading the file from the project site and SCP’ing it up to your Amazon instance.
curl http://alfresco-ubuntu-qs.googlecode.com/files/alfresco-ubuntu-qs-0.9.8.tar.gz -o alfresco-ubuntu-qs-0.9.8.tar.gz tar xzf alfresco-ubuntu-qs-0.9.8.tar.gz
4. Install Alfresco
Now we can install the Alfresco files using the install.sh script supplied in the Ubuntu Quickstart package.
cd alfresco-ubuntu-qs sudo ./install.sh --alf-version 4.2.b --jdk-version openjdk-7 --no-install-dod
Note that the --no-install-dod option to install.sh is only needed for version 4.0, for which the DoD5015.2 add-on module is currently unavailable.
For Alfresco Community 4.2, only JDK7 is required, which you must enable using --jdk-version openjdk-7.
You can follow the progress of the script in your SSH client. When you are prompted for a MySQL password, you must enter ‘alfresco’ – unless you have changed the value of $MYSQL_USER in install.sh to something else.
When the script has finished it will tell you that installation is complete and that Alfresco can be started. DO NOT START ALFRESCO UP AT THIS TIME – unless you want a pre-installed repository to be part of your AMI.
5. Create your AMI
One of the benefits of EBS boot instances is that you can create images with a single command using the AWS API tools, or directly from the EC2 web console.
To create your AMI from the web console, right-click the running instance in the Instances section, select Create Image from the menu, enter an appropriate file path in the ‘name’ field, and confirm.
The image creation process should take no more than a few minutes – far quicker than the instance-store method! Once it is done, you should be able to see your image in the AMIs section of the web console. You can test it by starting up an instance of it as per the steps in Running the images, above.
6. Cleaning up
Last but not least, make sure that the instance that you used to create your image is terminated, so it will not keep on consuming billable resources! You should do the same for any additional instances that you’ve fired up to test your image.
Pingback: Will Abson on Alfresco » Blog Archive » Alfresco 4.0 in Amazon EC2
Will, thank you so much for your helpful blog. I installed one of your Alfresco images yesterday on my EC2 server…you saved me hours of sys-admin and server config time.
Question: Is there any reason Alfresco wouldn’t work on a “Micro” EC2 instance, as opposed to the “Small” EC2 instance? We have a very small intranet, that will serve less than 20 users. So we’d like to control our costs as much as possible.
Hi Evan, thanks for the feedback! I’ve not tried running the image on a Micro instance, since I normally find that my local Alfresco instances tend to consume around 500MB of memory. The Micro instance can only provide 613MB, which seems a little tight still, given that the current images also have Apache, Tomcat, MySQL and the OS running.
That said, I did wonder myself if it would be possible to get it to work by tuning the configuration and, possibly also, working with this wiki page: http://wiki.alfresco.com/wiki/JVM_Tuning#Notes_for_Low-End_Machines. If you have time to try it out and follow up with a post, I’d be really interested in your results.
I tried using a Micro instance with the 4.0d AMI with no tuning and most functions worked for a single user, but it was painfully slow and eventually Alfresco stopped responding and the only way to get it back was to reboot the instance. The server was not accessible via SSH when this would happen.
I think the Micro instance simply doesn’t supply enough RAM.
Hi Rick, it may be possible to tweak the EHcache settings so that the system takes up less RAM, but yes the Micro instance is unlikely to supply enough memory for the repository, DB and OS with the default settings. Small works fine for me, however.
Good Morning Will
Thanks a lot for your post, it has been a great new knowing that it is possible to get AMI’s for Alfresco already prepared.
We would like to move our local Alfresco Community configuration to Amazon EC2 as we already have some of our systems (CRM,Web…) in there, however we did not know how to do it exactly.
I have readed in your post, that you suggest to use a Small instance with only has 1,87GB of RAM. We would have almost 200 users accessing our Alfresco CE system to look for and archive documentation. Do you think a Small instance it is enough?
We have tried to configure already an alfresco instance by our own, and after getting Alfresco installed, the performance it is quite slow, even we have assigned 1024MB to the JVM. Shall we try it with a Medium size?.
Also another problem is that we have already almost 1TB of content, and the max EBS size is 1 TB. Do you know how can we expand the capacity of the final Alfresco System using this Small Instance with EBS volumes?
Thanks a lot and great article again!
Hi Luis, firstly I would not recommend the provided images for production use, they are intended for demo and testing use only. This is why the minimum instance size possible is used, but you are correct that this will not scale well.
I have updated the AMI Images page to reflect this, also worth mentioning is that you may find the quick-start scripts which I use to create my AMIs useful for creating your own.
The resources you require (and hence the instance size you need) will depend on the volume and nature of your usage. You could benchmark the different instance types yourself to get an idea of which is likely to provide the best performance vs. cost ratio, or (if Alfresco Enterprise is an option for you) you could engage the services of one of Alfresco’s Integration partners who will have experience in sizing Alfresco.
Thanks a lot for your reply. We are using Alfresco CE as we use the system just as a Document Repository and Quick Indexed Search, we do not really take advantage about all the functionalities Alfresco Enterprice can offer.
Our problem is the amount of documentation already stored in, which is getting quite big (Almost 1TB). Even we have also a big number of users, they just access the system for Document Search, and not very often. This is why we do not consider moving to Alfresco Enterprise yet.
Just wated to check if a configuration with an Small instance and an external EBS block of 1TB would be a configuration enough for our needs, or if we need to move to the Amazon Medium size due to the need of RAM memory.
Thanks for the post and the answer once more
Thanks for the useful post. The quick install scripts are really extremely useful.
Quick note, Add the following to install.sh around line 220 for the install script to support 4.2.c:
set_dl_params "$dl_base/community/build-04576" "community"