Skip to content

Instantly share code, notes, and snippets.

@malagodia
Created January 19, 2014 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save malagodia/8506722 to your computer and use it in GitHub Desktop.
Save malagodia/8506722 to your computer and use it in GitHub Desktop.
#config/initializers/database_connection.rb
Rails.application.config.after_initialize do
ActiveRecord::Base.connection_pool.disconnect!
ActiveSupport.on_load(:active_record) do
config = Rails.application.config.database_configuration[Rails.env]
config['reaping_frequency'] = ENV['DB_REAP_FREQ'] || 10 # seconds
config['pool'] = ENV['DB_POOL'] || 5
ActiveRecord::Base.establish_connection(config)
end
end
# Load the Rails application.
require File.expand_path('../application', __FILE__)
# Initialize the Rails application.
Glowcon::Application.initialize!
Fetching repository, done.
Counting objects: 33, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (24/24), done.
Writing objects: 100% (24/24), 2.37 KiB | 0 bytes/s, done.
Total 24 (delta 17), reused 0 (delta 0)
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.5.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Fetching source index from http://rubygems.org/
Fetching git://github.com/gregbell/active_admin.git
Using rake (10.1.1)
Using i18n (0.6.9)
Using minitest (4.7.5)
Using atomic (1.1.14)
Using builder (3.1.4)
Using tzinfo (0.3.38)
Using erubis (2.7.0)
Using mime-types (1.25.1)
Using rack (1.5.2)
Using polyglot (0.3.3)
Using sass (3.2.13)
Using thor (0.18.1)
Using bcrypt-ruby (3.1.2)
Using execjs (2.0.2)
Using coffee-script-source (1.6.3)
Using orm_adapter (0.5.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.1)
Using bundler (1.5.2)
Using hike (1.2.3)
Using tilt (1.4.1)
Using json (1.8.1)
Using highline (1.6.20)
Using uuidtools (2.1.4)
Using mini_portile (0.5.2)
Using net-ssh (2.7.0)
Using unicode_utils (1.4.0)
Using chunky_png (1.2.9)
Using fssm (0.2.10)
Using currencies (0.4.2)
Using kgio (2.8.1)
Using libv8 (3.16.14.3)
Using newrelic_rpm (3.7.1.182)
Using pg (0.17.1)
Using pwdcalc (0.1.10)
Using rails_serve_static_assets (0.0.2)
Using rails_stdout_logging (0.0.3)
Using raindrops (0.12.0)
Using ref (1.0.5)
Using state_machine (1.2.0)
Using yui-compressor (0.12.0)
Using thread_safe (0.1.3)
Installing mono_logger (1.1.0)
Using faker (1.2.0)
Using treetop (1.4.15)
Installing multi_json (1.8.4)
Using rack-test (0.6.2)
Using warden (1.2.3)
Installing redis (3.0.6)
Installing rufus-scheduler (2.0.24)
Using coffee-script (2.2.0)
Using haml (4.0.5)
Installing vegas (0.1.11)
Using uglifier (2.4.0)
Using nokogiri (1.6.1)
Using net-scp (1.1.2)
Using net-sftp (2.1.2)
Using net-ssh-gateway (1.2.0)
Using carmen (1.0.0)
Using countries (0.9.3)
Using compass (0.12.2)
Using rails_12factor (0.0.2)
Installing rack-protection (1.5.2)
Using therubyracer (0.12.0)
Using mail (2.5.4)
Using activesupport (4.0.2)
Using sprockets (2.10.1)
Installing redis-namespace (1.4.1)
Installing bourbon (3.1.8)
Using capistrano (2.15.5)
Using compass-rails (1.1.3)
Installing sinatra (1.4.4)
Using actionpack (4.0.2)
Using activemodel (4.0.2)
Installing arbre (1.0.1)
Using climate_control (0.0.3)
Installing rdoc (4.1.1)
Using actionmailer (4.0.2)
Using railties (4.0.2)
Installing aws-sdk (1.32.0)
Installing resque (1.25.1)
Installing has_scope (0.6.0.rc)
Using sprockets-rails (2.0.1)
Installing formtastic (2.3.0.rc2)
Using active_model_serializers (0.8.1)
Using activerecord (4.0.2)
Using cocaine (0.5.3)
Using coffee-rails (4.0.1)
Using devise (3.2.2)
Installing responders (1.0.0)
Using jquery-rails (3.0.4)
Using jquery-ui-rails (4.1.1)
Installing kaminari (0.15.1)
Using haml-rails (0.5.3)
Using jquery-fileupload-rails (0.4.1)
Using jquery-powertip-rails (1.1.0) from git://github.com/malagodia/jquery-powertip-rails.git (at master)
Installing resque-scheduler (2.3.1)
Using sass-rails (4.0.1)
Using paperclip (3.5.2)
Installing sdoc (0.4.0)
Using rails (4.0.2)
Using after_commit_action (0.1.3)
Installing foundation-rails (5.0.3.1)
Using jquery-datatables-rails (1.12.2)
Using acts-as-taggable-on (3.0.1)
Using carmen-rails (1.0.0)
Using counter_culture (0.1.18)
Installing polyamorous (0.6.4)
Installing inherited_resources (1.4.1)
Installing ransack (1.1.0)
Using activeadmin (1.0.0.pre) from git://github.com/gregbell/active_admin.git (at master)
Installing unicorn (4.8.0)
Your bundle is complete!
Gems in the groups development and test were not installed.
It was installed into ./vendor/bundle
Post-install message from rdoc:
Depending on your version of ruby, you may need to install ruby rdoc/ri data:
<= 1.8.6 : unsupported
= 1.8.7 : gem install rdoc-data; rdoc-data --install
= 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
Bundle completed (43.51s)
Cleaning up the bundler cache.
Removing bundler (1.3.2)
Removing aws-sdk (1.31.3)
Removing unicorn (4.7.0)
Removing multi_json (1.8.2)
Removing kaminari (0.15.0)
Removing foundation-rails (5.0.2.0)
Removing rdoc (3.12.2)
Removing sdoc (0.3.20)
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
undefined method `[]=' for nil:NilClass
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/config/initializers/database_connection.rb:7:in `block (2 levels) in <top (required)>'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:27:in `each'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/config/initializers/database_connection.rb:5:in `block in <top (required)>'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:36:in `call'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:44:in `each'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/application/finisher.rb:62:in `block in <module:Finisher>'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `instance_exec'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `run'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/initializable.rb:54:in `run_initializers'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/application.rb:215:in `initialize!'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/config/environment.rb:5:in `<top (required)>'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/application.rb:189:in `require_environment!'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/application.rb:250:in `block in run_tasks_blocks'
/tmp/build_2826537d-5a5c-43f7-b792-45112618d3df/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:54:in `block (2 levels) in define'
Tasks: TOP => environment
(See full trace by running task with --trace)
!
! Precompiling assets failed.
!
! Push rejected, failed to compile Ruby app
Glowcon::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both thread web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable Rails's static asset server (Apache or nginx will already do this).
config.serve_static_assets = false
# Compress JavaScripts and CSS.
config.assets.compress = true
config.assets.js_compressor = :uglifier
config.assets.css_compressor = :yui
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Generate digests for assets URLs.
config.assets.digest = true
# Version of your assets, change this if you want to expire all your assets.
config.assets.version = '1.0'
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Set to :debug to see everything in the log.
config.log_level = :info
# Mailer settings
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets.
# application.js, application.scss, and all non-JS/CSS in app/assets folder are already added.
# config.assets.precompile += %w( search.js )
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# 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
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Disable automatic flushing of the log to improve performance.
# config.autoflush_log = false
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment