-
Ubuntu 10.10 (以下默认为使用此发布版Linux,其他版本方法类似)
-
Git
参考安装方法:
add-apt-repository "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" apt-get update
apt-get install mongodb-10gen
| module Mongoid | |
| # Caches the entire document in a Marshall and Redis. | |
| # Defines Document#get(id), adds methods to recache document after a save. | |
| # Add `include Mongoid::CachedDocument` in your model to enable the feature. | |
| module CachedDocument | |
| def self.included(base) | |
| base.class_eval do | |
| include InstanceMethods | |
| extend ClassMethods | |
| before_save :refresh_cache |
| #!/usr/bin/env ruby | |
| require "rubygems" # ruby1.9 doesn't "require" it though | |
| require "thor" | |
| require "yaml" | |
| class Deploy < Thor | |
| include Thor::Actions | |
| desc "init","create a local site" | |
| def init | |
| #domain = safe_ask("Deploy domain",options[:domain]) |
| ## | |
| # Calendar helper with proper events | |
| # http://www.cuppadev.co.uk/webdev/making-a-real-calendar-in-rails/ | |
| # | |
| # (C) 2009 James S Urquhart (jamesu at gmail dot com) | |
| # Derived from calendar_helper | |
| # (C) Jeremy Voorhis, Geoffrey Grosenbach, Jarkko Laine, Tom Armitage, Bryan Larsen | |
| # Licensed under MIT. http://www.opensource.org/licenses/mit-license.php | |
| ## | |
| description "juggernaut" | |
| author "andrew toknight@gmail.com" | |
| # must be start after redis-server | |
| start on started redis-server | |
| stop on stopped redis-server | |
| # Automatically Respawn: | |
| respawn | |
| respawn limit 99 5 |
| #https://gist.github.com/1351456 | |
| #based on http://gist.github.com/1236567.git | |
| class BootstrapFormBuilder < ActionView::Helpers::FormBuilder | |
| def get_error_text(object, field, options) | |
| if object.nil? || options[:hide_errors] | |
| "" | |
| else | |
| errors = object.errors[field.to_sym] | |
| if errors.empty? then "" else errors.first end |
| # nginx | |
| description "nginx http daemon" | |
| author "George Shammas <georgyo@gmail.com>" | |
| start on (filesystem and net-device-up IFACE=lo) | |
| stop on runlevel [!2345] | |
| env DAEMON=/opt/nginx/sbin/nginx | |
| env PID=/var/run/nginx.pid |
| # 在本地服务器建立 rubygems.org 的镜像缓存,以提高 gem 的安装速度 | |
| # 此配置设置缓存过期为1天,也就是说,新上的 gem 无法马上安装 | |
| # 做这个起什么作用? | |
| # rubygems 的很多资源文件是存放到 Amazon S3 上面的,由于 GFW 对某些 S3 服务器又连接重置或丢包,导致 gem 安装异常缓慢或有时候根本无法连接安装。 | |
| # 而通过这种跳板的方式可以很好的解决这个问题,当然前提是 Nginx反向代理 服务器需要在国外 | |
| proxy_cache_path /var/cache/rubygems levels=1:2 keys_zone=RUBYGEMS:10m | |
| inactive=24h max_size=1g; | |
| server { | |
| listen 80; |