It’s very easy to get Neo4j running on RedHat’s OpenShift Cloud Platform. Note that at the time of writing this, there is no Neo4j cartridge available at OpenShift.

If you are familiar with Heroku, think that a cartridge is like a Heroku Add-on. It plugs functionality into the PaaS environment.

So, how we can use Neo4j at OpenShift? First, remember to always read a README file, if there’s one.

When you create a project at OpenShift, a README file can be located at the root directory of your app. Among other things, we have this line:

../data - For persistent data (also in env var OPENSHIFT_DATA_DIR)

Hmmm that’s interesting! Heroku doesn’t have a place for persistent data across Heroku’s dynos. They are ephemeral, as said by James Ward, here.

From now on, you can guess what to do, right?

The answer is inside of Spring applicationContext.xml file:

<neo4j:config storeDirectory="${OPENSHIFT_DATA_DIR}/graph.db"/> 

To let things more easy, I built a OpenShift skeleton app so I don’t have to do it again and again..

You can view and fork it here: https://github.com/tomasmuller/openshift-neo4jtemplate

Oh! Almost forgot! You can read all the 10 steps of this post title, in the project README.md file!

;-)

About these ads

Join the conversation! 6 Comments

  1. Nicely done on your post. When I try to get neo4j spatial running I will reference you guys for the getting started.

  2. [...] 10 Steps to run Spring Data Neo4j at OpenShift. [...]

  3. When I deploy my project (CDI, JSF, Spring, Neo4j) to openshift, the server alway throw th waning log as:

    WARN [org.jboss.modules] (MSC service thread 1-3) Failed to define class org.neo4j.kernel.impl.osgi.OSGiActivator in Module “deployment.ROOT.war:main” from Service Module Loader: java.lang.LinkageError: Failed to link org/neo4j/kernel/impl/osgi/OSGiActivator (Module “deployment.ROOT.war:main” from Service Module Loader)
    … …
    Caused by: java.lang.NoClassDefFoundError: org/osgi/framework/BundleActivator
    at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.6.0_22]

    Please give me any suggestion in this situation
    Thanks Steven.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Category

jboss, neo4j, openshift, spring-data, springframework

Tags

, , , ,