Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database setup on CircleCI gives RAILS_CACHE error #41

Closed
meltingice opened this issue Feb 10, 2014 · 3 comments
Closed

Database setup on CircleCI gives RAILS_CACHE error #41

meltingice opened this issue Feb 10, 2014 · 3 comments

Comments

@meltingice
Copy link

This always happens when trying to setup the database on CircleCI. I cannot seem to produce this locally in Mac OSX. File ordering can be different on Linux, which can cause bugs like this, but I'm having a hard time pinning down where RAILS_CACHE is originally defined.

Running:

  • Ruby 2.0.0
  • Rails 3.2.16
  • makara 0.2.0 ab0b485
ubuntu@box15:~/layervault$ RAILS_ENV=test bundle exec rake db:create db:schema:load --trace
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Execute db:load_config
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:create
rake aborted!
uninitialized constant RAILS_CACHE
/home/ubuntu/omnivore_server/vendor/bundle/ruby/2.0.0/gems/railties-3.2.16/lib/rails.rb:90:in `cache'
/home/ubuntu/omnivore_server/vendor/bundle/ruby/2.0.0/bundler/gems/makara-fd03ae9cee58/lib/makara/cache.rb:35:in `store'
/home/ubuntu/omnivore_server/vendor/bundle/ruby/2.0.0/bundler/gems/makara-fd03ae9cee58/lib/makara/cache.rb:23:in `write'
/home/ubuntu/omnivore_server/vendor/bundle/ruby/2.0.0/bundler/gems/makara-fd03ae9cee58/lib/makara/proxy.rb:65:in `stick_to_master!'
/home/ubuntu/omnivore_server/vendor/bundle/ruby/2.0.0/bundler/gems/makara-fd03ae9cee58/lib/makara/proxy.rb:179:in `stick_to_master'
@meltingice
Copy link
Author

If I override the database creation such that it loads the full Rails environment first, it works.

bundle exec rake environment db:create db:schema:load --trace

Not sure if this is really the best solution, though.

@mnelson
Copy link
Contributor

mnelson commented Feb 10, 2014

https://github.com/rails/rails/blob/64226302d82493d9bf67aa9e4fa52b4e0269ee3d/railties/lib/rails/application/bootstrap.rb#L53

So a possible option for makara is to check for the existence of RAILS_CACHE before trying to use Rails.cache. RAILS_CACHE is deprecated, however, so we'd have to do that with an AR version check.

An alternative to loading the env is to set the makara cache explicitly: Makara::Cache.store = :noop.

@si-m
Copy link

si-m commented May 8, 2016

@meltingice thank you very much! bundle exec rake enviroment !!!!!!!!!!!!!

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

No branches or pull requests

3 participants