Rails Multisite still breaking build


(Ken Cooper) #1

Continuing the discussion from Upgrade failed after the recent today's commits: «cannot load such file – rails_multisite»:

Not sure if this is the best way to report it, but I think so. See here:

I’m running in virtual box on OS X 10.11 Beta, FWIW.


(Sam Saffron) #2

Something is messed up locally (or with the vagrant image) no idea why its gone crazy. works fine for all our prd deploys and for my local dev.

@riking had a similar issue, still unclear on how he fixed it.


(Kane York) #3

Well, I fixed it by switching ruby versions from 2.1.* to 2.2.*, which caused me to reinstall all gems. So I’m also unclear on how I fixed it.


(Ken Cooper) #4

Have you tried it with a clean VM? I just deleted both the discourse repo and my installed VM, rebuilt from scratch, same problem. Very reproducible.


(Matthew Asbury) #5

I have reproduced the problem on Windows 7. Followed the instructions here in order to try some plugin development and had the same error. Installed Discourse to a live Linux box on AWS 3 weeks ago with no problems.


(Kane York) #6

The problem doesn’t seem to affect production systems, it’s only development setups that are getting screwed up.


#7

Brand new vagrant install and I’m getting this as well.

[vagrant@precise32:/vagrant (master)]$ bundle exec rake db:migrate
rake aborted!
NameError: uninitialized constant SiteSettings::DbProvider::RailsMultisite
/vagrant/lib/site_settings/db_provider.rb:52:in `current_site'
/vagrant/lib/site_setting_extension.rb:44:in `current'
/vagrant/lib/site_setting_extension.rb:96:in `block in setting'
/vagrant/lib/site_setting_extension.rb:93:in `synchronize'
/vagrant/lib/site_setting_extension.rb:93:in `setting'
/vagrant/lib/site_setting_extension.rb:151:in `client_setting'
/vagrant/app/models/site_setting.rb:18:in `block in load_settings'
/vagrant/lib/site_settings/yaml_loader.rb:29:in `block (2 levels) in load'
/vagrant/lib/site_settings/yaml_loader.rb:20:in `each'
/vagrant/lib/site_settings/yaml_loader.rb:20:in `block in load'
/vagrant/lib/site_settings/yaml_loader.rb:19:in `each_key'
/vagrant/lib/site_settings/yaml_loader.rb:19:in `load'
/vagrant/app/models/site_setting.rb:16:in `load_settings'
/vagrant/app/models/site_setting.rb:25:in `<class:SiteSetting>'
/vagrant/app/models/site_setting.rb:4:in `<top (required)>'
/vagrant/config/initializers/04-message_bus.rb:39:in `<top (required)>'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:652:in `block in load_config_initializer'
/var/lib/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/notifications.rb:166:in `instrument'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:651:in `load_config_initializer'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:615:in `each'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:615:in `block in <class:Engine>'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `instance_exec'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `run'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:55:in `block in run_initializers'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:44:in `each'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:44:in `tsort_each_child'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:54:in `run_initializers'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/application.rb:352:in `initialize!'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/railtie.rb:194:in `public_send'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/railtie.rb:194:in `method_missing'
/vagrant/config/environment.rb:5:in `<top (required)>'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/application.rb:328:in `require_environment!'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/application.rb:457:in `block in run_tasks_blocks'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
[vagrant@precise32:/vagrant (master)]$

Tried blowing away all my installed Gem’s and tried following the instructions here. Tried blowing away the Gemfile.lock thinking it could be a version miss-match but no luck there either.

My production instance of Discourse is also running fine, so not sure why this dev instance is borked.


(Rafael dos Santos Silva) #8

Guys, same thing here. Prod fine and Vagrant Dev machine can’t db:migrate. Any tips?


(Angus McLeod) #9

+1

I’m having the same issue described above.

The various fixes mentioned avail me not.


(Angus McLeod) #10

@Falco @kcoop @Mooash @Matthew_Asbury

Here’s what I did to fix it.

  1. Installed rvm in my (ubuntu) VM using this guide

  2. Changed the ruby version to 2.2.1 (I was previously on 2.2.2), i.e. rvm use 2.2.1

  3. Ran bundle install.

The version change forces all the gems to reinstall (as @riking suggested) : i.e. you see them all listed and it takes ages.

Then bundle exec rake db:migrate and bundle exec rails s -b 0.0.0.0 work normally


(Discourse.PRO) #11

I have also fixed it by reinstalling Ruby.


(Discourse.PRO) #12

Also you need echo "source ~/.profile" >> /home/vagrant/.bash_profile for loading the manually installed Ruby after Vagrant suspend / resume.


(Leo McArdle) #13

I didn’t find the need to do step 2, just following the guide to reinstall ruby seemed to force all the gems to reinstall.

It’s gonna be a pain if we have to do this for every new vagrant instance…


(Matt Palmer) #14

I’ve tracked down the problem: the rails_multisite gem has restrictive permissions on some of the files, and so the vagrant user can’t read them (and hence can’t load the code).

While @sam is unavailable to make a new (fixed) release of rails_multisite, the simplest workaround is to run the following:

sudo chmod -R a+r /var/lib/gems/2.2.0/gems/rails_multisite-1.0.2

That’ll fix the permissions and you’ll be off and running.


Discourse as Your First Rails App
(Simon Cossar) #15

Great! Thanks!

The rails-multisite gem version has changed to 1.0.2 so the command needs to be
sudo chmod -R a+r /var/lib/gems/2.2.0/gems/rails_multisite-1.0.2

It seems that with vagrant the server now has to be started with rails s -b 0.0.0.0 to get access on http://localhost:4000/


(Matt Palmer) #16

Thanks for pointing that out. I was doing my testing on an older instance I just had laying around. I’ve updated my post.


(Dorthu) #17

Fixed it for me as well. Thank you sir!