Good afternoon,
I just upgraded my Rails app from 3.1.3 to 3.2.1. Everything is working on my local development machine (in development or production modes). There is no trace left of my vendor/plugins directory (or even the vendor directory at all).
However, after committing to git and pushing to Heroku, I'm getting warnings about deprecation of my rails 2.3 style vendor/plugins. Crazy seeing as I have no vendor directory at all!
Do I need to totally wipe my Heroku files? (If so, how would I do this?) Any other suggestions appreciated.
I've seen this and it looks like warnings about some of the stuff that Heroku injects into your code for things such as asset serving etc.
I'm assuming that as more and more start to use Rails 3.2 that Heroku will fix this. I wouldn't worry about it - the deprecation won't kick in until Rails 4.0 and that's some way off.
Related
I have what I hope is a simple question. I'm pretty new to rails/web apps, so I apologize for any obvious lack of knowledge demonstrated in asking this question.
Essentially, I've been updating/maintaining an existing Rails app that I didn't develop/deploy. Up to this point, all the changes I've made are so minor that I felt comfortable doing them live (undesirable, I know), but I've recently had to make some changes that involved installing some new gems and updating the database. To do so, I pulled the app/db from the production server, recreated the production environment, and made all necessary changes locally. Put simply, my question is: what is the safest/easiest way to update the app/bundle/db on the production server?
I know there are myriad tutorials regarding deployment with Passenger, but I haven't been able to find anything that specifically references updating an app that's already in production. Is there a distinction between initial deployment and redeploying an updated app?
Tech stack is Ruby 1.9.3, Phusion Passenger on Apache, and PostgreSQL 9.1.3.
Thanks in advance.
You could simply upload the code, run bundle install then bundle exec rake db:migrate and call it a day, but the standard procedure would be to use something like Capistrano, for which myriad tutorials and guides are available on deploying Rails apps.
I am facing issue when I am trying to work with rails 3.0.11. I initially worked with rails 3.2.6. Build a prototype application in Rails 3.2.6, Ruby 1.9.2 and gem 1.8.7. But then found, server on which we need to host is a shared server which can only support Rails 3.0.11, Ruby 1.8.7 and gem 1.7.2.
Hence I want to keep my dev environment exactly same before I ran into further issues. As I found there was some discrepancy in routes.rb of both the versions.
Steps I followed:
Uninstalled rails
Uninstalled ruby
Installed ruby from here.
This installed ruby version 1.8.7-p370 and gem 1.8.7
After this I installed rails by specifying version as 3.0.11
But still when I run command rails -v, it throws an error to me saying 'missing gem rails 3.2.6. Run bundle install to resolve the issue'
When I ran bundle install, it again completely installed rails 3.2.6 and problem remained unresolved.
Please suggest the clean way how shall I start my development on rails 3.0.11 without running into any issues?? Am I need to delete some registry or mapping in my system through which it is detecting rails 3.2.6 and creating issues??
Its urgent as I need to complete my dev by 7th September.
As I am new to stackexchange, please guide is it appropriate to ask question on the same related thread or shall I open new discussion for my problem?
#Gun - please note in response to one of your comments posted above - you DO need to change your Gemfile - if you are running rails -v from withing your project's directory, it will read the Gemfile.
There is a script located at script/rails - this is what runs when you run the rails command from the project directory. NOTE that this rails script requires your config/application.rb file - which in turn reads the Gemfile and bundles the referenced gems. Thus is your Gemfile still references 3.2.6, and it is not installed, rails -v will not work
Glad to hear the problem is fixed :)
As for the asset pipeline - if you are using rails 3.2.6 (or were using it) then you may have been using the asset pipeline to serve your assets (javascript files, CSS files, images, etc). If you were, and you downgrade to anything pre rails version 3.1, then anything being served through the asset pipeline will no longer work.
Here is a pretty good description of the asset pipeline: http://guides.rubyonrails.org/asset_pipeline.html
You should check also remove your Gemfile.lock or manually 'bundle update rails' when you change your rails dependency.
I suggest to use rbenv or rvm to create a virtual environment/sandbox where you can install your preferred ruby versions (e.g. 1.8.7) and keep tracking of your dependencies separately. This would save you a lot of effort.
Keep in mind that rails 3.0 has no asset pipeline support (it has been included in rails 3.1)! This is a very important difference and if you depend on it you will have big issues to solve for the downgrade.
Thanks a lot everyone for help.
I believe it was weird issue. I had heroku on the system. I was initially deploying my app on the same and then changed to another hosting server.
After uninstalling the heroku, it works perfectly fine. Probably, that was interfering somewhere. Although, not sure but problem is resolved.
Thanks a lot again for a great great help!!!
Meanwhile, I would request alup to throw some more light on asset pipeline support. Wots that? Could you please explain more??
Need to delete C:\Users\.ror folder and C:\Users\.gemfile and C:\Users\.gemfile.lock from your desktop..
My production app is running on ruby 1.9.2 and rail 3.0.3.
What is the safest method to upgrade rails to 3.0.10, and is upgrading to rails 3.0.10 completely safe, or do I run the risk of some gem dependencies breaking something?
I had good success with the following approach:
Ensure that all your files that are relevant for development and production are in source control (preferably Git).
Ensure that your current 3.0.3 status is clean, everything is commited.
Make a branch on that.
Upgrade your Gemfile to ensure that the Rails version is upgrade to 3.0.10.
Do the normal bundle install tasks.
Do your tests as usual (you do have tests, no :-)).
Look for warnings and errors in the log.
If everything works fine, commit your changes, and switch back to your master.
Merge the changes and do then a normal delivery (not part of my answer).
Depending on the data you have in production, there may be extra steps necessary, but normally, you don't change any functionality, you just upgrade the Rails version, so normally no migration change is necessary.
PS: The real job then is to upgrade to Rails 3.1.x ...
The safest way is to do it first on a staging server first. Other than that I didn't see anything bad in 3.0.x Rails, but I was small doing incremental upgrades mostly.
I noticed that when I set my Rails app to production it created a folder in my application called RAILS_ENV=production I've kinda rolled back now and not pushing to production. Am I free to delete this folder?
The "rails" command in Rails 2 creates a new app, while the same in Rails 3 runs script/... so it looks like you've installed an old version of Rails on your production server.
If it's your development machine, this can happen when you have rvm installed with different versions of rails.
I have now fixed this issue, there was a 'PATH' setting in my bundler config file that kept re-creating the folder when I updated my bundle. I removed the path declaration and now it uses the default path.
I've inherited a rails site that I need to deploy (quickly!) to our webhost, which is a standard *nix shared server that uses FastCGI for rails apps. I've worked with rails sites on multiple occasions in the past but wouldn't consider myself an expert by any stretch.
This particular app was developed using capistrano, with which I've got no experience, and everything I've read leads me to believe that to deploy the app "properly" would require my setting up an external svn account, among other things, which aren't feasible given our time frame and hosting situation.
My question is: what is the best way to quickly get this application up and running without using capistrano? I received, along with the site files, a .sql dump that I've already imported, and I've configured config/database.yml to reflect the correct production db settings. Right now, running ruby script/console production yields the following error message:
/home/user1/ruby/gems/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:443:in `load_missing_constant':NameError: uninitialized constant ApplicationController
Thanks for your consideration!
As the others already stated, you are probably using the incorrect version.
Rails switched from app_controller to application_controller (or something like that) in version 2.1 or 2.2.
There is a rake task that you should be able to run in that case:
rake rails:update:application_controller
It might help you.
As for the capistrano. In your deploy.rb you can add the parameter :deploy_via :
set :deploy_via, :copy
set :scm, :none
And it should use the copy you are having in your working directory to deploy with (no need for subversion or any other version control)
Copy usually fetches the code from a repository locally and then uploads it to the server, but also setting the :scm to none it should ignore that and just (hopefully) use your working copy instead.
All capistrano requires is a deploy.rb and a Capfile, this is not what is causing your error. From the looks of it it seems that the problem is that you're using a gem rails version which is incompatible with your app, do you know which version it was developed with? If so you should try vendoring your rails directory to the right version.
For deployment, if you're using FastCGI you can just upload the files to the host and set the appropriate permissions and you should be good to go. Going forward you might want to look at upgrading to a newer version of rails, using capistrano and changing your environment to use apache passenger.
I hope this helps.
The problem you're running into appears to be a mismatch of your installed version and the version that the app is expecting. Look in config/environment.rb, Toward the top you'll see something that looks like:
RAILS_GEM_VERSION = '2.3.4'
You need to make sure that the version of rails installed on your machine matches whatever version is declared in that file. You can do that by running:
sudo gem install -v=X.X.X rails
where X.X.X matches what was in your environment.rb.
Jonnii is suggesting you "freeze" your rails by including all the rails code into your project directly, (which can be done by running rake rails:freeze:gems AFTER you have followed the above steps and gotten the correct gems installed in the first place.) Once you've frozen rails, then you no longer need to have the rails gems installed on your webserver machine.
Good luck!