dotCMS - Open Source Content Management System, Ondemand CMS, and Professional Support

Document Search

Article Information

Tags: ecc cloud Amazon ec2 aws
Updated: 2/3/2010 1:54:28 PM
By: Dean Gonzalez
Doc id: 175570
Print Page: Export to PDF

Tips For Running dotCMS on Amazon's EC2

These are the general steps:

As you probably know, an amazon instance (and everything you save in it) goes away once you shut it down. Your options are to periodically copy to a S3 bucket as backup or set up an EBS (Elastic Block Storage) to persist your data, settings, etc. Here are the steps I used to get this to work.

  1. Create an EBS (elastic block storage device). I assigned dev_sdj as my block storage. Follow Amazon's directions to make sure that the EBS resides in the same region as the instance that will be running dotCMS.
  2. Start your dotCMS image. Refer to the dotCMS site for their AMI.
  3. Once the dotCMS instance is started and running, mount your EBS. In my case, I mount dev_sdj to /mnt
  4. Shutdown the running database instance by running /etc/init.d/postgresql-8.2 stop.
    To be safe, you may also wish to shutdown tomcat by executing /dotcms/bin/shutdown.sh
  5. Next, copy the entire db and dotcms into your /mnt EBS device.
  6. Edit /etc/start.sh - I commented the following to avoid the svn update process and potentially rebuilding/reloading your dotcms tables.
#!/bin/bash
setup_cms(){
cd /mnt
tar -xvpszf /data/dotcms.tar.gz
cd /mnt/dotcms
svn update
ant deploy
createdb dotcms
#psql -f /mnt/dotcms/build/sql/postgres.sql dotcms
cp /data/server.xml /mnt/dotcms/conf/
cp /data/ROOT.xml /mnt/dotcms/conf/Catalina/localhost
}
setup_db(){
cd /mnt
#test -d /mnt/db
tar -xvpszf /data/db.tar.gz /etc/init.d/postgresql-8.2 start
}

export JAVA_HOME=/usr/local/java
export ANT_HOME=/usr/local/ant export PATH=$PATH:$JAVA_HOME/bin:$ANT_HOME/bin
rm /var/run/dotcms.pid
cd /mnt setup_db
#test -d /mnt/dotcms
setup_cms
cd /mnt/dotcms/bin chmod a+x *.sh
./startup.sh


You should be able to reboot your dotcms instance or create a new one, then perform a manual mount of your EBS device. Be sure to configure your instance to attach your EBS device on boot (or you manually attach it after boot).

The final step is to manually execute /etc/start.sh

In order for the changes in your /etc/start.sh to persist, you will need to either bundle the instance to create your own AMI or like me, I use Rightscale 's templating feature to perform the equivelant as bundling. As of this writing, Rightscale offers a free developer account for you to use. Hope you find this info useful.


Dayton Chan

www.riffcloud.com

Business leads, Technology drives

 



Post a Comment


Add Comments

   

 
Post