neo4j + heroku
HerokuのアドオンでGraphDBというのがあって、それを試してみようと思った。
まずはローカル環境でということで、GrapheDB(Neo4J)を自分のMacに入れてみた
$ bew install neo4j
・・・・・・・途中省略・・・・・
・・・・・・・・・・・・・・・・
=> Caveats
Quick-start guide:1. Start the server manually:
neo4j start2. Open the neo4j browser:
open http://localhost:7474/browser/3. Start exploring the REST API:
curl -v http://localhost:7474/db/data/4. Stop:
neo4j stopTo launch on startup, install launchd-agent to ~/Library/LaunchAgents/ with:
neo4j installIf this is an upgrade, see:
/usr/local/Cellar/neo4j/2.0.1/libexec/UPGRADE.txtThe manual can be found in:
/usr/local/Cellar/neo4j/2.0.1/libexec/doc/You may need to set JAVA_HOME for Java 7 in your shell profile:
export JAVA_HOME="$(/usr/libexec/java_home -v 1.7)"
では試してみるか、早速。
neo4jについてはここを進めて学んでみようっと
取りあえずRailsに組み込んでみる。
方法はGemfileに以下を追加
gem 'neography'
でbundle install
$ bundle install --path vendor/bundle
続いて、Neo4jサーバへの接続方法を設定。config/initializers/neography.rbを作成します。
neo4j_url = ENV["GRAPHENEDB_URL"] || "http://localhost:7474" # default to local server uri = URI.parse(neo4j_url) require 'neography' Neography.configure do |conf| conf.server = uri.host conf.port = uri.port conf.authentication = 'basic' conf.username = uri.user conf.password = uri.password end
rails consoleなど立ち上げて動きを確認することはできます
$ bundle exec rails console