Skip to content

Instantly share code, notes, and snippets.

@andreasronge
Last active August 29, 2015 14:00
Show Gist options
  • Save andreasronge/11189170 to your computer and use it in GitHub Desktop.
Save andreasronge/11189170 to your computer and use it in GitHub Desktop.
Example how to deploy Neo4j.rb / neo4j-core app on heroku
source "https://rubygems.org"
ruby "2.1.1"
gem 'sinatra', '1.1.0'
gem 'neo4j-core', '3.0.0.alpha.11'
web: bundle exec ruby web.rb -p $PORT
require 'sinatra'
require 'neo4j-core'
neo4j_url = ENV['GRAPHENEDB_URL'] || 'http://localhost:7474'
uri = URI.parse(neo4j_url)
server_url = "http://#{uri.host}:#{uri.port}"
Neo4j::Session.open(:server_db, server_url, basic_auth: { username: uri.user, password: uri.password})
get '/' do
n = Neo4j::Node.create({name: 'andreas'}, :person)
"Hello, world #{n[:name]}"
end
@andreasronge
Copy link
Author

heroku addons:add graphenedb

For a rails and neo4j example, see https://github.com/andreasronge/neo4j/tree/master/example/blog

@dpritchett
Copy link

<3 thanks!

i tweaked mine to use uri.scheme too so I can handle http vs https.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment