Showing posts with label JCS. Show all posts
Showing posts with label JCS. Show all posts

Thursday, May 12, 2016

#504 JCS / DB CS --> Lifting and shifting a web app from on-prem to Oracle PaaS

A short post to show how easy it is to lift and shift a web app from on-prem to the Oracle Cloud.

My on-prem app is very basic, simply a servlet that calls my local Oracle DB.
The servlet calls a helper class, CallDB().
Here is an extract from that class.
As you can see, I have hard coded the connect info -

connection = DriverManager.getConnection("
jdbc:oracle:thin:@localhost:1521:xe", "system", "welcome1");

 


Here is an extract from the servlet - As you can see, I am simply executing

SELECT TO_CHAR(SYSDATE) FROM DUAL;












I run this from JDeveloper, the servlet is deployed to the integrated weblogic server.










Now how do I lift and shift this to JCS and DB CS?

Very easy -

Step 1 - Amend the connect string in the helper class to point to my DBCS environment.
Here is the format of the connect string -

 connection = DriverManager.getConnection("
jdbc:oracle:thin:@YourMachine:1521/YourDB", "YourDBUser", "YourPwd");

So how did I get the connect string for my DB CS instance?

I worked the above out by looking at one of the datasources
already defined in my JCS instance, and just extrapolated from that.

















Just take the URL from above.

So that's it!

















You can, of course, validate the string by sshing into the DB CS VM.

Then go to the /network/admin directory and check tnsnames.ora.


Step 2 - Package up the web app as a WAR file.

Step 3 - Deploy the WAR file via the JCS WLS console - just
select option from the hamburger menu.














































As you can see, I have already deployed my SimpleJDBCDemo app.

I have deployed to the admin server and manager server on JCS.

Step 4. Test using the public ip address of the JCS VM.









We can check the weblogic log files for the output messages from CallDB()
ssh into the WLS vm.

sudo su -oracle

Navigate down the WLS directory structure -













tail -f NCJCS_do_adminserver.out

Re-execute the servlet - and view the messages in the .out file -






Great stuff!

Friday, May 6, 2016

#500 JCS First Steps...

Introduction

JCS is available now on shop.oracle.com.

As you can see, it includes IaaS and DB CS.










Install Steps


Install of JCS requires an instance of DB CS.
Storage is also required for DB CS and JCS.

Create Storage


Get X-Auth-Token and X-Storage-Url via REST

curl -v -s -X GET -H "X-Storage-User: Storage- yourIdentityDomain:yourUser" -H "X-Storage-Pass: yourPwd" https://yourIdentityDomain.storage.oraclecloud.com/auth/v1.0
Create DB & JCS Storage containers using the X-Storage-Url and X-Auth-Token

curl -v -s -X PUT -H "X-Auth-Token: X-Auth-Token" https://X-Storage-URL/myDBContainer


curl -v -s -X PUT -H "X-Auth-Token: X-Auth-Token" https://X-Storage-URL/myJCSContainer

Create DB CS Instance

Use 12c Release 1, EE

























































Create JCS Instance





























































Check out what's been created













As you can see, we have access to the usual WLS consoles.
We also have ssh access to the vm.

Now let's look at what has been created during the install at Compute Service level -
I go back to Compute Service and click on Instances.

I see 2 new instances.






If I click on Storage, I see -

















If I click on Network -> Security Rules, I see -


















I check Security Lists -






I click on Security Applications -

















The DB VM is a member of the following security list -










The WLS VM is a member of -












Let's check the security rules that allow the WLS VM to access the DB VM.




Here is the first rule -
























Look at the security application - NCJCS/1/sys_dblistener

This is self-explanatory -





The second rule allows ssh access from the wls vm to the DB machine -




Check out the JCS Console
















Check out the Administration tab -

















Click on Topology -
















Click on the hamburger menu to the right -







Check out Scale Up/Down -












As we say in Ireland, great stuff!

Now, let's look at the weblogic domain on my JCS instance -

sudo su - oracle

Then cd to /u01/data/domains 


















and
/u01/app/oracle/Middleware