replaced SOCKET_PORT in config/server.sh with the setting from config/app_config.yml; respect single_process_mode setting in app_config.yml in script/server
This commit is contained in:
parent
4875d6557d
commit
00c6631f11
4 changed files with 53 additions and 5 deletions
|
|
@ -2,11 +2,10 @@
|
|||
# Included by script/server
|
||||
#
|
||||
THIN_PORT=3000
|
||||
SOCKET_PORT=8080
|
||||
|
||||
# Choose one mode by uncommenting
|
||||
export RAILS_ENV='development'
|
||||
#export RAILS_ENV='production'
|
||||
export RAILS_ENV='production'
|
||||
|
||||
# See thin -h for possible values.
|
||||
DEFAULT_THIN_ARGS="-p $THIN_PORT -e $RAILS_ENV"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# Copyright (c) 2011, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
|
|
@ -14,6 +14,10 @@ class AppConfig
|
|||
config_vars[key] = value
|
||||
end
|
||||
|
||||
def self.has_key?(key)
|
||||
config_vars.has_key?(key)
|
||||
end
|
||||
|
||||
def self.configure_for_environment(env)
|
||||
load_config_for_environment(env)
|
||||
generate_pod_uri
|
||||
|
|
|
|||
42
script/get_config.rb
Executable file
42
script/get_config.rb
Executable file
|
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/env ruby
|
||||
# Copyright (c) 2011, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
require 'rubygems'
|
||||
require 'yaml'
|
||||
|
||||
require 'active_support/core_ext/class/attribute_accessors'
|
||||
require 'active_support/core_ext/hash/keys'
|
||||
|
||||
class Rails
|
||||
def self.root
|
||||
File.join(File.dirname(__FILE__), "..")
|
||||
end
|
||||
|
||||
def self.env
|
||||
env = 'development'
|
||||
env = ENV['RAILS_ENV'] if ENV.has_key?('RAILS_ENV')
|
||||
env = ARGV[1] if ARGV.length == 2
|
||||
env.downcase
|
||||
end
|
||||
end
|
||||
|
||||
require File.join(Rails.root, 'lib', 'app_config')
|
||||
|
||||
|
||||
if ARGV.length >= 1
|
||||
key = ARGV[0].to_sym
|
||||
AppConfig.configure_for_environment(Rails.env)
|
||||
if AppConfig.has_key?(key)
|
||||
print AppConfig[key]
|
||||
else
|
||||
puts "Invalid option #{ARGV[0]}"
|
||||
exit 2
|
||||
end
|
||||
else
|
||||
puts "Usage: ./script/get_config.rb option [environment]"
|
||||
puts ""
|
||||
puts "envrionment defaults to development"
|
||||
exit 1
|
||||
end
|
||||
|
|
@ -10,6 +10,7 @@ OS=`uname -s`
|
|||
|
||||
[ -e config/server.sh ] && source config/server.sh
|
||||
|
||||
export SOCKET_PORT=$(./script/get_config.rb socket_port $RAILS_ENV)
|
||||
|
||||
function init_public
|
||||
# Create all dynamically generated files in public/ folder
|
||||
|
|
@ -169,6 +170,8 @@ fi
|
|||
|
||||
mkdir -p -v log/thin/
|
||||
bundle exec ruby ./script/websocket_server.rb&
|
||||
if [ "$(./script/get_config.rb single_process_mode $RAILS_ENV)" = "false" ]; then
|
||||
redis-server config/redis.conf &>log/redis-console.log &
|
||||
QUEUE=* bundle exec rake resque:work&
|
||||
fi
|
||||
bundle exec thin start $args
|
||||
|
|
|
|||
Loading…
Reference in a new issue