made single process mode configuration more consistent
* SINGLE_PROCESS_MODE environment variable takes precedence over application.yml setting * SINGLE_PROCESS environment variable takes precedence over SINGLE_PROCESS_MODE environment variable to be backward compatible
This commit is contained in:
parent
28b6e276f8
commit
a614985d83
5 changed files with 10 additions and 4 deletions
|
|
@ -132,4 +132,8 @@ HELP
|
||||||
end
|
end
|
||||||
return @@pod_uri
|
return @@pod_uri
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.single_process_mode?
|
||||||
|
(ENV['SINGLE_PROCESS'] == "true" || ENV['SINGLE_PROCESS_MODE'] == "true" || self[:single_process_mode]) ? true : false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
-# licensed under the Affero General Public License version 3 or later. See
|
-# licensed under the Affero General Public License version 3 or later. See
|
||||||
-# the COPYRIGHT file.
|
-# the COPYRIGHT file.
|
||||||
|
|
||||||
-if ENV['SINGLE_PROCESS']
|
-if AppConfig.single_process_mode?
|
||||||
:javascript
|
:javascript
|
||||||
var websocket_enabled = false
|
var websocket_enabled = false
|
||||||
- else
|
- else
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ if !ENV['SINGLE_PROCESS'] && AppConfig[:redis_url]
|
||||||
Resque.redis = Redis.new(:host => AppConfig[:redis_url], :port => 6379)
|
Resque.redis = Redis.new(:host => AppConfig[:redis_url], :port => 6379)
|
||||||
end
|
end
|
||||||
|
|
||||||
if ENV['SINGLE_PROCESS'] || AppConfig.single_process_mode
|
if AppConfig.single_process_mode?
|
||||||
if Rails.env == 'production'
|
if Rails.env == 'production'
|
||||||
puts "WARNING: You are running Diaspora in production without Resque workers turned on. Please don't do this."
|
puts "WARNING: You are running Diaspora in production without Resque workers turned on. Please don't do this."
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,11 @@ if ARGV.length >= 1
|
||||||
require 'settingslogic'
|
require 'settingslogic'
|
||||||
require File.join(Rails.root, 'app', 'models', 'app_config')
|
require File.join(Rails.root, 'app', 'models', 'app_config')
|
||||||
setting_name = setting_name.to_sym
|
setting_name = setting_name.to_sym
|
||||||
if AppConfig[setting_name].nil?
|
if (!AppConfig.respond_to?(setting_name) || AppConfig.send(setting_name).nil?) && AppConfig[setting_name].nil?
|
||||||
$stderr.puts "Could not find setting #{ARGV[0]} for environment #{Rails.env}."
|
$stderr.puts "Could not find setting #{ARGV[0]} for environment #{Rails.env}."
|
||||||
Process.exit(1)
|
Process.exit(1)
|
||||||
|
elsif AppConfig.respond_to?(setting_name)
|
||||||
|
print AppConfig.send(setting_name)
|
||||||
else
|
else
|
||||||
print AppConfig[setting_name]
|
print AppConfig[setting_name]
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ fi
|
||||||
|
|
||||||
# Start Diaspora
|
# Start Diaspora
|
||||||
|
|
||||||
if [ "$SINGLE_PROCESS" != "true" ]; then
|
if [ "$(./script/get_config.rb 'single_process_mode?')" != "true" ]; then
|
||||||
redis_config
|
redis_config
|
||||||
redis-server config/redis.conf &>log/redis-console.log &
|
redis-server config/redis.conf &>log/redis-console.log &
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue