-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with HA console when ruby-debug is loaded #240
Comments
Aha, good to know. No I don't if there is a better way. |
I don't think this will work for Pry, as it is defined everywhere in development. As such, both server and console get 2 as a server_id. Our fix was to put the contents of the railtie into config/environments/development.rb, check for Rails::Console:
Make sure you comment out the ha_console/railtie line in application.rb if you go this route. We are still testing, but it's working in our first glance. |
Cool! This fix works for me. |
BTW, if you want the neo-shell back, you can add
To this config, then from a terminal prompt NOTE: The Anyway, I was glad to have the shell back. |
@ruprict, do you plan to submit a pull request for this? |
I could, but have to figure out what will be in that PR. The fixes I have here are pretty much doc changes. From what I have found, the things we need to be defined ( I guess we could put this in an initializer (complete with a I'd love to hear other opinions and/or corrections, as I am prepared to be wrong about this. |
I dug through the Rails source a bit and I think I found the solution. It appears that you can add block to a railtie that will be run when the console is loaded. Something like this should work class Neo4j::Railtie < Rails::Railtie
config.neo4j['ha.server_id'] = 1
console do
config.neo4j['ha.server_id'] = 2
end
after_initialize do
config.neo4j['ha.server'] = "localhost:600#{config.neo4j['ha.server_id']}"
# etc
end
end |
Nice, that's great. Have you tried this? If so, you should definitely PR it. Good work. |
I've not actually tried it, but I'll try it soon when I find some time. |
#261 to fix this |
Thanks @thekendalmiller! |
I tried out the console in HA mode following the instructions here:
https://github.com/andreasronge/neo4j/wiki/Neo4j%3A%3Aha-cluster
It didn't work for me at first - the console kept opening the same database as the rails server and going into readonly mode. Eventually I tracked the problem down to this line:
https://github.com/andreasronge/neo4j/blob/master/lib/neo4j/rails/ha_console/railtie.rb#L12
It turns out in my app, I load the 'ruby-debug' gem. This is loaded by Bundler This in turn loads IRB, which causes both the rails console and server to have IRB loaded.
I worked around the issue by doing the following:
Gemfile:
config/application.rb:
I'm not sure if there's a better way to do this. It's difficult to tell whether one is running in the Rails server or in the console.
The text was updated successfully, but these errors were encountered: