Merge branch 'production' of github.com:diaspora/diaspora into production

This commit is contained in:
Daniel Vincent Grippi 2010-09-15 11:55:52 -07:00
commit 10bbf367ad
15 changed files with 77 additions and 113 deletions

View file

@ -32,7 +32,9 @@ class User
many :aspects, :class_name => 'Aspect' many :aspects, :class_name => 'Aspect'
before_validation_on_create :setup_person after_validation_on_create :setup_person
after_create :seed_aspects
before_validation :do_bad_things before_validation :do_bad_things
before_save :downcase_username before_save :downcase_username
@ -299,10 +301,19 @@ class User
"#{self.username}@#{self.terse_url}" "#{self.username}@#{self.terse_url}"
end end
def do_bad_things def do_bad_things
self.password_confirmation = self.password self.password_confirmation = self.password
end end
def seed_aspects
aspect(:name => "Acquaintances")
aspect(:name => "Family")
aspect(:name => "Work")
end
protected
def setup_person def setup_person
self.person.serialized_key ||= User.generate_key.export self.person.serialized_key ||= User.generate_key.export
self.person.email ||= email self.person.email ||= email

View file

@ -27,24 +27,19 @@ set :deploy_via, :checkout
# #
set :rails_env, ENV['rails_env'] || ENV['RAILS_ENV'] || all['default_env'] set :rails_env, ENV['rails_env'] || ENV['RAILS_ENV'] || all['default_env']
role :tom, "tom.joindiaspora.com" role :pivots, config['servers']['pivots']['url']
backers.each{ |backer|
role :backer, "#{backer['username']}.joindiaspora.com", :number => backer['number']
}
#role :ci, "ci.joindiaspora.com"
# If you are using Passenger mod_rails uncomment this: # If you are using Passenger mod_rails uncomment this:
# if you're still using the script/reapear helper you will need # if you're still using the script/reapear helper you will need
# these http://github.com/rails/irs_process_scripts # these http://github.com/rails/irs_process_scripts
# Start Nginx # Start Nginx
after "deploy:cold" do after "deploy:cold" do
run("nginx stop") run("nginx")
run("killall nginx")
#run("nginx")
end end
namespace :deploy do namespace :deploy do
task :symlink_images do task :symlink_images do
run "mkdir -p #{shared_path}/uploads" run "mkdir -p #{shared_path}/uploads"
run "ln -s -f #{shared_path}/uploads #{current_path}/public/uploads" run "ln -s -f #{shared_path}/uploads #{current_path}/public/uploads"
@ -61,14 +56,14 @@ namespace :deploy do
end end
task :start_mongo do task :start_mongo do
run("mkdir -p -v #{current_path}/log/db/ ") run("mkdir -p -v #{current_path}/log/db/ ")
run("mkdir -p -v #{shared_path}/db/") run("mkdir -p -v #{shared_path}/db/")
run("mongod --fork --logpath #{current_path}/log/db/mongolog.txt --dbpath #{shared_path}/db/ " ) run("mongod --fork --logpath #{current_path}/log/db/mongolog.txt --dbpath #{shared_path}/db/ " )
end end
task :start_thin do task :start_thin do
run("mkdir -p -v #{current_path}/log/thin/ ") run("mkdir -p -v #{current_path}/log/thin/ ")
run("cd #{current_path} && bundle exec thin start -C config/thin.yml") run("cd #{current_path} && bundle exec thin start -C config/thin.yml")
end end
task :stop do task :stop do
@ -76,6 +71,11 @@ namespace :deploy do
run("killall -s 2 mongod || true") run("killall -s 2 mongod || true")
end end
task :go_cold do
stop
run("killall nginx")
end
task :stop_thin do task :stop_thin do
run("killall -s 2 ruby || true") run("killall -s 2 ruby || true")
#run("cd #{current_path} && bundle exec thin stop -C config/thin.yml || true") #run("cd #{current_path} && bundle exec thin stop -C config/thin.yml || true")
@ -117,31 +117,12 @@ namespace :cloud do
end end
namespace :db do namespace :db do
task :purge, :roles => [:tom, :backer] do task :purge, :roles => [:pivots] do
run "cd #{current_path} && bundle exec rake db:purge --trace RAILS_ENV=#{rails_env}" run "cd #{current_path} && bundle exec rake db:purge --trace RAILS_ENV=#{rails_env}"
end end
task :tom_seed, :roles => :tom do
run "cd #{current_path} && bundle exec rake db:seed:tom --trace RAILS_ENV=#{rails_env}"
run "curl -silent -u tom@tom.joindiaspora.com:evankorth http://tom.joindiaspora.com/zombiefriends"
backers.each do |backer|
run "curl -silent -u #{backer['username']}@#{backer['username']}.joindiaspora.com:#{backer['username']}#{backer['pin']} http://#{backer['username']}.joindiaspora.com/zombiefriendaccept"
#run "curl -silent -u #{backer['username']}@#{backer['username']}.joindiaspora.com:#{backer['username']}#{backer['pin']} http://#{backer['username']}.joindiaspora.com/set_profile_photo"
end
end
task :backer_seed, :roles => :backer do
(0..10).each { |n|
run "curl -silent http://localhost/set_backer_number?number=#{n}", :only => {:number => n}
}
run "cd #{current_path} && bundle exec rake db:seed:backer --trace RAILS_ENV=#{rails_env}"
end
task :reset do task :reset do
purge purge
backer_seed
tom_seed
end end

View file

@ -7,65 +7,9 @@
cross_server: cross_server:
deploy_to: '/usr/local/app/diaspora' deploy_to: '/usr/local/app/diaspora'
user: 'root' user: 'root'
branch: 'production'
repo: 'git@github.com:diaspora/diaspora.git' repo: 'git@github.com:diaspora/diaspora.git'
branch: 'master' default_env: 'production'
default_env: 'development'
servers: servers:
tom: pivots:
- url: 'tom.joindiaspora.com' url: 'pivots.joindiaspora.com'
backer:
- username: 'washington'
given_name: 'George'
family_name: 'Washington'
number: 0
pin: 5072
- username: 'adams'
given_name: 'John'
family_name: 'Adams'
number: 1
pin: 3742
- username: 'jefferson'
given_name: 'Thomas'
family_name: 'Jefferson'
number: 2
pin: 7782
- username: 'madison'
given_name: 'James'
family_name: 'Madison'
number: 3
pin: 2691
- username: 'monroe'
given_name: 'James'
family_name: 'Monroe'
number: 4
pin: 6133
- username: 'quincyadams'
given_name: 'John Quincy'
family_name: 'Adams'
number: 5
pin: 7558
- username: 'jackson'
given_name: 'Andrew'
family_name: 'Jackson'
number: 6
pin: 8670
- username: 'buren'
given_name: 'Martin'
family_name: 'Van Buren'
number: 7
pin: 1559
- username: 'harrison'
given_name: 'William Henry'
family_name: 'Harrison'
number: 8
pin: 5404
- username: 'tyler'
given_name: 'John'
family_name: 'Tyler'
number: 9
pin: 6431
- username: 'polk'
given_name: 'James K.'
family_name: 'Polk'
number: 10
pin: 1957

View file

@ -21,8 +21,19 @@ Diaspora::Application.configure do
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
# Don't care if the mailer can't send # Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false config.action_mailer.raise_delivery_errors = true
config.active_support.deprecation = :log config.active_support.deprecation = :log
config.middleware.use MongoMapper::ClearDevMemory config.middleware.use MongoMapper::ClearDevMemory
#config.threadsafe! #config.threadsafe!
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = {:host => 'localhost:3000'}
config.action_mailer.smtp_settings = {
:address => 'smtp.gmail.com',
:port => 587,
:domain => 'mail.joindiaspora.com',
:authentication => 'plain',
:user_name => 'diaspora-pivots@joindiaspora.com',
:password => "xy289|]G+R*-kA",
:enable_starttls_auto => true
}
end end

View file

@ -15,10 +15,10 @@ Diaspora::Application.configure do
config.action_controller.perform_caching = true config.action_controller.perform_caching = true
# Specifies the header that your server uses for sending files # Specifies the header that your server uses for sending files
config.action_dispatch.x_sendfile_header = "X-Sendfile" #config.action_dispatch.x_sendfile_header = "X-Sendfile"
# For nginx: # For nginx:
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
# If you have no front-end server that supports something like X-Sendfile, # If you have no front-end server that supports something like X-Sendfile,
# just comment this out and Rails will serve the files # just comment this out and Rails will serve the files
@ -34,7 +34,7 @@ Diaspora::Application.configure do
# Disable Rails's static asset server # Disable Rails's static asset server
# In production, Apache or nginx will already do this # In production, Apache or nginx will already do this
config.serve_static_assets = true #config.serve_static_assets = true
# Enable serving of images, stylesheets, and javascripts from an asset server # Enable serving of images, stylesheets, and javascripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com" # config.action_controller.asset_host = "http://assets.example.com"
@ -42,12 +42,20 @@ Diaspora::Application.configure do
# Disable delivery errors, bad email addresses will be ignored # Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false # config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found) # the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true config.i18n.fallbacks = true
config.threadsafe! config.threadsafe!
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = {:host => 'pivots.joindiaspora.com'}
config.action_mailer.smtp_settings = {
:address => 'smtp.gmail.com',
:port => 587,
:domain => 'mail.joindiaspora.com',
:authentication => 'plain',
:user_name => 'diaspora-pivots@joindiaspora.com',
:password => "xy289|]G+R*-kA",
:enable_starttls_auto => true
}
end end

View file

@ -38,7 +38,7 @@ http {
server { server {
listen 80; listen 80;
server_name babycakes.sofaer.net www.babycakes.sofaer.net; server_name pivots.joindiaspora.com www.pivots.joindiaspora.com;
root /usr/local/app/diaspora/current; root /usr/local/app/diaspora/current;
location / { location / {

View file

@ -13,7 +13,7 @@ require "#{File.dirname(__FILE__)}/packages/server"
require "#{File.dirname(__FILE__)}/packages/scm" require "#{File.dirname(__FILE__)}/packages/scm"
require "#{File.dirname(__FILE__)}/packages/ruby" require "#{File.dirname(__FILE__)}/packages/ruby"
policy :diaspora, :roles => [:tom,:backer] do policy :diaspora, :roles => [:pivots] do
# requires :clean_dreamhost # requires :clean_dreamhost
requires :tools requires :tools
requires :rubygems requires :rubygems

View file

@ -13,9 +13,9 @@ max_conns: 1024
require: [] require: []
max_persistent_conns: 512 max_persistent_conns: 512
environment: development environment: production
servers: 1 servers: 1
daemonize: true daemonize: true
#chdir: /usr/applications/localhash/current #chdir: /usr/applications/localhash/current
#socket: /tmp/thin.sock socket: /tmp/thin.sock
port: 80 #port: 80

View file

@ -7,6 +7,7 @@
require 'config/environment' require 'config/environment'
remote_url = "http://tom.joindiaspora.com/" remote_url = "http://tom.joindiaspora.com/"
remote_url = "http://localhost:3000/"
# Create seed user # Create seed user
user = User.instantiate!( :email => "tom@tom.joindiaspora.com", user = User.instantiate!( :email => "tom@tom.joindiaspora.com",
:username => "tom", :username => "tom",

View file

@ -31,7 +31,7 @@ end
Factory.define :user do |u| Factory.define :user do |u|
u.sequence(:username) {|n| "bob#{n}"} u.sequence(:username) {|n| "bob#{n}"}
u.sequence(:email) {|n| "bob#{n}@aol.com"} u.sequence(:email) {|n| "bob#{n}@pivotallabs.com"}
u.password "bluepin7" u.password "bluepin7"
u.password_confirmation "bluepin7" u.password_confirmation "bluepin7"
u.person { |a| Factory.create(:person_with_user, :owner_id => a._id)} u.person { |a| Factory.create(:person_with_user, :owner_id => a._id)}

View file

@ -52,8 +52,7 @@ describe Aspect do
it 'belong to a user' do it 'belong to a user' do
@aspect.user.id.should == @user.id @aspect.user.id.should == @user.id
@user.aspects.size.should == 1 @user.aspects.size.should == 4
@user.aspects.first.id.should == @aspect.id
end end
it 'should have people' do it 'should have people' do

View file

@ -20,7 +20,6 @@ describe Request do
end end
it 'should generate xml for the User as a Person' do it 'should generate xml for the User as a Person' do
request = @user.send_friend_request_to Factory.create(:person), @aspect request = @user.send_friend_request_to Factory.create(:person), @aspect
xml = request.to_xml.to_s xml = request.to_xml.to_s

View file

@ -12,6 +12,15 @@ describe User do
@aspect = @user.aspect(:name => 'heroes') @aspect = @user.aspect(:name => 'heroes')
end end
it 'should create with pivotal or allowed emails' do
user1 = Factory.create(:user, :email => "kimfuh@yahoo.com")
user2 = Factory.create(:user, :email => "awesome@sofaer.net")
user3 = Factory.create(:user, :email => "steveellis@pivotallabs.com")
user1.created_at.nil?.should be false
user2.created_at.nil?.should be false
user3.created_at.nil?.should be false
end
describe 'profiles' do describe 'profiles' do
it 'should be able to update their profile and send it to their friends' do it 'should be able to update their profile and send it to their friends' do
Factory.create(:person) Factory.create(:person)

View file

@ -38,6 +38,7 @@ RSpec.configure do |config|
config.before(:each) do config.before(:each) do
DatabaseCleaner.start DatabaseCleaner.start
stub_sockets stub_sockets
User.stub!(:allowed_email?).and_return(:true)
end end
config.after(:each) do config.after(:each) do