diff options
author | re4k <re4k@re4k.info> | 2013-03-12 19:09:23 +0900 |
---|---|---|
committer | re4k <re4k@re4k.info> | 2013-03-12 19:10:00 +0900 |
commit | 5d2a13afc4f08ba752a30e204367d028d09ad538 (patch) | |
tree | 138bad2cb0472ff8cd64f651704a93344f18b952 /config | |
parent | 11d5c2683fe0f296280fa4b717db92b1d358d704 (diff) | |
download | aclog-5d2a13afc4f08ba752a30e204367d028d09ad538.tar.gz |
* Rewrite worker
Diffstat (limited to 'config')
-rw-r--r-- | config/database.yml | 23 | ||||
-rw-r--r-- | config/locales/en.yml | 29 | ||||
-rw-r--r-- | config/settings.yml | 14 | ||||
-rw-r--r-- | config/unicorn.rb | 33 |
4 files changed, 54 insertions, 45 deletions
diff --git a/config/database.yml b/config/database.yml index b2b0606..d9682a5 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,16 +1,13 @@ <% #development: - #test: + #production: + # adapter: mysql2 + # encoding: utf8 + # reconnect: true + # database: production + # pool: 5 + # username: <%= ENV["DOTCLOUD_DB_MYSQL_LOGIN"] %> + # password: <%= ENV["DOTCLOUD_DB_MYSQL_PASSWORD"] %> + # host: <%= ENV["DOTCLOUD_DB_MYSQL_HOST"] %> + # port: <%= ENV["DOTCLOUD_DB_MYSQL_PORT"] %> %> - -production: - adapter: mysql2 - encoding: utf8 - reconnect: true - database: production - pool: 5 - username: <%= ENV["DOTCLOUD_DB_MYSQL_LOGIN"] %> - password: <%= ENV["DOTCLOUD_DB_MYSQL_PASSWORD"] %> - host: <%= ENV["DOTCLOUD_DB_MYSQL_HOST"] %> - port: <%= ENV["DOTCLOUD_DB_MYSQL_PORT"] %> - diff --git a/config/locales/en.yml b/config/locales/en.yml index 0653957..8513e9c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,23 +1,8 @@ -# Files in the config/locales directory are used for internationalization -# and are automatically loaded by Rails. If you want to use locales other -# than English, add the necessary files in this directory. -# -# To use the locales, use `I18n.t`: -# -# I18n.t 'hello' -# -# In views, this is aliased to just `t`: -# -# <%= t('hello') %> -# -# To use a different locale, set it with `I18n.locale`: -# -# I18n.locale = :es -# -# This would use the information in config/locales/es.yml. -# -# To learn more, please read the Rails Internationalization guide -# available at http://guides.rubyonrails.org/i18n.html. - en: - hello: "Hello world" + views: + pagination: + first: "« First" + last: "Last »" + previous: "‹ Prev" + next: "Next ›" + truncate: "…" diff --git a/config/settings.yml b/config/settings.yml index b93d958..1081845 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -1,12 +1,6 @@ -<% -# dotCloud -env_file = "/home/dotcloud/environment.json" -if File.exists?(env_file) - ENV.update(Hash[JSON.parse(File.read(env_file)).map{|k, v| [k.to_s, v.to_s]}]) -end -%> consumer_key: <%= ENV["CONSUMER_KEY"] %> consumer_secret: <%= ENV["CONSUMER_SECRET"] %> -worker_count: <%= ENV["WORKER_COUNT"] %> -dotcloud_service_name: <%= ENV["DOTCLOUD_SERVICE_NAME"] %> -page_per: 10 +page_per: <%= ENV["ACLOG_PAGE_PER"] %> +secret_key: <%= ENV["ACLOG_SECRET_KEY"] %> +db_proxy_port: <%= ENV["ACLOG_DB_PROXY_PORT"] %> +register_server_path: <%= ENV["ACLOG_REGISTER_SERVER_PATH"] %> diff --git a/config/unicorn.rb b/config/unicorn.rb new file mode 100644 index 0000000..d83c1c0 --- /dev/null +++ b/config/unicorn.rb @@ -0,0 +1,33 @@ +worker_processes 2 + +working_directory File.expand_path("../../", __FILE__) + +listen "/tmp/aclog-unicorn.sock" + +log = "/var/log/rails/unicorn.log" +stderr_path File.expand_path("log/unicorn.log", ENV["RAILS_ROOT"]) +stdout_path File.expand_path("log/unicorn.log", ENV["RAILS_ROOT"]) + +preload_app true + +before_fork do |server, worker| + if defined?(ActiveRecord::Base) + ActiveRecord::Base.connection.disconnect! + end + + old_pid = "#{server.config[:pid]}.old" + unless old_pid == server.pid + begin + Process.kill :QUIT, File.read(old_pid).to_i + rescue Errno::ENOENT, Errno::ESRCH + end + end +end + +after_fork do |server, worker| + if defined?(ActiveRecord::Base) + ActiveRecord::Base.establish_connection + end +end + + |