8000 config/vanity.yml unused · Issue #277 · assaf/vanity · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Jan 1, 2024. It is now read-only.

config/vanity.yml unused #277

Closed
chrisandrewcl opened this issue Dec 1, 2015 · 3 comments
Closed

config/vanity.yml unused #277

chrisandrewcl opened this issue Dec 1, 2015 · 3 comments
Milestone

Comments

@chrisandrewcl
Copy link

Hi!

First, thank you for this great gem!

I am having a minor issue (for now): to proper bootstrap a new app I have to:

  • rails generate vanity
  • rake db:create
  • rake db:migrate
  • passenger start

These steps seem only work if config/database.yml is properly set, and worse, they take effect by database.yml rules instead of vanity.yml, so vanity.yml is made worthless (except for complaining to not being set). Isn't the purpose of vanity.yml separate ABTest data from the app data?

Is this a know issue?
No? What am I doing wrong?

My setup:

# config/database.yml
default: &default
  adapter: postgresql
  encoding: unicode
  host: localhost
  pool: 5
  username: <%= ENV['DB_USER'] %>
  password: <%= ENV['DB_PASSWD'] %>

development:
  <<: *default
  database: hotsite_dev

test:
  <<: *default
  collecting: false
  database: hotsite_test

production:
  <<: *default
  database: hotsite
# config/vanity.yml
default: &default_vanity
  adapter: active_record
  active_record_adapter: default

development:
  <<: *default_vanity
  database: hotsite_vanity_dev

test:
  <<: *default_vanity
  collecting: false
  database: hotsite_vanity_test

production:
  <<: *default_vanity
  database: hotsite_vanity

gems:
...
rails 4.2.0
vanity 2.0.0.beta9
...

@phillbaker
Copy link
Collaborator

Hi @chrisandrew thanks for using vanity!

except for complaining to not being set

Are you seeing an error? Can you post the error and any stack trace here?

Isn't the purpose of vanity.yml separate ABTest data from the app data?

It's to set various configuration variables. Using a separate database for vanity should work, but is not strictly necessary.

@chrisandrewcl
Copy link
Author

Hey @phillbaker!

If I comment all contents from vanity.yml I get this as soon as I try to run an experiment:

No configuration for development (Vanity::Configuration::MissingEnvironment)
  /home/chrisandrew/.rvm/gems/ruby-2.2.1/bundler/gems/vanity-15f5abd4860a/lib/vanity/configuration.rb:184:in `connection_params'
  /home/chrisandrew/.rvm/gems/ruby-2.2.1/bundler/gems/vanity-15f5abd4860a/lib/vanity/vanity.rb:78:in `connect!'
  /home/chrisandrew/.rvm/gems/ruby-2.2.1/bundler/gems/vanity-15f5abd4860a/lib/vanity/vanity.rb:67:in `connection'
  /home/chrisandrew/.rvm/gems/ruby-2.2.1/bundler/gems/vanity-15f5abd4860a/lib/vanity/frameworks/rails.rb:12:in `block in load!'
  /home/chrisandrew/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:36:in `call'
  /home/chrisandrew/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
  /home/chrisandrew/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
  /home/chrisandrew/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:44:in `each'
  /home/chrisandrew/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
  /home/chrisandrew/.rvm/gems/ruby-2.2.1/gems/railties-4.2.0/lib/rails/application/finisher.rb:62:in `block in <module:Finisher>'
  /home/chrisandrew/.rvm/gems/ruby-2.2.1/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `instance_exec'
  /home/chrisandrew/.rvm/gems/ruby-2.2.1/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `run'
  /home/chrisandrew/.rvm/gems/ruby-2.2.1/gems/railties-4.2.0/lib/rails/initializable.rb:55:in `block in run_initializers'
  /home/chrisandrew/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
  /home/chrisandrew/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
  /home/chrisandrew/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
  /home/chrisandrew/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
  /home/chrisandrew/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `each'
  /home/chrisandrew/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `call'
  /home/chrisandrew/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
  /home/chrisandrew/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
  /home/chrisandrew/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
  /home/chrisandrew/.rvm/gems/ruby-2.2.1/gems/railties-4.2.0/lib/rails/initializable.rb:54:in `run_initializers'
  /home/chrisandrew/.rvm/gems/ruby-2.2.1/gems/railties-4.2.0/lib/rails/application.rb:352:in `initialize!'
  /media/CACHE/workspace/hotsite/config/environment.rb:5:in `<top (required)>'
  config.ru:3:in `require'
  config.ru:3:in `block in <main>'
  /home/chrisandrew/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
  /home/chrisandrew/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
  config.ru:1:in `new'
  config.ru:1:in `<main>'
  /home/chrisandrew/.rvm/gems/ruby-2.2.1/gems/passenger-4.0.59/helper-scripts/rack-preloader.rb:112:in `eval'
  /home/chrisandrew/.rvm/gems/ruby-2.2.1/gems/passenger-4.0.59/helper-scripts/rack-preloader.rb:112:in `preload_app'
  /home/chrisandrew/.rvm/gems/ruby-2.2.1/gems/passenger-4.0.59/helper-scripts/rack-preloader.rb:158:in `<module:App>'
  /home/chrisandrew/.rvm/gems/ruby-2.2.1/gems/passenger-4.0.59/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
  /home/chrisandrew/.rvm/gems/ruby-2.2.1/gems/passenger-4.0.59/helper-scripts/rack-preloader.rb:28:in `<main>'

When both files are properly configured (as in my previous post), vanity.yml seems to be simply ignored, as all the magic happens in the "application database" (vanity DB wasn't even created)

@phillbaker phillbaker added this to the 2.0.1 milestone Dec 18, 2015
@phillbaker
Copy link
Collaborator

Hi @chrisandrew sorry this took a while to get back to you, I think this is just a matter of setting the config so Vanity knows to initialize a new connection separate from the Rails connection. The active_record_adapter: default line tells Vanity to piggyback on the Rails connection pool, however, if you'd like to use a separate connection, you can do that by telling it to use a type that's not default, e.g.:

# config/vanity.yml
default: &default_vanity
  adapter: active_record
  active_record_adapter: default

development:
  <<: *default_vanity
  database: hotsite_vanity_dev

test:
  <<: *default_vanity
  collecting: false
  database: hotsite_vanity_test

production:
  adapter: active_record
  active_record_adapter: postgresql
  host:     localhost
  username: <%= ENV['DB_USER'] %>
  password: <%= ENV['DB_PASSWD'] %>
  database: hotsite_vanity

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
3C73
Projects
None yet
Development

No branches or pull requests

2 participants
0