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

@ -39,4 +39,4 @@ class UsersController < ApplicationController
params[:profile][:image_url] = "http://" + request.host + ":" + request.port.to_s + params[:profile][:image_url]
end
end
end
end

View file

@ -32,7 +32,9 @@ class User
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_save :downcase_username
@ -299,10 +301,19 @@ class User
"#{self.username}@#{self.terse_url}"
end
def do_bad_things
self.password_confirmation = self.password
end
def seed_aspects
aspect(:name => "Acquaintances")
aspect(:name => "Family")
aspect(:name => "Work")
end
protected
def setup_person
self.person.serialized_key ||= User.generate_key.export
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']
role :tom, "tom.joindiaspora.com"
backers.each{ |backer|
role :backer, "#{backer['username']}.joindiaspora.com", :number => backer['number']
}
#role :ci, "ci.joindiaspora.com"
role :pivots, config['servers']['pivots']['url']
# If you are using Passenger mod_rails uncomment this:
# if you're still using the script/reapear helper you will need
# these http://github.com/rails/irs_process_scripts
# Start Nginx
after "deploy:cold" do
run("nginx stop")
run("killall nginx")
#run("nginx")
run("nginx")
end
namespace :deploy do
task :symlink_images do
run "mkdir -p #{shared_path}/uploads"
run "ln -s -f #{shared_path}/uploads #{current_path}/public/uploads"
@ -61,21 +56,26 @@ namespace :deploy do
end
task :start_mongo do
run("mkdir -p -v #{current_path}/log/db/ ")
run("mkdir -p -v #{shared_path}/db/")
run("mongod --fork --logpath #{current_path}/log/db/mongolog.txt --dbpath #{shared_path}/db/ " )
run("mkdir -p -v #{current_path}/log/db/ ")
run("mkdir -p -v #{shared_path}/db/")
run("mongod --fork --logpath #{current_path}/log/db/mongolog.txt --dbpath #{shared_path}/db/ " )
end
task :start_thin do
run("mkdir -p -v #{current_path}/log/thin/ ")
run("cd #{current_path} && bundle exec thin start -C config/thin.yml")
run("mkdir -p -v #{current_path}/log/thin/ ")
run("cd #{current_path} && bundle exec thin start -C config/thin.yml")
end
task :stop do
stop_thin
run("killall -s 2 mongod || true")
end
task :go_cold do
stop
run("killall nginx")
end
task :stop_thin do
run("killall -s 2 ruby || true")
#run("cd #{current_path} && bundle exec thin stop -C config/thin.yml || true")
@ -117,31 +117,12 @@ namespace :cloud do
end
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}"
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
purge
backer_seed
tom_seed
end

View file

@ -7,65 +7,9 @@
cross_server:
deploy_to: '/usr/local/app/diaspora'
user: 'root'
branch: 'production'
repo: 'git@github.com:diaspora/diaspora.git'
branch: 'master'
default_env: 'development'
default_env: 'production'
servers:
tom:
- url: 'tom.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
pivots:
url: 'pivots.joindiaspora.com'

View file

@ -21,8 +21,19 @@ Diaspora::Application.configure do
config.action_controller.perform_caching = false
# 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.middleware.use MongoMapper::ClearDevMemory
#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

View file

@ -15,10 +15,10 @@ Diaspora::Application.configure do
config.action_controller.perform_caching = true
# 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:
# 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,
# just comment this out and Rails will serve the files
@ -34,7 +34,7 @@ Diaspora::Application.configure do
# Disable Rails's static asset server
# 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
# 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
# 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
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
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

View file

@ -38,7 +38,7 @@ http {
server {
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;
location / {

View file

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

View file

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

View file

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

View file

@ -31,7 +31,7 @@ end
Factory.define :user do |u|
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_confirmation "bluepin7"
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
@aspect.user.id.should == @user.id
@user.aspects.size.should == 1
@user.aspects.first.id.should == @aspect.id
@user.aspects.size.should == 4
end
it 'should have people' do

View file

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

View file

@ -11,6 +11,15 @@ describe User do
@user = Factory.create(:user)
@aspect = @user.aspect(:name => 'heroes')
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
it 'should be able to update their profile and send it to their friends' do

View file

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