Error starting application with POW - Bundler::GemNotFound - ruby-on-rails-4

I'm using Anvil to manage my local sites. I have several and they all work fine apart from one, my most recent site.
The error i get when i attempt to start it is:
Error starting application
Your Rack app raised an exception when Pow tried to run it.
Bundler::GemNotFound: Could not find execjs-2.2.2 in any of the sources
Here is my Gemfile:
source 'https://rubygems.org'
gem 'rails', '4.1.4'
gem 'sqlite3', group: :development
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
# gem 'therubyracer', platforms: :ruby
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'spring', group: :development
gem "twitter-bootstrap-rails"
gem "simple_form"
gem "httparty"
gem 'rails_12factor', group: :production
gem 'pg', group: :production
I've had a look through questions on SO and google but haven't been able to figure it out.
I'm using RVM version 1.25.28
Thanks

This issue seemed to be a result of RVM. I didn't have to do this is any of my other projects but for this one I did the following in order to load RVM into the app's .powrc file:
create .powrc file in root directory
Add this:
if [ -f "$rvm_path/scripts/rvm" ]; then
source "$rvm_path/scripts/rvm"
if [ -f ".rvmrc" ]; then
source ".rvmrc"
fi
if [ -f ".ruby-version" ]; then
rvm use `cat .ruby-version`
fi
if [ -f ".ruby-gemset" ]; then
rvm gemset use --create `cat .ruby-gemset`
fi
fi
save
And that's it
Hopefully this may be of use in the future to others
Cheers

Related

Updating to Rails 5.1.4: Bundler could not find compatible versions for gem "rack"

My Rails app is at 4.2.7 and I'm updating to 5.1.4. When I change the Gemfile:
gem 'rails', '5.1.4' then run bundle update rails, I get this error:
Bundler could not find compatible versions for gem "rack":
In Gemfile:
rails (= 5.1.4) was resolved to 5.1.4, which depends on
actionpack (= 5.1.4) was resolved to 5.1.4, which depends on
rack (~> 2.0)
mailcatcher was resolved to 0.6.5, which depends on
rack (~> 1.5)
I checked the rack releases, but I don't know what to do with this information. How can I solve this?
I'll just paste the entire Gemfile so I don't miss anything:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '5.1.4'
# Use postgres as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails' # , '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails'
gem 'haml-rails'
# 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'
gem 'jquery-turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
gem 'rspec-rails', group: [:development, :test]
gem 'spinach-rails', group: [:development, :test]
gem 'database_cleaner', group: :test
gem 'simplecov', require: false, group: :test
gem 'selenium-webdriver', group: [:development, :test]
gem 'cancancan', '~> 1.10'
gem 'mailcatcher'
gem 'settingslogic'
gem 'devise'
gem 'factory_girl_rails', group: [:development, :test, :production]
gem 'capybara', '~> 2.7.1', group: [:development, :test]
gem 'faker'
gem 'yard', group: :development
gem 'pry-rails', group: :development
gem 'bootstrap-sass', '~> 3.3.1'
gem 'autoprefixer-rails'
gem 'simple_form'
gem 'jquery-datatables-rails', '~> 3.3.0'
gem 'jquery-ui-rails'
gem 'ajax-datatables-rails'
gem "font-awesome-rails"
gem "breadcrumbs_on_rails"
gem 'bootstrap-datepicker-rails', require: 'bootstrap-datepicker-rails', git: 'git://github.com/Nerian/bootstrap-datepicker-rails.git'
gem "font-ionicons-rails"
gem 'rack-mini-profiler', group: :development
gem "rails_best_practices", group: :development
gem 'rubocop', '~> 0.40.0', require: false, group: :development
gem 'nested_form', github: 'ryanb/nested_form'
gem "i18n-js", ">= 3.0.0.rc11"
gem 'public_activity', '~> 1.4.1'
gem 'rename', '~> 1.0.2'
gem 'charlock_holmes'
gem 'delayed_job_active_record'
gem 'carrierwave'
# PDF viewer
gem 'pdfjs_rails'
# Paginate
gem 'kaminari'
gem 'bootstrap-kaminari-views', '~> 0.0.5'
# Detect mobile/tablet device, browser type, etc.
gem 'browser'
gem 'prawn'
gem 'prawn-table'
gem 'rubyzip'
gem 'axlsx', '~> 2.0.1'
gem 'axlsx_rails'
gem 'bootstrap-multiselect-rails', '~> 0.9.9'
gem 'whenever', require: false
gem 'turnout'
gem 'ranked-model'
group :production do
gem 'capistrano', '~> 3.5'
gem 'capistrano-rails', '~> 1.1.0'
gem 'capistrano-bundler'
gem 'capistrano-rbenv', '~> 2.0'
gem 'unicorn'
end
Deleting Gemfile.lock then bundle update solved this.

Sure you're not looking for /faye ? showing on heroku for my chatt application

A simple chat demo application i have deployed on heroku but it show me 'Sure you're not looking for /faye ?' instead of running application..
I have gem structure as :
source 'https://rubygems.org'
gem "private_pub"
gem "thin"
gem 'devise'
gem 'rails', '4.2.6'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails'
gem 'therubyracer', platforms: :ruby
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
group :development, :test do
gem 'byebug'
gem 'test-unit', '~> 3.0'
end
group :development do
gem 'spring'
gem 'sqlite3'
end
group :production do
gem 'rails_12factor'
gem 'pg'
end
**
And my Procfile that i am trying to run on heroku:
web: bundle exec rackup private_pub.ru -s thin -p $PORT -E production
::::privat_pub.yml file :
development:
server: "http://localhost:9292/faye"
secret_token: "secret"
test:
server: "http://localhost:9292/faye"
secret_token: "secret"
production:
server: "http://chatmanoj.herokuapp.com/faye"
secret_token: "fa3a4537eb321521a40fce4fa4d7bb055436e1f6ba5e74a3c85ec683c5abe997"
signature_expiration: 3600 # one hour

How to deploy Rails App using private_pub to heroku

I am trying to run my app on heroku which is using private_pub gem . Here in my local server I am running it perfectly . How can I push this app in heroku and run there perfectly . Here is my gem file :
source 'https://rubygems.org'
gem 'rails', '4.2.1'
gem 'sass-rails', '5.0.2'
gem 'uglifier', '2.5.3'
gem 'coffee-rails', '4.1.0'
gem 'jquery-rails', '4.0.3'
gem 'turbolinks', '2.3.0'
gem 'jbuilder', '2.2.3'
gem 'bcrypt', '3.1.7'
gem 'mailboxer'
gem 'bootstrap-sass', '3.2.0.0'
gem 'sdoc', '0.4.0', group: :doc
gem 'devise'
gem 'paperclip', '~> 4.1'
gem 'will_paginate', '3.0.7'
gem 'bootstrap-will_paginate', '0.0.10'
gem 'faker', '1.4.2'
gem 'chosen-rails'
gem 'jquery-turbolinks'
gem 'private_pub'
gem "thin"
#gem 'puma', '2.11.1'
group :development, :test do
#gem 'sqlite3', '1.3.9'
gem 'mysql2'
#gem 'byebug', '3.4.0'
gem 'web-console', '2.0.0.beta3'
gem 'spring', '1.1.3'
gem 'byebug', '3.4.0'
end
group :test do
gem 'minitest-reporters', '1.0.5'
gem 'mini_backtrace', '0.1.3'
gem 'guard-minitest', '2.3.1'
end
group :production do
gem 'pg', '0.17.1'
gem 'rails_12factor', '0.0.2'
gem 'puma', '2.11.1'
end
And This is my private_pub.yml file :
development:
server: "http://localhost:9292/faye"
secret_token: "secret"
test:
server: "http://localhost:9292/faye"
secret_token: "secret"
production:
server: "https://sheltered-sea-1191.herokuapp.com/faye"
secret_token: "mysecret key"
signature_expiration: 3600 # one hour
How can I push this app in heroku help me to push this on herok .
For this above question I have created a new heroku app and I put this code as it is told in this tutorial https://webprogramming29.wordpress.com/2013/02/15/setup-privatepub-or-faye-on-heroku/
And then I edited my code using the following tutorial and it is working great

Prawn in a Ruby on Rails app, failing on production

I am stuck on an issue with running prawn in production.
I have followed the Railscast (revised http://railscasts.com/episodes/153-pdfs-with-prawn-revised?view=asciicast) pretty much to the letter. It works great in my development environment (Mac OS X 10.9.1) but causes unicorn to falter on my server. My production server is (Redhat => Red Hat Enterprise Linux Server release 6.4 (Santiago)). I have the gem installed via Gemfile.
Gemfile:
gem 'prawn'
gem 'prawn-qrcode'
Controller: (show action)
def show
##classroom = Classroom.find(params[:id])
#classroom = find_classroom
#page_title = #classroom.location.name
#classroom_alt = #classroom.location.name + " - " + #classroom.room_number
#building = find_building(#classroom.location_id)
#owner = Owner.find(#classroom.owner_id)
#room_schedule_contact = RoomScheduleContact.find_by rmrecnbr:(#classroom.rmrecnbr)
#building_image = #building.picture.url(:medium).to_s
#building_sign_image = #building.building_sign.url(:thumb).to_s
#search = Classroom.search(params[:search])
##classroom_herprod = Building.find(params[:location_id]).building_short_code
respond_to do |format|
format.html # show.html.erb
format.png { render :qrcode => "http://rooms.lsa.umich.edu/classrooms/#{#classroom.facility_code_heprod}", :level => :l, :unit => 8 }
format.pdf do
pdf = ClassroomPdf.new(#classroom)
send_data pdf.render, type: "application/pdf",
disposition: "inline"
end
end
end
I have a pdfs directory with a classroom_pdf.rb file that includes the following.
class ClassroomPdf < Prawn::Document
def initialize(classroom)
super(top_margin: 70)
text "This is a pdf"
end
end
(This is stripped down from what I had, but it is the most basic version that works on my dev system and fails on production).
I am running the following
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]
gem 'rails', '4.0.2'
The error in the unicorn.stderr.log is as follows.
E, [2014-02-07T12:39:20.400750 #7300] ERROR -- : reaped #<Process::Status: pid 7306 exit 1> worker=1
I, [2014-02-07T12:39:20.401257 #7300] INFO -- : worker=1 spawning...
I, [2014-02-07T12:39:20.463964 #7529] INFO -- : worker=1 spawned pid=7529
I, [2014-02-07T12:39:20.521524 #7529] INFO -- : Refreshing Gem list
E, [2014-02-07T12:39:29.938423 #7326] ERROR -- : uninitialized constant Prawn (NameError)
/var/www/rooms.lsa.umich.edu/html/iris/releases/20140207173433/app/pdfs/classroom_pdf.rb:1:in `<top (required)>'
/var/www/rooms.lsa.umich.edu/html/iris/shared/bundle/ruby/2.0.0/gems/railties-4.0.1/lib/rails/engine.rb:465:in `block (2 levels) in eager_load!'
Here is the gemfile
source 'https://rubygems.org'
##gem 'rails', '3.2.14'
gem 'rails', '4.0.2'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
#gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
gem "haml"
#gem 'anjlab-bootstrap-rails', :require => 'bootstrap-rails'
gem 'bootstrap-sass', '~> 3.1.0'
#gem 'google-analytics-rails'
gem 'font-awesome-rails'
gem 'protected_attributes'
gem 'modernizr-rails'
gem "jquery-rails"
gem "devise", "3.0.3"
gem "cancan", ">= 1.6.9"
gem "rolify", ">= 3.2.0"
gem 'newrelic_rpm'
# QR-Code generation
gem 'rqrcode-rails3'
gem 'mini_magick'
gem 'prawn'
#gem 'prawn', '1.0.0.rc2'
gem 'prawn-qrcode'
#gem 'prawnto'
gem 'capistrano', '2.15.5'
#gem 'capistrano'
gem "simple_form"
gem 'will_paginate', '~> 3.0.5'
gem "therubyracer", :group => :assets, :platform => :ruby
gem 'will_paginate-bootstrap'
#gem 'kaminari'
## Used for uploading and resizing images (Need both paperclip and mini_magick)
gem "paperclip", "3.5.1"
#gem "meta_search"
gem "ransack"
gem 'annotate', ">=2.6.0"
group :production do
gem 'unicorn'
end
Any ideas?
It turns out that I needed to manually reboot unicorn for it to properly load the new gem file.

Active admin in Rails 4 throws error "Invalid option key"

Rails 4 app working just fine until Active Admin is included (from this thread) in the gemfile.
My Gemfile:
gem 'rails', '4.0.0'
gem 'rails_12factor', group: :production
gem 'pg'
gem 'sass-rails', '~> 4.0.0.rc1'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'activeadmin', github: 'gregbell/active_admin'
gem 'protected_attributes'
gem 'rails-observers'
gem 'actionpack-page_caching'
gem 'actionpack-action_caching'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
group :doc do
gem 'sdoc', require: false
end
The error is thrown while attempting to start the rails server after a clean bundle install.
/var/lib/gems/1.9.1/gems/actionpack-4.0.0/lib/action_controller/railtie.rb:55:in `block (3 levels) in <class:Railtie>': Invalid option key: page_cache_directory= (RuntimeError)
Any help is greatly appreciated!
Try to use:
http://blog.remarkablelabs.com/2012/12/russian-doll-caching-cache-digests-rails-4-countdown-to-2013
Or:
run bundle install and reinstall actionpack-action_caching
https://github.com/rails/actionpack-action_caching