Enki deployment to Heroku - problems with assets precompile - ruby-on-rails-3

I cloned this https://github.com/xaviershay/enki and did the following modifications:
My Gemfile now looks like this:
source 'https://rubygems.org'
gem 'rails', '3.2.6'
# 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.2.3'
end
group :production do
gem 'pg'
end
group :development do
gem 'mysql2', '~> 0.3.11'
end
platforms :jruby do
gem 'activerecord-jdbcsqlite3-adapter'
gem 'trinidad'
gem 'jruby-openssl'
end
gem 'jquery-rails'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug'
# Bundle the extra gems:
gem 'RedCloth', '~> 4.2.9', :require => 'redcloth'
gem 'ruby-openid', :require => 'openid'
gem 'rack-openid', :require => 'rack/openid'
gem 'aaronh-chronic', :require => 'chronic' # Fixes for 1.9.2
gem 'coderay'
gem 'lesstile'
gem 'formtastic'
gem 'will_paginate', '~> 3.0.2'
gem 'exception_notification', '~> 2.5.2'
gem 'open_id_authentication'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
group :test do
gem 'database_cleaner'
gem 'cucumber-rails', :require => false
gem 'cucumber-websteps', :require => false
gem 'factory_girl'
gem 'rspec'
gem 'nokogiri', '~> 1.5.0'
gem 'webrat'
end
group :development, :test do
gem 'rspec-rails'
end
And I also modified the database.yml file to look like this:
development:
adapter: mysql2
database: myblog_development
username: root
password:
host: localhost
test:
adapter: mysql2
database: myblog_test
username: root
password:
host: localhost
I am able to check the site in my local, but when trying to deploy to Heroku I get the following:
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
Tasks: TOP => environment
(See full trace by running task with --trace)
Precompiling assets failed, enabling runtime asset compilation
Injecting rails31_enable_runtime_asset_compilation
Please see this article for troubleshooting help:
http://devcenter.heroku.com/articles/rails31_heroku_cedar#troubleshooting
I tried doing what they suggest in that last site, but still getting the same error. What am I missing?

In your application.rb file, add this line:
config.assets.initialize_on_precompile = false

Related

MongoDB error with Mongoid, Heroku, Device, MongoHQ and Rails

I'm working on a simple app that is currently deployed to heroku now - it is using mongoid, device and can create user login very easily in localhost, but not in production at heroku. You can try to create an account, and it gives an error after submit.
I think my mongoid.yml for production needs to change, but I have no idea how.
My heroku config has the following:
=== Config Vars for bookfoo
DATABASE_URL: postgres://jeibucpexp:bVZzGaGPUeGylwmA7dyE#ec2-107-20-186-97.compute-1.amazonaws.com/jeibucpexp
GEM_PATH: vendor/bundle/ruby/1.9.1
LANG: en_US.UTF-8
MONGOHQ_URL: mongodb://heroku:14bc6d476e6449c952d6350b07e89643#alex.mongohq.com:10065/app6153931
MONGOLAB_URI: mongodb://heroku_app6153931:og03dk0hdrj7r8lsit51k6ah9n#ds037097-a.mongolab.com:37097/heroku_app6153931
PATH: bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin
RACK_ENV: production
RAILS_ENV: production
SHARED_DATABASE_URL: postgres://jeibucpexp:bVZzGaGPUeGylwmA7dyE#ec2-107-20-186-97.compute-1.amazonaws.com/jeibucpexp
mongoid.yml has the following as suggested in heroku:
development:
sessions:
default:
database: bookfoo_app_development
hosts:
- localhost:27017
options:
consistency: :strong
options:
test:
sessions:
default:
database: bookfoo_app_test
hosts:
- localhost:27017
options:
consistency: :strong
production:
sessions:
default:
uri: <%= ENV['MONGOHQ_URL'] %>
options:
skip_version_check: true
safe: true
my gemfile has the following:
source 'https://rubygems.org'
gem 'rails', '3.2.3'
group :development, :test do
gem 'sqlite3'
gem 'rspec-rails'
end
group :test do
gem 'database_cleaner'
gem 'mongoid-rspec'
gem 'factory_girl_rails'
gem 'email_spec'
gem 'capybara'
gem 'launchy'
end
group :production do
gem 'thin'
end
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem "mongoid", :git => "git://github.com/mongoid/mongoid.git"
gem "bson_ext"
gem "devise"
after git push heroku master it gives me the following hints:
There is a configuration error with the current mongoid.yml.
Problem:
No database provided for session configuration: :options.
Summary:
Each session configuration must provide a database so Mongoid knows where the default database to persist to. What was provided was: {"skip_version_check"=>true, "safe"=>true}.
Resolution:
If configuring via a mongoid.yml, ensure that within your :options section a :database value for the session's default database is defined.
Example:
\_\_development:
\_\_\_\_sessions:
\_\_\_\_\_\_options:
\_\_\_\_\_\_\_\_database: my_app_db
\_\_\_\_\_\_\_\_hosts:
\_\_\_\_\_\_\_\_\_\_- localhost:27017
mongoid.yml should be so (my indentation was wrong):
production:
sessions:
default:
uri: <%= ENV['MONGOHQ_URL'] %>
options:
skip_version_check: true
safe: true

Aptana Studio 3 - unable to remote debug rails app deployed on virtualbox

Hello I have problem to remote debugging rails app (deployed on vagrant vm) in Aptana 3.
Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.3'
gem 'bootstrap-sass', '2.0.0'
gem 'bcrypt-ruby', '3.0.1'
gem 'linecache19', :git => 'git://github.com/mark-moseley/linecache'
gem 'ruby-debug-base19x', '~> 0.11.30.pre4'
gem 'ruby-debug19',:require => 'ruby-debug'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :development, :test do
gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.9.0'
gem 'rb-inotify', '0.8.8'
gem 'libnotify', '0.5.9'
gem "watchr", "~> 0.7"
gem 'guard-rspec', '0.5.5'
gem 'guard'
gem 'annotate', '~> 2.4.1.beta'
gem 'sextant'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '3.2.4'
gem 'coffee-rails', '3.2.2'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer'
gem 'uglifier', '1.2.3'
end
gem 'jquery-rails', '2.0.0'
group :test do
gem 'capybara', '1.1.2'
gem 'spork', '~> 0.9.0'
gem 'factory_girl_rails', '1.4.0'
end
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
rails s -u:
=> Booting WEBrick
=> Rails 3.2.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
=> Debugger enabled
[2012-06-01 06:41:48] INFO WEBrick 1.3.1
[2012-06-01 06:41:48] INFO ruby 1.9.3 (2011-10-30) [i686-linux]
[2012-06-01 06:41:48] INFO WEBrick::HTTPServer#start: pid=14225 port=3000
so debug mode is enabled
In Aptana 3:
Debug -> Debug Configurations -> Remote Ruby Debug Sessions, create new with:
host: localhost
port: 3000
Tried to run 'Debug' but I still get Problem occured dialog with 'An internal error occurred during: "Launching rails".
null'
Any idea what to do to enable aptana 3 remote debugging?
Thank you.

Rails 3 Coffee Handler Missing

Im using Ruby 1.9.3p0, Rails 3.1.2 with Apache and Passenger in Production. When I try to make a remote function, it throws me this error:
ActionView::MissingTemplate (Missing template video/loadVideo, application/loadVideo with
{:handlers=>[:erb, :builder], :formats=>[:js, "application/ecmascript", "application/x-
ecmascript", :html, :text, :js, :css, :ics, :csv, :xml, :rss, :atom, :yaml,
:multipart_form, :url_encoded_form, :json], :locale=>[:en, :en]}. Searched in
As you can see, there is no handler for :coffee, that's the reason why is not processing the file video/loadVideo.js.coffee; I run the command rake assets:precompile but nothing changes.
The Gemfile
source 'http://rubygems.org'
gem 'rails', '3.1.2'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'will_paginate', '~> 3.0'
gem "bcrypt-ruby", :require => "bcrypt"
gem 'mysql'
#Problems in Debian, the error was:
#Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs #for a list of available runtimes. (ExecJS::RuntimeUnavailable)
#Solution: http://stackoverflow.com/questions/6282307/rails-3-1-execjs-and-could-not-find-a-javascript-runtime
gem 'execjs'
gem 'therubyracer'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.1.5.rc.2'
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', '0.8.2', :require => false
end
Change your Gemfile (move coffee-rails gem outside the assets group) or change your application.rb settings - for instance
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
# Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
Bundler.require(:default, :assets, Rails.env)
end
In development environment application by default loads all of gems from :default, :development, :test, :assets groups. Coffee handler comes from coffee-rails gem, so you have to load it.

test-unit gem displays test stat for every rake run

I using test-unit gem with a Rails 3.1 project, and I have a small issue. If I start rake tasks, I always see a test result, with zeros.
My Gemfile is:
source :rubygems
gem 'rails', '3.1.2'
gem 'sqlite3'
gem 'json_pure'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
# gem 'sass-rails', '~> 3.1.5.rc.2'
# gem 'coffee-rails', '~> 3.1.1'
gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# Rails i18n
gem 'rails-i18n', :git => 'git://github.com/hron84/rails-i18n.git'
# Paginator
gem 'will_paginate'
# To use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the web server
gem 'thin'
# Deploy with Capistrano
gem 'capistrano'
# To use debugger
# gem 'ruby-debug'
group :development do
gem 'rails3-generators'
gem 'nifty-generators'
end
group :test do
gem 'rspec'
gem 'rspec-rails'
gem 'ci_reporter'
gem 'factory_girl'
unless defined? Rubinius
gem 'rcov'
gem 'rcov_rails'
gem 'test-unit'
end
gem 'ruby-prof'
gem 'faker'
end
# Application-related stuffs
gem 'authlogic'
# Slug helper
gem 'slug'
# vim: ft=Gemfile
Is there a way to avoid it? What I do wrong?
Check your RAILS_ENV. Make sure it's set to "development", not "test". If that's not the culprit, try removing gems (particularly test/spec-related ones) one by one until the problem goes away. Then you'll know which gem is giving you the problem.

Could not find generator refinerycms

I am trying to integrate refinerycms into an existing application. Here is my gemfile
source 'http://rubygems.org'
gem 'rails', '~> 3.1.0.rc8'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'mysql2'
gem "arel"
gem 'pdfkit'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', "~> 3.1.0.rc"
gem 'coffee-rails', "~> 3.1.0.rc"
gem 'uglifier'
end
gem 'jquery-rails'
gem 'aws-s3', :require => 'aws/s3'
gem 'stomp'
# 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
gem 'cucumber-rails'
gem 'database_cleaner'
gem 'factory_girl'
end
gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git'
gem 'refinerycms-generators', :git => 'git://github.com/resolve/refinerycms-generators.git'
gem 'seo_meta', :git => 'git://github.com/parndt/seo_meta.git'
# gem 'refinerycms-i18n', '~> 2.0.0', :git => 'git://github.com/resolve/refinerycms-i18n.git'
gem 'devise', '~>1.4.0'
I am following this tutorial: http://refinerycms.com/guides/attaching-refinery-cms-to-an-existing-rails-application
When I get to the rails generate refinerycms part, I receive the following error: Could not find generator refinerycms.
Any ideas on why this is happening?
Env:
rvm 1.6.30
ruby 1.9.2p180
Rails 3.1.0.rc8
The answer is to run the following command:
rails g refinery:cms