0

I am using the Vanity gem to do A/B testing and it works great locally.

On our EC2 instances rails refuses to start when Vanity is enabled.

I have been able to recreate the issue locally by providing incorrect details for my local Redis install.

I have tried several permutations of settings, the two that I would have expected to work are;

staging:
  adapter: redis
  connection: redis://my-name.id.0001.use1.cache.amazonaws.com:6379/0

And

staging:
  adapter: redis
  connection: redis://my-name.id.0001.use1.cache.amazonaws.com:6379

When I log onto the server I can run redis-cli -h my-name.id.0001.use1.cache.amazonaws.com and it connects immediately.

I am pretty sure this should work because this person was able to get something working with a Heroku setup (which just uses an external URL as I used above)

Error Message

Here is the error message I get when deploying the server. job_options.rb is my test experiment, it works fine in Development.

/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/experiment/base.rb:24:in `eval'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/experiment/base.rb:24:in `block in load'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/experiment/base.rb:22:in `instance_eval'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/experiment/base.rb:22:in `load'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/playground.rb:248:in `block in set_experiments'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/playground.rb:247:in `each'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/playground.rb:247:in `set_experiments'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/playground.rb:26:in `initialize'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/vanity.rb:133:in `new'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/vanity.rb:133:in `load!'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/vanity.rb:123:in `playground'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/adapters/redis_adapter.rb:219:in `rescue in call_redis_with_failover'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/adapters/redis_adapter.rb:216:in `call_redis_with_failover'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/adapters/redis_adapter.rb:105:in `set_experiment_created_at'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/experiment/base.rb:159:in `save'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/experiment/ab_test.rb:451:in `save'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/experiment/definition.rb:21:in `define'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/experiment/ab_test.rb:571:in `ab_test'
./experiments/job_options.rb:1:in `new_binding'
4

1 回答 1

1

看起来这是 Vanity 2.0 中的回归,在发布修复程序之前,您可以connection将 Vanity 配置中的键替换为url键,例如:

staging:
  adapter: redis
  url: redis://my-name.id.0001.use1.cache.amazonaws.com:6379/0

这些密钥被传递给各个适配器,并且ruby​​ Redis 客户端接受url

于 2016-01-13T03:47:52.197 回答