Merge branch 'stable' into develop

This commit is contained in:
Dennis Schubert 2015-05-19 02:55:36 +02:00
commit 00cb87ce11
10 changed files with 126 additions and 57 deletions

View file

@ -24,6 +24,7 @@ Ruby 2.0 is no longer officially supported.
* Do not retry a couple of unrecoverable job failures [#5938](https://github.com/diaspora/diaspora/pull/5938) [#5942](https://github.com/diaspora/diaspora/pull/5943) * Do not retry a couple of unrecoverable job failures [#5938](https://github.com/diaspora/diaspora/pull/5938) [#5942](https://github.com/diaspora/diaspora/pull/5943)
* Remove some old temporary workarounds [#5964](https://github.com/diaspora/diaspora/pull/5964) * Remove some old temporary workarounds [#5964](https://github.com/diaspora/diaspora/pull/5964)
* Remove unused `hasPhotos` and `hasText` functions [#5969](https://github.com/diaspora/diaspora/pull/5969) * Remove unused `hasPhotos` and `hasText` functions [#5969](https://github.com/diaspora/diaspora/pull/5969)
* Replace foreman with eye [#5966](https://github.com/diaspora/diaspora/pull/5966)
## Bug fixes ## Bug fixes
* Disable auto follow back on aspect deletion [#5846](https://github.com/diaspora/diaspora/pull/5846) * Disable auto follow back on aspect deletion [#5846](https://github.com/diaspora/diaspora/pull/5846)

View file

@ -203,7 +203,7 @@ group :production do # we don"t install these on travis to speed up test runs
# Process management # Process management
gem "foreman", "0.62" gem "eye", "0.7.pre"
# Redirects # Redirects

View file

@ -88,6 +88,9 @@ GEM
mime-types (>= 1.16) mime-types (>= 1.16)
celluloid (0.16.0) celluloid (0.16.0)
timers (~> 4.0.0) timers (~> 4.0.0)
celluloid-io (0.16.2)
celluloid (>= 0.16.0)
nio4r (>= 1.1.0)
childprocess (0.5.6) childprocess (0.5.6)
ffi (~> 1.0, >= 1.0.11) ffi (~> 1.0, >= 1.0.11)
chunky_png (1.3.4) chunky_png (1.3.4)
@ -173,6 +176,12 @@ GEM
eventmachine (1.0.7) eventmachine (1.0.7)
excon (0.45.3) excon (0.45.3)
execjs (2.5.2) execjs (2.5.2)
eye (0.7.pre)
celluloid (~> 0.16.0)
celluloid-io (~> 0.16.0)
sigar (~> 0.7.2)
state_machine
thor
factory_girl (4.5.0) factory_girl (4.5.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
factory_girl_rails (4.5.0) factory_girl_rails (4.5.0)
@ -287,8 +296,6 @@ GEM
nokogiri (~> 1.5, >= 1.5.11) nokogiri (~> 1.5, >= 1.5.11)
font-awesome-rails (4.3.0.0) font-awesome-rails (4.3.0.0)
railties (>= 3.2, < 5.0) railties (>= 3.2, < 5.0)
foreman (0.62.0)
thor (>= 0.13.6)
formatador (0.2.5) formatador (0.2.5)
fuubar (2.0.0) fuubar (2.0.0)
rspec (~> 3.0) rspec (~> 3.0)
@ -411,6 +418,7 @@ GEM
net-scp (1.2.1) net-scp (1.2.1)
net-ssh (>= 2.6.5) net-ssh (>= 2.6.5)
net-ssh (2.9.2) net-ssh (2.9.2)
nio4r (1.1.0)
nokogiri (1.6.6.2) nokogiri (1.6.6.2)
mini_portile (~> 0.6.0) mini_portile (~> 0.6.0)
notiffany (0.0.6) notiffany (0.0.6)
@ -636,6 +644,7 @@ GEM
celluloid (>= 0.14.1) celluloid (>= 0.14.1)
ice_cube (= 0.11.1) ice_cube (= 0.11.1)
sidekiq (>= 3.0.0) sidekiq (>= 3.0.0)
sigar (0.7.3)
simple_captcha2 (0.3.4) simple_captcha2 (0.3.4)
rails (>= 4.1) rails (>= 4.1)
simple_oauth (0.2.0) simple_oauth (0.2.0)
@ -660,6 +669,7 @@ GEM
actionpack (>= 3.0) actionpack (>= 3.0)
activesupport (>= 3.0) activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0) sprockets (>= 2.8, < 4.0)
state_machine (1.2.0)
systemu (2.6.5) systemu (2.6.5)
test_after_commit (0.4.1) test_after_commit (0.4.1)
activerecord (>= 3.2) activerecord (>= 3.2)
@ -729,13 +739,13 @@ DEPENDENCIES
devise_lastseenable (= 0.0.4) devise_lastseenable (= 0.0.4)
diaspora-vines (~> 0.1.27) diaspora-vines (~> 0.1.27)
entypo-rails (= 2.2.3) entypo-rails (= 2.2.3)
eye (= 0.7.pre)
factory_girl_rails (= 4.5.0) factory_girl_rails (= 4.5.0)
faraday (= 0.9.1) faraday (= 0.9.1)
faraday-cookie_jar (= 0.0.6) faraday-cookie_jar (= 0.0.6)
faraday_middleware (= 0.9.1) faraday_middleware (= 0.9.1)
fixture_builder (= 0.3.6) fixture_builder (= 0.3.6)
fog (= 1.30.0) fog (= 1.30.0)
foreman (= 0.62)
fuubar (= 2.0.0) fuubar (= 2.0.0)
gon (= 5.2.3) gon (= 5.2.3)
guard (= 2.12.5) guard (= 2.12.5)

View file

@ -1,3 +1,2 @@
web: bin/bundle exec unicorn_rails -c config/unicorn.rb -p $PORT web: bin/bundle exec unicorn -c config/unicorn.rb -p $PORT
sidekiq: bin/bundle exec sidekiq sidekiq: bin/bundle exec sidekiq
xmpp: bin/bundle exec vines start

16
bin/eye Executable file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'eye' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
require 'rubygems'
require 'bundler/setup'
load Gem.bin_path('eye', 'eye')

View file

@ -32,7 +32,8 @@ defaults:
host: host:
pubsub_server: 'https://pubsubhubbub.appspot.com/' pubsub_server: 'https://pubsubhubbub.appspot.com/'
server: server:
port: 3000 port:
listen: '0.0.0.0:3000'
rails_environment: 'development' rails_environment: 'development'
stderr_log: stderr_log:
stdout_log: stdout_log:

View file

@ -140,8 +140,13 @@ configuration: ## Section
## Settings affecting how ./script/server behaves. ## Settings affecting how ./script/server behaves.
server: ## Section server: ## Section
## Where the appserver should listen to (default=0.0.0.0:3000)
#listen: '127.0.0.1:3000'
#listen: 'unix:tmp/diaspora.sock'
#listen: 'unix:/run/diaspora/diaspora.sock'
## The port on which the appserver should listen (default=3000). ## The port on which the appserver should listen (default=none).
## Note: this setting is deprecated, use listen instead.
#port: 3000 #port: 3000
## Rails environment (default='development'). ## Rails environment (default='development').

48
config/eye.rb Normal file
View file

@ -0,0 +1,48 @@
require_relative "load_config"
rails_env = ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development"
Eye.config do
logger Logger.new(STDOUT)
end
Eye.application("diaspora") do
working_dir Rails.root.to_s
env "DB" => ENV["DB"], "RAILS_ENV" => rails_env
stdall "log/eye_processes.log"
process :web do
start_command "bin/bundle exec unicorn -c config/unicorn.rb"
daemonize true
pid_file "tmp/pids/web.pid"
stop_signals [:TERM, 10.seconds]
env "PORT" => ENV["PORT"]
monitor_children do
stop_command "kill -QUIT {PID}"
end
end
group :sidekiq do
with_condition(!AppConfig.environment.single_process_mode?) do
AppConfig.server.sidekiq_workers.to_i.times do |i|
i += 1
process "sidekiq#{i}" do
start_command "bin/bundle exec sidekiq"
daemonize true
pid_file "tmp/pids/sidekiq#{i}.pid"
stop_signals [:USR1, 0, :TERM, 10.seconds, :KILL]
end
end
end
end
with_condition(AppConfig.chat.enabled? && AppConfig.chat.server.enabled?) do
process :xmpp do
start_command "bin/bundle exec vines start"
daemonize true
pid_file "tmp/pids/xmpp.pid"
stop_signals [:TERM, 10.seconds, :KILL]
end
end
end

View file

@ -1,29 +1,19 @@
require File.expand_path('../load_config', __FILE__) require_relative "load_config"
# Enable and set these to run the worker as a different user/group port = ENV["PORT"]
#user = 'diaspora' port = port && !port.empty? ? port.to_i : nil
#group = 'diaspora'
listen port || AppConfig.server.listen.get unless RACKUP[:set_listener]
worker_processes AppConfig.server.unicorn_worker.to_i worker_processes AppConfig.server.unicorn_worker.to_i
## Load the app before spawning workers
preload_app true
# How long to wait before killing an unresponsive worker
timeout AppConfig.server.unicorn_timeout.to_i timeout AppConfig.server.unicorn_timeout.to_i
@sidekiq_pid = nil
#pid '/var/run/diaspora/diaspora.pid'
#listen '/var/run/diaspora/diaspora.sock', :backlog => 2048
stderr_path AppConfig.server.stderr_log.get if AppConfig.server.stderr_log? stderr_path AppConfig.server.stderr_log.get if AppConfig.server.stderr_log?
stdout_path AppConfig.server.stdout_log.get if AppConfig.server.stdout_log? stdout_path AppConfig.server.stdout_log.get if AppConfig.server.stdout_log?
before_fork do |server, worker| preload_app true
# If using preload_app, enable this line @sidekiq_pid = nil
ActiveRecord::Base.connection.disconnect!
before_fork do |_server, _worker|
ActiveRecord::Base.connection.disconnect! # preloading app in master, so reconnect to DB
# disconnect redis if in use # disconnect redis if in use
unless AppConfig.environment.single_process_mode? unless AppConfig.environment.single_process_mode?
@ -31,23 +21,12 @@ before_fork do |server, worker|
end end
if AppConfig.server.embed_sidekiq_worker? if AppConfig.server.embed_sidekiq_worker?
@sidekiq_pid ||= spawn('bin/bundle exec sidekiq') @sidekiq_pid ||= spawn("bin/bundle exec sidekiq")
end
old_pid = '/var/run/diaspora/diaspora.pid.oldbin'
if File.exists?(old_pid) && server.pid != old_pid
begin
Process.kill("QUIT", File.read(old_pid).to_i)
rescue Errno::ENOENT, Errno::ESRCH
# someone else did our job for us
end
end end
end end
after_fork do |_server, _worker|
after_fork do |server, worker| ActiveRecord::Base.establish_connection # preloading app in master, so reconnect to DB
# If using preload_app, enable this line
ActiveRecord::Base.establish_connection
# We don't generate uuids in the frontend, but let's be on the safe side # We don't generate uuids in the frontend, but let's be on the safe side
UUID.generator.next_sequence UUID.generator.next_sequence

View file

@ -119,18 +119,29 @@ then
export DB export DB
fi fi
if [ -z "$PORT" -a -n "$port" ]
then
warning "Setting port via configuration is deprecated, set listen instead. See the updated config/diaspora.yml.example."
PORT="$port"
fi
args="$@" args="$@"
for arg in $(echo $args | awk '{ for (i = 1; i <= NF; i++) print $i}') for arg in $(echo $args | awk '{ for (i = 1; i <= NF; i++) print $i}')
do do
[ "$prev_arg" = '-p' ] && port="$arg" [ "$prev_arg" = '-p' ] && PORT="$arg"
prev_arg="$arg" prev_arg="$arg"
done done
services=$(chk_service $port ) if [ -n "$PORT" ]
then
export PORT
services=$(chk_service $PORT)
if [ -n "$services" ] if [ -n "$services" ]
then then
fatal "Port $port is already in use.\n\t$services" fatal "Port $port is already in use.\n\t$services"
fi fi
fi
# Force AGPL # Force AGPL
if [ -w "public" -a ! -e "public/source.tar.gz" ] if [ -w "public" -a ! -e "public/source.tar.gz" ]
@ -171,11 +182,7 @@ https://github.com/diaspora/diaspora/issues/4202 for details
" "
fi fi
vines=0 if [ "$chat" = "true" -a "$chat_server" = "true" -a "$chat_bosh_proxy" = "false" ]
if [ "$chat" = "true" ] && [ "$chat_server" = "true" ]
then
vines=1
if [ "$chat_bosh_proxy" = "false" ]
then then
warning " warning "
***************************************************************** *****************************************************************
@ -187,10 +194,13 @@ diaspora.yml.example
***************************************************************** *****************************************************************
" "
fi fi
fi
# Start Diaspora # Start Diaspora
printf "Starting Diaspora in $RAILS_ENV mode on port $port " printf "Starting Diaspora in $RAILS_ENV mode "
if [ -n "$PORT" ]
then
printf "on port $PORT "
fi
if [ "$embed_sidekiq_worker" = "true" ] if [ "$embed_sidekiq_worker" = "true" ]
then then
echo "with a Sidekiq worker embedded into Unicorn." echo "with a Sidekiq worker embedded into Unicorn."
@ -204,4 +214,4 @@ else
fi fi
echo "" echo ""
exec bin/bundle exec foreman start -m "xmpp=$vines,web=1,sidekiq=$workers" -p $port exec bin/bundle exec loader_eye -st -c config/eye.rb