I'd like to now if anybody could help me with my heroku deployement.
I've set up my Rails 3.2 app with the following Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3-ruby', :require => 'sqlite3'
gem 'mongoid'
gem 'bson_ext'
gem 'mongoid_slug'
gem 'heroku'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem "compass", ">= 0.12.alpha"
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
And I have run the rails g mongoid:config command
From the heroku support, I've added the mongolab extension and changed the mongoid.yml evironnement variables to MONGOLAB_URI
When I then deploy the app, it doesn't run on heroku.
I'm not sure what is going on, but i get this error message in the Heroku logs:
WARNING: Invalid .gemspec format in '/app/.bundle/gems/ruby/1.9.1/specifications/actionmailer-3.2.0.gemspec'
2012-01-29T19:13:46+00:00 app[web.1]: Could not find activemodel-3.2.0 in any of the sources
here is the full log file:
https://gist.github.com/1700231
has anybody experienced the same issue? I'm not sure if the problem comes from my set up or if I need to add something to rails to work with mongoid?
Cheers.
It's been a bit of pain int the b*tt, but I'm finally there.
http://railsapps.github.com/rails-heroku-tutorial.html
is the right place to go to deplay rails 3.2 on heroku.
This said my head hurt, not too much fun to get so many hurdles when one wants to learn.
Octopress looks fine at the moment I tell you :)
Alright let's keep going
Related
I am trying to learn Ruby on Rails through this online tutorial
http://ruby.railstutorial.org/ruby-on-rails-tutorial-book
I'm creating an app demo_app for their second chapter.
This is what my gemfile currently looks like
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.4'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.2'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
this is what it's supposed to look like
source 'https://rubygems.org'
ruby '2.0.0'
#ruby-gemset=railstutorial_rails_4_0
gem 'rails', '4.0.4'
group :development do
gem 'sqlite3', '1.3.8'
end
gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
group :doc do
gem 'sdoc', '0.3.20', require: false
end
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
end
I don't understand why my gemfile looks so different.
I have the updated versions of rails, ruby and gemfile.
I even ran the commands
bundle install --without production
bundle update
bundle install
and my gemfile still looks like my first snippet of code.
I've been reading through chapters 1 and 2 of this tutorial but can't figure this out. Am I supposed to edit Gemfile in the text editor? I've already tried that and I got a hundred error messages.
How do I install the gemfile so it looks like the code in the second snippet?
Please help
Let's look through the gemfile item by item (Note that any of the numbers after gems are versions and it isn't necessary that your versions match his. You can specify them if you'd feel more comfortable but unless you come to some bug that needs it, you should be fine without.)
source 'https://rubygems.org' - You both have this and this is where the gem, bundle, etc. commands in the console get your gems from for installation.
ruby '2.0.0' - He has this and you don't. What is this doing? It's specifying the version of ruby that he's using in his rails app. You can do this if you want but it won't be necessary unless you've got multiple versions of ruby installed. Perhaps you're using RVM (Ruby Version Manager) in which case this will probably be necessary. Make sure it's the version you have by using ruby -v in the console to check your version. (Output will look something like this: ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0] where in the gemfile you can leave everything off besides the 2.1.1
#ruby-gemset=railstutorial_rails_4_0 - This is a comment in his gemfile for his own use. Likely he has multiple gem files and this helps him know which one to use when making the tutorial.
gem 'rails', '4.0.4' - You both have that which is just the version of rails you're using.
Next we have
group :development do
gem 'sqlite3', '1.3.8'
end
This is somewhat different than yours but how come? First of all the group :development do means that we only want to "do" (read: use) the gems in this block when we're in the development group. This one can be more clearly called an environment and can be configured/found in the config/environments/ folder. This is useful for having different gems and settings when running the rails server in development or test or production mode. He has the sqlite3 gem in the development group because he wants to use rails's default database gem for the tutorial. You will notice that you have the sqlite3 gem as well which means you can follow his tutorial successfully.
gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
You have all these gems in your gemfile as well so no problems there. (They may be with different versions and with comments above them so that you know why each gem is there which is good. Rails puts the comments in by default for clarity in coding.)
group :doc do
gem 'sdoc', '0.3.20', require: false
end
Same as yours and likewise used for the docs group. It means that it won't be used unless you're specifically looking for it.
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
end
From person experience, I know that these are two gems that are required to deploy an app in production to heroku (a free hosting site) which you'll cover in chapter 1.4. You do not have them because you don't need them until you deploy to heroku. The production group again specifies that you want these gems for when the server runs in production (as it will on heroku). The pg gem is for postgres which is a database alternative to sqlite3 and the rails_12factor is something that enhances 12factor app handling. More can be learned here but it is only necessary to know that heroku requires it to host a rails app.
All the gems in yours that aren't in his and are commented out in yours are old rails standards that are left in because plenty of people still use them and they aren't truly phased out yet. They will not be necessary for the tutorial and you can delete them if you'd like.
Sorry it was long. Hope this helps your understanding.
It looks like your going through Hartl's tutorial, it's a great tutorial, however, if this is your first time coding and or using an MVC framework, everything is going to look like gibberish. Although this is bad practice moving forward, I suggest copying the entire gemfile that Hartl provides into your gemfile and then do a bundle install.
The point of this tutorial for beginners is to get through it with a BASIC understanding of how everything works. It's going to go over a lot of concepts that your not necessarily going to understand or use right away. The best thing to do is power through the best you can and try to finish the app. I finished it in 3 weeks and was more confused than ever, things only started to sync in once I started experimenting on my own and using the tutorial and other ruby/rails docs as a reference.
Programming is hard, and if this is your first foray into application development, I suggest having a basic understanding of Ruby first (http://www.codecademy.com/tracks/ruby) or even learning a scripting language like python (http://www.learnpython.org/). Learning python basics for some odd reason helped me understand ruby better, which made it easier to navigate and understand all the components of rails.
Anyway good luck and stick with it, there are tons of online resources to get you where you need to go. You just have to keep digging.
My first Rails project deploy, and I've run into an issue.
The project is Rails 3.2.1, Ruby 1.9.3
Yesterday, I was given the hosting access, and they're having Rails 2.3.3, Ruby 1.8.7
If I'll decide to still deploy the app there, what changes do I need to make to it?
Specifically, I'm interested in Gemfile changes.
Here's my current gemfile:
source 'https://rubygems.org'
gem 'rails', '2.3.3'#'3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'haml-rails'
gem 'haml'
gem 'omniauth-twitter'
What do I need to change? How do I look-up all the required dependencies and gems versions for old Rails versions?
Downgrading from 3.x to 2.3 is the dumbest thing you can do in your case.
Install gems locally, or ask your hosting company support department — they have to help.
If you can't, save your time — use Heroku, OpenShift or any other hosting company.
I am currently encountering couple of issues with the a rails application deployed on Linode server. The gemfile looks like below :
source 'https://rubygems.org'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'rails', '3.2.8'
gem 'mysql2'
gem 'activeadmin',:git => "git#github.com:sadanmasroor/active_admin.git"
gem 'jquery-rails'
gem 'roo'
group :production do
gem 'unicorn'
end
group :development do
gem 'thin'
gem 'capistrano'
end
Apparently there were list of issues with ActiveAdmin in the beginning mostly with activeadmin assets which I finally overcame by debugging the issues. Now the problem is that the assets precompile successfully in development and also in production ( Capistrano Assets Precompile Task) however I am getting a 500 error when accessing the index page even.
The weird part is that there is no error in production log. It just shows that the assets precompiled successfully. I have no idea what exactly is causing this issue. I have been trying to figure this thing out for almost three days now. Have tried literally everything I could to resolve it from the ActiveAdmin issues to stackoverflow and everything but no result. If I revert the code to the last stable one and than deploy everything works perfectly.
I would be very thankful to anybody who can point me to the right direction to fix this thing.
Thanks
After spending almost 2 days to fix the issue I used the old version of ActiveAdmin instead of the new latest release and everything worked like a charm.
Firstly, Im a big fan of sphinx search. Thanks to sphinx.
Now my question is,
We are ready with a rails 3.1 app which uses sphinx search for full text searching.
Now, I know heroku is the best when it comes to rails hosting. It does not have support
for sphinxsearch, I hear.
If any of you know the right place to host a rails 3.1 app with sphinx search please
guide me.
I will mention the other things that Im using in my rails 3.1 app as listed in my gem
file.
#############################################################
source ' http://rubygems.org '
gem 'rails', '3.1.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
gem 'execjs'
gem 'therubyracer'
gem 'thinking-sphinx', '2.0.10'
gem "gritter", "1.0.1"
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.1.4'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'will_paginate', '3.0.pre2'
gem 'jquery-rails'
gem 'client_side_validations'
gem "bcrypt-ruby", :require => "bcrypt"
#############################################################
Thank you so much.
Actually, Heroku does support Sphinx through the Flying Sphinx add-on. Otherwise, any decent VPS should work for you. Linode, in particular, has a pretty good reputation.
I'm not sure why, but whenever I run rake assets:precompile, application.js doesn't get compiled. I get a "application.js isn't precompiled" error in production mode.
Here is my Gemfile if it means anything:
source 'http://rubygems.org'
gem 'rails', '3.1.1'
gem 'eventmachine', '1.0.0.beta.4.1'
gem 'thin'
gem 'mysql'
gem 'win32-open3-19'
gem 'paperclip', '2.3.8'
#gem 'jammit'
gem 'jsmin'
gem 'will_paginate'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.1.4'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
group :test do
# Pretty printed test output
gem 'turn', :require => false
end
I made a new rails app and tested the rake assets:precompile and it's working. The only difference between the two apps in terms of relevant files would be what gems I have installed. "application.js" is the same between both apps...as are the environment.rb files.
Also of note...when I include a random .js file in my assets/javascripts directory and use "javascript_include_tag :application", one of the resulting URLs in dev mode look like so: /assets/../javascripts/anytimec.js?body=1 and they obviously fail with 404. However the application.js file is referenced correctly.
UPDATE:
Looking into what Sprockets generates I've noticed that the "logical path" uses "../javascripts" in the location. I tested this by looking at the dump of asset_paths.asset_for('application','js') and asset_paths.asset_for('anytimec','js') respectively. I've also compared those dumps to the same files from a fresh application. The fresh application does NOT prepend the "../javascripts" to the location whereas my current app DOES. It doesn't do this to the CSS files or anything else...just javascript. This is most definitely alluding to the core problem but I don't know where to go from here.
After discovering that it had to do with Sprockets failing when reading a folder specifically called "java" in the assets folder, I renamed it to "applets" and it started working.
See this post for the answer.