Tutorial : Openshift DIY GlassFish setup

Build your own Java EE GlassFish server and place it to OpenShift Cloud for free.

VIDEO TUTORIAL : https://www.youtube.com/watch?v=hzS1BqSd0IM

IMPORTANT : use Linux to do that, I wasnt able to make it under Windows

Goal of our mission > you can use Openshift (https://www.openshift.com/) to deploy up 3 app to cloud server for free. Anyway – GlassFish Java EE server is not included as standard service, but – you can create so call DIY project and put any Java app server on it. This turorial is about how to setup such DIY project.
In next part I will show how to deploy war file and add MyPhpAdmin for dB administration.

1. go to Openshift web console and create DIY project
if you want to use dB – add cartridge as well

2. download modified Glassfish 4 from git
this code already has all modification we need

3. install rhc tool – see tutorial at Openshift page

4. clone your project to local drive
rhc git-clone

5. copy into this project file downloaded from git
glassfish4 dir -> diy
start, stop -> .openshift/action_hooks

6. modify start script – add Java 8 – if default Openshift Java 7 is not enough for your project
export JAVA_HOME=/etc/alternatives/java_sdk_1.8.0
export PATH=$JAVA_HOME/bin:$PATH

7. modify domain.xml – if your app needs JDBC connetion

<jdbc-connection-pool datasource-classname=“com.mysql.jdbc.jdbc2.optional.MysqlDataSource“ name=“source_name“ res-type=“javax.sql.DataSource“>
<property name=“URL“ value=“jdbc:mysql://yoursever:3306/yourdb“></property>
<property name=“databaseName“ value=“yourdb“></property>
<property name=“serverName“ value=“yourserver“></property>
<property name=“user“ value=“youruser“></property>
<property name=“portNumber“ value=“3306″></property>
<property name=“password“ value=“yourpsw“></property>
<jdbc-resource pool-name=“source_name“ jndi-name=“jdbc/source_name“></jdbc-resource>


8.commit to openshift
change directory – go inside
git add .
git commit -am „1st commit to openshift“
git push
this will also restart whole project .. see console

9.open URL of your project via Openshift console
my demo : http://diytest-vancura.rhcloud.com/
GlassFish server is up and running – YAAAAAAA, god job !!!


Napsat komentář