Skip to content

Instantly share code, notes, and snippets.

@andreasronge
Last active December 10, 2015 08:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreasronge/4407344 to your computer and use it in GitHub Desktop.
Save andreasronge/4407344 to your computer and use it in GitHub Desktop.
Complete Ha Example
require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
# require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "sprockets/railtie"
require "rails/test_unit/railtie"
require 'neo4j/rails/ha_console/railtie' if Rails.env.development?
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
module Myapp
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Activate observers that should always be running.
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
# Enable Neo4j generators, e.g: rails generate model Admin --parent User
config.generators do |g|
g.orm :neo4j
g.test_framework :rspec, :fixture => false
end
# Configure where the neo4j database should exist
# The Neo4j HA Console will set the database location when in development mode.
config.neo4j.storage_path = "#{config.root}/db/neo4j-#{Rails.env}" unless Rails.env.development?
# Enable escaping HTML in JSON.
config.active_support.escape_html_entities_in_json = true
# Use SQL instead of Active Record's schema dumper when creating the database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql
# Enforce whitelist mode for mass assignment.
# This will create an empty whitelist of attributes available for mass-assignment for all models
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
# parameters by using an attr_accessible or attr_protected declaration.
# config.active_record.whitelist_attributes = true
# Enable the asset pipeline
config.assets.enabled = true
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
end
end
source 'https://rubygems.org'
gem 'rails', '3.2.9'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'jruby-openssl'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyrhino'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
group :development, :test do
gem "rspec-rails"
end
gem "neo4j", ">= 2.2.3"
gem 'neo4j-community', '1.9.M03'
gem 'neo4j-advanced', '1.9.M03'
gem 'neo4j-enterprise', '1.9.M03'
################################################################
# Neo4j configuration
#
################################################################
#***************************************************************
# Server configuration
#***************************************************************
# location of the database directory
org.neo4j.server.database.location=data/graph.db
# let the webserver only listen on the specified IP. Default
# is localhost (only accept local connections). Uncomment to allow
# any connection. Please see the security section in the neo4j
# manual before modifying this.
#org.neo4j.server.webserver.address=0.0.0.0
#
# HTTP Connector
#
# http port (for all data, administrative, and UI access)
org.neo4j.server.webserver.port=7474
#
# HTTPS Connector
#
# Turn https-support on/off
org.neo4j.server.webserver.https.enabled=true
# https port (for all data, administrative, and UI access)
org.neo4j.server.webserver.https.port=7473
# Certificate location (auto generated if the file does not exist)
org.neo4j.server.webserver.https.cert.location=conf/ssl/snakeoil.cert
# Private key location (auto generated if the file does not exist)
org.neo4j.server.webserver.https.key.location=conf/ssl/snakeoil.key
# Internally generated keystore (don't try to put your own
# keystore there, it will get deleted when the server starts)
org.neo4j.server.webserver.https.keystore.location=data/keystore
#*****************************************************************
# Administration client configuration
#*****************************************************************
# location of the servers round-robin database directory. possible values:
# - absolute path like /var/rrd
# - path relative to the server working directory like data/rrd
# - commented out, will default to the database data directory.
org.neo4j.server.webadmin.rrdb.location=data/rrd
# REST endpoint for the data API
# Note the / in the end is mandatory
org.neo4j.server.webadmin.data.uri=/db/data/
# REST endpoint of the administration API (used by Webadmin)
org.neo4j.server.webadmin.management.uri=/db/manage/
# Low-level graph engine tuning file
org.neo4j.server.db.tuning.properties=conf/neo4j.properties
# The console services to be enabled
org.neo4j.server.manage.console_engines=gremlin, shell
# Allowed values:
# HA - High Availability
# SINGLE - Single mode, default.
# To run in High Availability mode, configure the
# neo4j.properties config file, then uncomment this line:
org.neo4j.server.database.mode=HA
# Comma separated list of JAX-RS packages containing JAX-RS resources, one package name for each mountpoint.
# The listed package names will be loaded under the mountpoints specified. Uncomment this line
# to mount the org.neo4j.examples.server.unmanaged.HelloWorldResource.java from neo4j-examples
# under /examples/unmanaged, resulting in a final URL of
# http://localhost:7474/examples/unmanaged/helloworld/{nodeId}
#org.neo4j.server.thirdparty_jaxrs_classes=org.neo4j.examples.server.unmanaged=/examples/unmanaged
#*****************************************************************
# HTTP logging configuration
#*****************************************************************
# HTTP logging is disabled. HTTP logging can be enabled by setting this property to 'true'.
org.neo4j.server.http.log.enabled=false
# Logging policy file that governs how HTTP log output is presented and archived.
# Note: changing the rollover and retention policy is sensible, but changing the
# output format is less so, since it is configured to use the ubiquitous common log format
org.neo4j.server.http.log.config=conf/neo4j-http-logging.xml
# Default values for the low-level graph engine
#neostore.nodestore.db.mapped_memory=25M
#neostore.relationshipstore.db.mapped_memory=50M
#neostore.propertystore.db.mapped_memory=90M
#neostore.propertystore.db.strings.mapped_memory=130M
#neostore.propertystore.db.arrays.mapped_memory=130M
# Autoindexing
# Enable auto-indexing for nodes, default is false
#node_auto_indexing=true
# The node property keys to be auto-indexed, if enabled
#node_keys_indexable=name,age
# Enable auto-indexing for relationships, default is false
#relationship_auto_indexing=true
# The relationship property keys to be auto-indexed, if enabled
#relationship_keys_indexable=name,age
# Keep logical logs, helps debugging but uses more disk space, enabled for legacy reasons
# To limit space needed to store historical logs use values such as: "7 days" or "100M size"
# instead of "true"
keep_logical_logs=true
# Enable online backups to be taken from this database.
online_backup_enabled=true
# Port to listen to for incoming backup requests.
online_backup_port=6362
# Uncomment and specify these lines for running Neo4j in High Availability mode.
# ha.server_id is a unique integer for each instance of the Neo4j database in the cluster.
# (as opposed to the coordinator instance IDs)
ha.server_id=3
# ha.initial_hosts is a comma-separated list (without spaces) of the host:port of where to
# find one or more of the known Cluster members, if they are already present.
# If none of them can be contacted the cluster will be formed by this instance.
# Avoid localhost due to IP resolution issues on some systems.
# Addresses w/o host (:<port>) will use the localhost IP.
ha.initial_hosts=localhost:5001,localhost:5002,localhost:5003
# IP and port for this instance to bind to to communicate data with the
# other neo4j instances in the cluster. This is broadcasted to the other
# cluster members, so different members can have different communication ports.
# Avoid localhost due to IP resolution issues on some systems.
# Addresses w/o host (:<port>) will use the localhost IP.
ha.server=localhost:6003
# IP and port for this instance to bind to, for communicating cluster information
# with the rest of the instances. This will be communicated to the rest of the
# instances via normal cluster traffic but for an instance to join a cluster
# it must already know at least one other instance.
# Port ranges as well as single ports is supported.
# Avoid localhost due to IP resolution issues on some systems.
# Addresses w/o host (:<port>) will use the localhost IP.
# See also ha.initial_hosts
ha.cluster_server=localhost:5003
# The interval at which slaves will pull updates from the master. Comment out
# the option to disable periodic pulling of updates. Unit is seconds.
ha.pull_interval=1
# Amount of slaves the master will try to push a transaction to upon commit (default is 1).
# The master will optimistically continue and not fail the transaction even if it fails to
# reach the push factor. Setting this to 0 will increase write performance when writing
# through master but could potentially lead to branched data (or loss of transaction)
# if the master goes down.
#ha.tx_push_factor=1
# Strategy the master will use when pushing data to slaves (if the push factor is greater than 0).
# There are two options available "fixed" (default) or "round_robin". Fixed will start by
# pushing to slaves ordered by server id (highest first) improving performance since the
# slaves only have to cache up one transaction at a time.
#ha.tx_push_strategy=fixed
# Enable this to be able to upgrade a store from 1.4 -> 1.5 or 1.4 -> 1.6
#allow_store_upgrade=true
# Enable this to specify a parser other than the default one. 1.5, 1.6, 1.7 are available
#cypher_parser_version=1.6
# Enable shell server so that remote clients can connect vi Neo4j shell
#remote_shell_enabled=true
# Specify custom shell port (default is 1337)
#remote_shell_port=1234
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment