I'm running into difficulties deploying a Rail app to Heroku. I'd really appreciate a check list of ideas to run through to sort this out, I've exhausted my ideas are am resorting to pulling my hair out!
The short story: heroku run rake db:migrate generates an error:
Running rake db:migrate attached to terminal... up, run.1
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
rake aborted!
syntax error on line 7, col 11: `'
This looks like it should be pretty easy to fix. The problem is, I don't have any plugins!
The long story: I'm getting ready to redeploy a Rails app for staging. This was a Rails 3.0 app on Heroku, which I've just completed a major upgrade on, including upgrade to Rails 3.2, Ruby 1.9.2, removal of plugins, and major rewrite. I'm now trying to push to Heroku's cedar stack to do some more testing.
I've been trying to work through this issue for a couple of days, and keep thinking I'm getting somewhere, but am then disappointed. Most recently I thought that my git repos were out of alignment and that the Heroku remote contained an old commit with these plugins. I no longer think this is the case. (I did want to check this, but am unable to get into Heroku console to verify the file structure, because of this error).
To confirm, my vendor/plugins folder is definitely empty on my local master and remote github repo. It should be empty on the remote Heroku branch as I've pushed all updates (I even created a completely blank app with a new remote name to test, but got the same error). I say vendor/plugins is empty, but actually vendor/plugins does not exist, having been fully deleted after I removed plugins within.
I did have two plugins installed in the app in an earlier version: HABTM checkboxes and fancybox-rails. These have both been uninstalled rails plugin remove <<plugin name>>.
I've checked the file referenced in the error /app/rakefile:7, but can't see anything wrong with this line MyApp::Application.load_tasks.
If I try to launch heroku console, the error is slightly different and references /app/config/environment.rb:5). I can't see anything here either MyApp::Application.initialize!
I've been through all the likely places looking for any remnants of these plugins or old require statements, and turned up nothing.
I'd really appreciate any ideas as to where else I can look. I can provide more information if needed, I'm simply not sure what's is useful at this stage!!
Thanks for helping me keep my hair!!
EDIT
I'm adding the full contents of the rakefile that is referred to in the error. I can't see any issues with this.
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require 'rake'
MyApp::Application.load_tasks
After a lot of hair pulling and frustration, I finally tracked this down to the following entry in the logs
/usr/local/lib/ruby/1.9.1/syck.rb:135:in `load': syntax error on line 7, col 11: `' (ArgumentError)
syck.rb parses yaml files, and low and behold I had a (minor) issue with a yaml file omitting some environment specific info.
For more detail, see this SO question.
The plugin deprecation warnings are from plugins Heroku injectes into your application at build time so it runs appropriately on the platform. Those can be ignored.
The crux of the issue appears to be related to a syntax error in your source/rake file. Here's the important output:
rake aborted!
syntax error on line 7, col 11: `'
Look at line 7 of the file the error originates from (post the rest of the stack trace for our reference?) and you'll find some sort of syntax error that needs to be fixed.
If you want to clearly separate the plugin loading and app load-time you use heroku run bash to load a shell and then run the rake task to see its output isolated:
$ heroku run bash
> bundle exec rake db:migrate
Hope that helps.
I read somewhere that heroku uses plugins to automate some tasks... so it's not your fault
If you want to silence the deprecation warnings, use this little snippet:
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
ActiveSupport::Deprecation.silence do
Selfcare::Application.initialize!
end
Related
My plugins are working fine and appear locally, but as I push my app on Heroku, the plugins index page is empty and there is no plugin...
I've removed everything from my .gitignore to be sure, as suggested here and I've also ran heroku run rake redmine:plugins:migrate.
I've got the following depreciation warnings but I don't know if it comes from here:
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
Plugins in vendor/plugins (/app/vendor/plugins) are no longer allowed. Please, put your Redmine plugins in the `plugins` directory at the root of your Redmine directory (/app/plugins).
However, my plugins are already included in the 'plugins' directory and I'm now kind of stuck on how to solve this problem...
Rails v3.2.17 with Redmine v2.5.1.
Thanks!
In the meantime, I found that it might be related to git submodules problem, as the redmine_app_timesheets folder was present but figured to be empty while running 'heroku run bash'.
So I deleted the two folders and reinstalled the plugin using:
git submodule add https://github.com/maxrossello/redmine_app__space.git plugins/redmine_app__space
git submodule add https://github.com/maxrossello/redmine_app_timesheets.git plugins/redmine_app_timesheets
Plugins are now working, just not sure what configuration I might have lost deleting the local plugins.
I am using Ruby 1.9.3p194 with Rails 3.2.13 and have newly created an Rails application which contains /vendor folder with .gitkeep files:
/vendor/assets/javascripts
/vendor/assets/stylesheets
/vendor/plugins
all the folders are empty.
When I run this application on Heroku it warns:
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins!
Support for these plugins will be removed in Rails 4.0. Move them out
and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/*
and config/initializers/myplugin.rb. See the release notes for more on this:
http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released.
(called from <top (required)> at /app/config/environment.rb:5)
Could this /vendor folder be deleted completely without any negative consequences?
I don't have this version of Rails installed to test this with, but I can offer a suggestion in lieu of a definitive answer.
Simply rename the /vendor folder something else and try to run the application again. See if it fails (or some other negative consequences), or succeeds (isn't needed). Even if it succeeds, you can always keep it in case it is needed in the future.
use
mv old-folder-name new-folder-name
so...
mv /vendor /vendor.backup
And everything under it will remain in /vendor.backup
You get this message on Heroku because with Rails 3 they inject plugins at compile time for logging and pipeline.
To prevent these deprecation notices if you add
gem 'rails_12factor', group: 'production'
to your gemfile they will disappear since this gem provides the same functionality as the previously injected plugins. This recently came up on the Heroku Changelog - see https://devcenter.heroku.com/changelog-items/318
No it wont hurt to remove this directory. But it should be enough just to remove /vendor/plugins so no actually need to remove the whole /vendor path.
Rails 4.0 apps have only /vendor/assets/javascripts and /vendor/assets/stylesheets, empty except for the .keep file.
Given it's empty, you could certainly remove /vendor/plugins (which should get rid of the deprecation warning). I would just leave the /vendor/assets directories.
vendor/bundle/ruby/2.6.0/gems/sassc-2.4.0/ext/libsass.so: cannot open shared object file: No such file or directory
when i have some troubles in deployment on the server, like compilation of extension ".so". i delete the vendor/bundle of my local app or add it in gitignore. so the built, compilation and deployment is entirely done by the machine running the server.
Your local machine and the machine running the server are always differents.
I'm getting this deprecation error on my rails 3.2 project which I upgraded from a rails 3.1 project:
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
I'm trying to get rid of this error, but I can't seem to find the plugin. I have already deleted the plugin from vendor/plugins.
If your vendor/plugins is completely empty, then I bet you're deploying to Heroku. As part of the deploy process, Heroku injects plugins into your application. Check out this Stackoverflow answer for an actual Heroku response to this issue.
Since I am new to rails and have learned the very basics from books I now figured that I can learn quite a bit more from reading other peoples code and trying to make sense of it so I have signed up at github and set up everything there. Now I read that one good open source project to learn from is radiant so I went to https://github.com/radiant/radiant and cloned it to a local directory. THen I proceeded as follows:
cd radiant
bundle install, which went fine
rake db:migrate, which first returned:
rake aborted! You have already activated rake 0.9.2, but your Gemfile requires rake 0.8.7. Using bundle exec may sol
So I typed in bundle exec rake db:migrate and recieved the following:
NOTE: Gem.source_index is deprecated, use specification. It will be removed on or after 2011-11-01. Gem.source_index called from c:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.14/lib/rails/gem_dependency Rake aborted! No such file to load -- radius
So here I am wondering how to fix this problem? I also noticed that a Gemfile and a Gemfile.lock already existed in the radiant folder when it was cloned, which perhaps could be part of the problem?
Also I wonder if it is crutial that I run the same version of rails as the project is written in?
Now it should be said that I currently have rails 3.0.5 installed and run on windows
I hope someone can help me here, it has been quite frustrating since I have not been able to run any cloned github repos (radiant here just being one example).
You should edit your Gemfile and make it require newer rake.
Also you can run rake db:migrate --trace to get additional error information.
The deprecation warning is still just a warning, and it shouldn't be causing you any issues. The part of that error that is relevant is the No such file to load -- radius. You probably need to follow the instructions for installing Radiant, which include running a gem install radiant before dropping this project code somewhere.
Bundler manages installing and using the gems in your Gemfile, and if a Gemfile.lock is present it'll use those exact versions. This means you can't run Radiant with Rails 3.0.5 since the Gemfile specifies 2.3.14. Bundler will install Rails 2.3.14 and its dependencies automatically, though, so you don't need to worry about it.
By the way, this project looks like it has been very mismanaged. It's not common for a Rails project/gem to force you to actually clone it to use it. If you want to check out a Rails 3 project to learn from, I have a slim Rails 3 app that was intended to be an API up publicly on Github with some really clean code: http://github.com/coreyward/instavibe
I just installed facebook connect for my site, but without having edited something on the files that cast the error I get this:
rake aborted!
uninitialized constant ActiveSupport::Dependencies::Mutex
/var/www/###/Rakefile:10:in `require'
(See full trace by running task with --trace)
In line 10 of my Rakefile you find:
require 'tasks/rails'
I haven't edited 'tasks/rails'... what is this Mutex and why does it now cast this error?
the error is probably thrown because some code that is in the module ActiveSupport::Dependencies wants to use the Mutex class, but the class for some reason can not be autoloaded.
Sometimes the problem lies not in the code, but in the environment - like conflicting gems, i guess the issue is that your freshly installed facebook connect messes up some parts in your system
It can help to look at the rake some:task --trace output, to determine which file causes the problem - maybe look for calls to facebook connect library, and then try to play with that file - comment out lines that might be causing your problem, to determine what has to be done.
To help you further one would need the stack trace, the list of your gems and their version used in the project and maybe steps what have you done while installing the facebook connect
If you can't upgrade from rails 2.3.4, require 'thread' in Rakefile, before boot.rb is initialized.
You may also need to require it in config/environment.rb, and script/server.
Looks like this:
require 'thread'
require File.join(File.dirname(__FILE__), 'boot')
You have Rails 3.0.5 installed, but are trying to use 2.3.4. While, if you have 2.3.4 installed additionally, they shouldn't conflict to much, I'd recommend you take a look at using RVM for development to create isolated development environments (called gemsets).
Further, you're using Rails 2.3.4, which is incompatible with Rubygems 1.6. I highly recommend you upgrade rails to the latest 2.3 version (currently 2.3.11), as it includes numerous bug and security fixes, as well as compatibility with the latest Rubygems. Alternatively you can downgrade Rubygems to 1.3.7, but I'd advise upgrading Rails instead as it's a better long-term solution and includes numerous critical security fixes.