This week I’m looking into integrating a CMS into a Grails application. Initially there won’t be much tight integration but it could involve single sign-on and lead into much tighter application embedding CMS content.
As it happens, there is a CMS built on Grails called Weceem – it took some trial and error to get it working as the documentation could use a lot of work. Here are some tips if you’re trying to get it working on Mac OSX (as a quick and simple standalone development mode).
Tomcat
- Download the tar.gz distribution of Tomcat.
- Decompress Tomcat.
- Copy the folder somewhere as desired, I used /opt/apache-tomcat-7.023. Check out this really good tutorial here.
- Download the MySQL JDBC driver.
- Copy the MySQL JDBC driver (i.e. the mysql-connector-java-{ver}-bin.jar file_ to {tomcat home}/lib. I read postings that say you can copy to a common/lib folder, but that didn’t seem to work.
- Edit the {tomcat home}/conf/tomcat-users.xml file and add something along the following lines:
<role rolename="admin"/>
<user username="admin" password="admin" roles="manager-gui,admin"/>
Create a MySQL Database
- Create a DB in MySQL called whatever you’d like (I used cms).
- Create a username and password that has access to read/write/modify the schema.
Weceem config file
Create a weceem.properties file somewhere. /etc/weceem.properties might be a good choice. It’ll look like the following, update accordingly.
# Control whether or not connection pooling is enabled
dataSource.pooled=true
dataSource.driverClassName=com.mysql.jdbc.Driver
dataSource.username=dbusername
dataSource.password=dbpassword
dataSource.dbCreate=update
dataSource.url=jdbc:mysql://localhost/cms
searchable.index.path=/Websites/cms/search-indexes
Make sure that whatever you set as the searchable.index.path is a directory that that the user Tomcat will run under has read/write access to.
Update your environment variables
Edit your ~/.profile and make sure you have the following lines, update path accordingly:
export JAVA_HOME=/Library/Java/Home
export CATALINA_HOME=/opt/apache-tomcat-7.0.23
export JAVA_OPTS=-Dweceem.config.location=file:/Websites/cms/weceem.properties
export CATALINA_OPTS="-Xms756m -Xmx756m -XX:NewSize=256m
-XX:MaxNewSize=512m -XX:PermSize=256m -XX:MaxPermSize=512m"
Deploy Weceem
- Download the Weceem.war file.
- Copy the Weceem-{ver}.war file to {tomcat home}/webapps/weceem-{ver}.war.
- You can rename the Weceem file to just Weceem.war if you’d like.
See what happens
- Open a terminal window.
- cd to {tomcat home}/bin
- Type in ./startup.sh – you’ll see some stuff about environment variables, and the command line will return back to you.
- Open another terminal window.
- In the second terminal window, cd to {tomcat home}/logs, and type in tail -f catalina.out
- You should eventually see a line that says “INFO: Server startup in xyz ms”
- Open up a browser to http://localhost:8080/manager/html (use the username and password you set up when editing the tomcat-users.xml file above).
- You should see the Weceem application listed and started. If it’s not started, click on the start button.
(click on image to enlarge)
- Once running, just click on the left column (the path column) and it should load up the default Weceem page.
- There’ll be a link on that page to edit content, the default admin user name and password is admin/admin.
Hope that helps save someone time who wants to tinker around with it.