Neo4j on Heroku - Part 3
Join the DZone community and get the full member experience.
Join For Freethis is the third and final installment of the neo4j on heroku tutorial. after reading this, you should be ready to go out there and start hacking on neo4j and then deploying your apps to heroku.
this week we learned that leaving the create_graph method accessible
to the world was a bad idea. so let’s go ahead and delete that route in
sinatra, and instead create a rake task for it.
in rakefile:
require 'neography/tasks' require './neoflix.rb' namespace :neo4j do task :create do neo = neography::rest.new(env['neo4j_url'] || "http://localhost:7474") create_graph(neo) end end
that’s much better. we can create our graph locally with
rake neo4j:create
or we can run it on heroku with
heroku run rake neo4j:createlog in to heroku, the go to your apps https://api.heroku.com/myapps , click on your application (i’ll click on neoflix) then on the “addons” drop down menu on the right, select neo4j, and you’ll see this screen come up:
you can zip up the contents of your neo4j database to neoflix.zip and perform a restore operation.
cd neo4j/data/graph.db zip -r neoflix.zip .
your neo4j addon will restart and all your data will be loaded and ready to go.
if you have followed part 1 and part 2 of this series, then you should take what you have learned and create a neo4j demo application. take part in the neo4j challenge and have a chance at winning awesome prices as well as learning a new technology.
source: http://maxdemarzi.com/2012/01/18/neo4j-on-heroku-part-three/
Opinions expressed by DZone contributors are their own.
Comments