Looking to try out CloudBees for your Spring application?
Here is how you can get started quickly with CloudBees Run@Cloud platform.
05-Mar-12 – Updated for Spring Roo 1.2.1
- Get a CloudBees Account
- Configure a MySql instance on CloudBees
- Build a Spring Roo application
see script below - Create a
cloudbees-web.xmlfile inWEB-INF
same directory asweb.xml - Add Maven CloudBees Plugin
- Build and deploy with Maven
mvn clean install bees:deploy
Roo 1.2.1 Script
Here is a simple item manager application script you can use/customize to create your application.
- NOTE: Provide MySQL credentials in the “
jpa setup” line.
# FOR SPRING ROO 1.2.1 - Spring Data JPA and Service Layer development mode --enabled true project --topLevelPackage com.gordondickens.roobees --java 6 --projectName roobees jpa setup --provider HIBERNATE --database MYSQL --userName yourmysqluserid --databaseName yourmysqlinstancename --password yourmysqlpasswd entity jpa --class ~.domain.Item --activeRecord false field string --fieldName name --sizeMin 3 --sizeMax 30 --class ~.domain.Item field string --fieldName description --sizeMax 255 --class ~.domain.Item repository jpa --interface ~.repository.ItemRepository --entity ~.domain.Item service --interface ~.service.ItemService --entity ~.domain.Item web mvc setup web mvc all --package ~.web logging setup --level DEBUG
Roo 1.1.5 Script
Here is a simple item manager application script you can use/customize to create your application
# FOR SPRING ROO 1.1.5 development mode --enabled true project --topLevelPackage com.gordondickens.roobees --java 6 --projectName roobees persistence setup --provider HIBERNATE --database MYSQL --userName yourmysqluserid --databaseName yourmysqlinstancename --password yourmysqlpasswd entity --class ~.domain.Item field string --fieldName name --sizeMin 3 --sizeMax 30 --class ~.domain.Item field string --fieldName description --sizeMax 255 --class ~.domain.Item web mvc setup web mvc all --package ~.web logging setup --level DEBUG
cloudbees-web.xml
<?xml version="1.0"?>
<cloudbees-web-app xmlns="http://www.cloudbees.com/xml/webapp/1">
<appid>roobees</appid>
<context-param>
<param-name>application.environment</param-name>
<param-value>prod</param-value>
</context-param>
</cloudbees-web-app>
Maven CloudBees Plugin
Add the CloudBees repository to the pluginRepositories section.
<pluginRepositories>
...
<pluginRepository>
<id>bees-plugins-snapshots</id>
<url>http://repository-cloudbees.forge.cloudbees.com/public-snapshot/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
...
</pluginRepositories>
Add the CloudBees Maven plugin to the plugins section.
<plugins>
...
<plugin>
<groupId>com.cloudbees</groupId>
<artifactId>bees-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<configuration>
<!-- your username/appname -->
<appid>youruserid/roobees</appid>
<!-- your api key -->
<apikey>BEBEBE2CEBEBEFBE</apikey>
<!-- your secret key -->
<secret>GEE0GERE0E-JE0EQETEHEPET+33MEIEIEI0EEZEEIEE00+</secret>
<message>Roo ItemManager on CloudBees by Gordon Dickens</message>
</configuration>
</plugin>
...
</plugins>
Database Properties File
Edit the /src/main/resources/META-INF/spring/database.properties file.
Set the database.url to jdbc:cloudbees://yourmysqlinstance.
Set the database.driverClassName to com.cloudbees.jdbc.Driver.
database.username=yourmysqluserid database.password=yourmysqlpasswd database.url=jdbc:cloudbees://yourmysqlinstancename database.driverClassName=com.cloudbees.jdbc.Driver
Download the Demo App
The demo app is in Git https://github.com/gordonad/gordonad-roo-1.2-cloudbees for Spring Roo 1.2.
The GitHub project link is 404.
Fixed the link. Thanks for pointing that out.
Pingback: Using Spring Roo on CloudBees | Cloud Computing Software Development
Nice to see people using the new application layering support in Roo 1.2.x! See ROO-301 and ROO-340 (and of course the reference docs) for further details.
In your pom you have an appkey and secret. What are they for? I couldn’t find any docs on this in the
cloudbees site.
See: http://wiki.cloudbees.com/bin/view/DEV/CloudBees+Deployer+Plugin+for+Continuous+Deployment+from+DEV%40cloud+to+RUN%40cloud