I have a Yaml file and an interface page in my rails app to modify its content. It is working fine on my development machine when i display, modify, and save the changes. But, my concern is that if production environment has 2 nodes running the app, how it is going to sync the changes that made to this file?
I think in that case, there will 2 copies of yadayada.yml file and changes made from user will save it to one of them and the other will still have old structure.
What is the best practice to handle this kind of situations?
PS: Content of the yaml is not something that would be good to keep it in database.
thanks in advance, cheers!
you could create a symlink to a shared folder and put in your yml file there..like the normal database.yml or other config.yml files.
add something like that to your deploy.rb
task :symlink_yaml_file do
run "ln -nfs #{shared_path}/config/yml-file.yml #{release_path}/config/yml-file.yml"
end
as a result of this, normally every node should work with the same file.