Written by: Peter Sauer

This article adresses how to install Treedb on the IBM Bluemix Cloud platform. Registration is free and all the necessary resources enabling you to install and test Treedb are at your disposal during the 1 month test phase. This instructional post references the knowledge which won the Make Your Day! Challenge 2015 contest. 

Due to the rapidly changing development of the cloud platform, it is possible, that this description will be longer accurate at the time of your test. 

After you have signed into the IBM Bluemix section, establish a connection with a cloud foundry application.....

... of the web-based variety.

Please choose Liberty for Java as your starting point. 

After this is set, further instructional information and configuration possibilities are displayed by the platform. The interface command 'cf' controls the application and its deployment. 

Before proceeding, you must configure the application and enlist a database to reference. Therefore, select 'Overview' in the menu on the left hand side, designate a 2GB storage capacity for this process and save the changes.  

Then enable a DB2 instance with the "sqldb_free" plan through the 'Add a Service or API'  item.

If the configuration has been done correctly, the application should look accordingly:

The 'Environment Variables' item on the left side of the menu lists the JDBC-URL and the DB2 user access information, including the username and password, (both jbdcurl). 

 A prompt in the upper right hand corner, provides the option of copying this data into a file on your computer for later usage. 

Then choose 'Start coding' on the left side of the menu. Here you will find step by step instructions on how to use this tool to deploy your application on the Bluemix cloud platform. Following the instructions, download the interface, utlising the  'cf'  character command  and install it. You can ignore the 'Download starter code' item, and continue to the next step. 

Set up a working directory of your choice, like treedb and change to it.  

cd treedb

Configure a connection to the Bluemix system platform with the following command. 

cf api https://api.eu-gb.bluemix.net

Warning,  the following commands are dependent on your type of platform and location in the cloud!

Sign into the Bluemix platform, in a manner dictated by your platform and your regular sign-in information.

cf login -u This email address is being protected from spambots. You need JavaScript enabled to view it. -o This email address is being protected from spambots. You need JavaScript enabled to view it. -s dev

Now download the Bluemix compatible variant of TreeDB here and copy this file into the Treedb index. Rename the treedb.war file into treedb.zip and configure the following file in ZIParchive:

From within the \WEB-INF\web.xml file , input the URL of your Bluemix application in the serverURL parameter.

<init-param>
<description>Server URL</description>
<param-name>serverURL</param-name>
<param-value>http://treedb.eu-gb.mybluemix.net</param-value>
</init-param>

To allow the administrative user to sign in to TreeDB, you must generate a password for them.

<init-param>
<description>TreeDB Admin password</description>
<param-name>adminPassword</param-name>
<param-value>IhrPassword</param-value>
</init-param>

Please change the JDBC parameter, including the database number, to fit your DB2 configuration from within the \META-INF\persistence.xml  file.

 

<property name="javax.persistence.jdbc.url"
value="jdbc:db2://159.8.148.51:50000/datbaseName" />

<property name="javax.persistence.jdbc.user" value="userName" />
<property name="javax.persistence.jdbc.password"
value="userPassword" />

Rename and convert the ZIP archive into a WAR file again and upload this file with the following command onto the cloud platform:

cf push TreeDB -p TreeDBbluemix.war

This process and starting the application can be more lengthy at times.

You can now enter your URL which, which will enable you to access the TreedDB app. The URL can be found at the top of the "overview" window in the Bluemix interface.

Further Links: General help files, particularly Database Administration