Version: 1.9.8
Platform: x86_64
First, install or update to the latest system software.
sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
# First configure your models to use Amazon s3 as storage option and setup the associated S3 config. | |
# Then add the classes your want to migrate in the klasses array below. | |
# Then run rake paperclip_migration:migrate_to_s3 | |
# Should work but this is untested and may need some tweaking - but it did the job for me. | |
namespace :paperclip_migration do | |
desc "migrate files from filesystem to s3" | |
task :migrate_to_s3 => :environment do | |
klasses = [:model_1, :model_2] # Replace with your real model names. If anyone wants to this could be picked up from args or from configuration. | |
klasses.each do |klass_key| |
namespace :deploy do | |
desc "Hot-reload God configuration for the Resque worker" | |
task :reload_god_config do | |
sudo "god stop resque" | |
sudo "god load #{File.join(deploy_to, 'current', 'config', 'resque-' + rails_env + '.god')}" | |
sudo "god start resque" | |
end | |
end | |
# append to the bottom: |
namespace :deploy do | |
task :setup_solr_data_dir do | |
run "mkdir -p #{shared_path}/solr/data" | |
end | |
end | |
namespace :solr do | |
desc "start solr" | |
task :start, :roles => :app, :except => { :no_release => true } do | |
run "cd #{current_path} && RAILS_ENV=#{rails_env} bundle exec sunspot-solr start --port=8983 --data-directory=#{shared_path}/solr/data --pid-dir=#{shared_path}/pids" |
# An example of elasticsearch & Tire setup for ActiveRecord associations. | |
# | |
# A `Book has_many :chapters` scenario, with mapping and JSON serialization | |
# for indexing associated models. | |
# | |
# Demonstrates three important caveats as of now: | |
# | |
# 1. You you have to use `touch: true` in the `belongs_to` declaration, | |
# to automatically notify the parent model about the update. | |
# |
upstream unicorn { | |
server unix:/tmp/unicorn.app_name.sock fail_timeout=0; | |
} | |
server { | |
server_name domain.com www.domain.com; | |
listen 80 default deferred; | |
root /opt/apps/app_path/public; |
# | |
# PostgreSQL writes two optional commands to the database schema | |
# file, called db/structure.sql, that can only be run as a root | |
# database user. These are not needed actually, so comment them | |
# out automatically | |
# | |
# CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; | |
# COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; | |
# | |
namespace :db do |
module A | |
def do_something | |
puts 'A->do_something' | |
super | |
end | |
end | |
module B | |
def do_something | |
puts 'B->do_something' |
class @Facebook | |
rootElement = null | |
eventsBound = false | |
@load: -> | |
unless $('#fb-root').size() > 0 | |
initialRoot = $('<div>').attr('id', 'fb-root') | |
$('body').prepend initialRoot |
#I hate UPCASE data on the DB, so I made this to prevent it | |
before_save :titleize_fields | |
def titleize_fields | |
['name', 'paternal_lastname', 'maternal_lastname', 'spouse'].each do |m| | |
self.send("#{m}=", instance_eval(%Q{#{m}.titleize unless #{m}.nil?})) | |
end | |
end |