This is a sample config I use for CBA on two debian boxes
- edge.iboard.cc is the "master" where the app is running
- s1.iboard.cc is the "slave" where mongo is running as a kind of backup
/etc/mongodb/mongodb.conf
| # | |
| # Description at http://r3.iboard.cc/postings/30 | |
| # | |
| class Application < Thor | |
| desc "restart [--worker_only]", "kill 'rake jobs:work' and 'touch tmp/restart.txt'" | |
| method_options :worker_only => :boolean | |
| def restart | |
| kill_pid("ps x|grep 'rake jobs:work'|grep -v grep") | |
| unless options[:worker_only] |
| class Author | |
| include Mongoid::Document | |
| include Mongoid::Timestamps | |
| ... | |
| references_and_referenced_in_many :institutes | |
| after_save :update_institutes #WORKAROUND | |
| ... | |
| private | |
| ... |
| # Referenced in: http://cba.iboard.cc/p/readme | |
| class User | |
| include Mongoid::Document | |
| include Mongoid::Timestamps | |
| include Mongoid::Paperclip | |
| ..... | |
| # Notifications | |
| after_create :async_notify_on_creation | |
| before_destroy :async_notify_on_cancellation |
| # MODEL | |
| class Page | |
| include Mongoid::Document | |
| include Mongoid::Timestamps | |
| include CoverPicture | |
| #.... | |
| field :is_template, :type => Boolean, :default => false | |
| default_scope where(is_template: false ) |
| <!- | |
| save this in /Library/LaunchDaemons/org.mongodb.mongod.plist | |
| use with: lauchctl load org.mongodb.mongod | |
| -> | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" | |
| "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> |
| cnt_tabs = $(".side-tab").length | |
| for idx in [0..(cnt_tabs-1)] | |
| tab = $(".side-tab:nth-child(#{idx})") | |
| unless tab.attr('id') == "side-tab-#{except.attr('id')}" | |
| tab.hide() |
| # -*- encoding : utf-8 -*- | |
| namespace :locales do | |
| desc "Find undefined locales" | |
| task :undefined_locales => :environment do | |
| used_strings = [] | |
| Dir['**/*'].each do |file| | |
| if File::ftype(file) == "file" | |
| begin |
| # | |
| # I had a model where the fields banner_title and banner_text was simple text-fields | |
| # Then I added :localized => true to this fields and all specs pass because specs use new data. | |
| # On my production-server the app crashed because of "nil-fields". | |
| # | |
| # I figured out how to solve this by initializing the _translations for existing records. | |
| # Feel free to use my example in your production-environment - but, sure, without any warranty. | |
| # | |
| # [email protected], August 8, 2012 | |
| # |
| # How I managed to install #ruby-2.0 with #rvm on #MacOS 10.8 | |
| export CC=/usr/bin/gcc | |
| rvm pkg install openssl | |
| rvm install ruby-head --with-gcc=clang --verify-downloads 1 # see * | |
| rvm use ruby-head | |
| ruby -v | |
| ruby 2.0.0dev (2013-02-24) [x86_64-darwin12.2.0] | |