uploading to heroku causes an error - heroku-toolbelt

Everytime I try and push my project to Heroku by using git push heroku master I get the following response. I have a macbook air OSX-10.8.
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.3.2
New app detected loading default bundler cache
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/..
Fetching git://github.com/thomas-mcdonald/bootstrap-sass.git
fatal: Could not parse object '9c6c07f74ff515cf38380b014cfede14a4f0eae4'.
Git error: command `git reset --hard 9c6c07f74ff515cf38380b014cfede14a4f0eae4`
in directory
/tmp/build_260d9aa7-1d8e-4738-b10f- fce9113dd86e/vendor/bundle/ruby/2.0.0/bundler/gems/bootstrap-sass-9c6c07f74ff5
has failed.
If this error persists you could try removing the cache directory
'/tmp/build_260d9aa7-1d8e-4738-b10f-fce9113dd86e/vendor/bundle/ruby/2.0.0/cache/bundler/git/bootstrap-sass-33efd1d8ffb6176fdb805029a30f02a6edfbae2e'
Bundler Output: Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/..
Fetching git://github.com/thomas-mcdonald/bootstrap-sass.git
fatal: Could not parse object '9c6c07f74ff515cf38380b014cfede14a4f0eae4'.
Git error: command `git reset --hard 9c6c07f74ff515cf38380b014cfede14a4f0eae4`
in directory
/tmp/build_260d9aa7-1d8e-4738-b10f-fce9113dd86e/vendor/bundle/ruby/2.0.0/bundler/gems/bootstrap-sass-9c6c07f74ff5
has failed.
If this error persists you could try removing the cache directory
'/tmp/build_260d9aa7-1d8e-4738-b10f-fce9113dd86e/vendor/bundle/ruby/2.0.0/cache/bundler/git/bootstrap-sass-33efd1d8ffb6176fdb805029a30f02a6edfbae2e'
!
! Failed to install gems via Bundler.
!
! Push rejected, failed to compile Ruby app
To git#heroku.com:fierce-taiga-8706.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:fierce-taiga-8706.git'
Here is are my git remotes
heroku git#heroku.com:sheltered-crag-6550.git (fetch)
heroku git#heroku.com:sheltered-crag-6550.git (push)
origin git#github.com:TheM00se/Pinteresting.git (fetch)
origin git#github.com:TheM00se/Pinteresting.git (push
Here is my Gemfile
source 'https://rubygems.org'
gem 'rails', '4.0.1'
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'
gem 'bootstrap-sass', github: 'thomas-mcdonald/bootstrap-sass', branch: '3'
group :doc do
gem 'sdoc', require: false
end
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
I've been trying to figure out a solution for 2 hours and really I'm not even sure what the problem is .

The problem is with:
gem 'bootstrap-sass', github: 'thomas-mcdonald/bootstrap-sass', branch: '3'
If you check the link below:
https://github.com/thomas-mcdonald/bootstrap-sass/branches
The branch seems to be deleted, maybe it was merged into the master branch, based on feedback from the OP, anyone using it subsequently should add the below to their Gemfile:
gem 'sass-rails', '>= 3.2' # sass-rails needs to be higher than 3.2
gem 'bootstrap-sass', '~> 3.0.3.0'

Related

Rails:Is it possible to use active_scoffold gem in rails 4.2.6

I installed that gem,when I run
rails g active_scaffold:install
It says
Running via Spring preloader in process 6001
Could not find generator 'scoffold'. Maybe you meant 'scaffold', 'css:scaffold' or 'erb:scaffold'
Run rails generate --help for more options.
gemfile
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', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'active_scaffold', github: 'activescaffold/active_scaffold', branch: 'master'
I found the solution
I changed the steps to install the gem, that steps are
1.Insert the gem in gem file, gem 'active_scaffold' and run bundle install.
2.Run the command "rails g active_scaffold User name:string".
3.In gemfile change gem 'active_scaffold' to "gem 'active_scaffold', github: 'activescaffold/active_scaffold', branch: 'master' " and install the bundle once again.
4.Create a DB by "bundle exec rake db:create".
5.Run "rails g active_scaffold:install".
6.Finally migrate it "rake db:migrate"

IBM_DB Gem issues

When I try to deploy my app to Bluemix I get the following error. My manifest.yml file is here as follows.
applications:
- path: .
memory: 512M
instances: 1
domain: mybluemix.net
name: KnowYourBrand
host: kyb
command: bundle exec rake db:setup && bundle exec rails s -p $PORT
disk_quota: 1024M
services:
- Personality Insights-n2
- Tone Analyzer-uu
- Insights for Twitter-bt
- kybSQLDB
- AlchemyAPI-tw
buildpack: https://github.com/ibmdb/db2rubybuildpack
2015-11-17T13:04:51.55-0600 [App/0] ERR LoadError: libdb2.so.1:
cannot open shared object file: No such file or directory -
/home/vcap/app/vendor/bundle/ru by/2.2.0/extensions/x86_64-linux/
2.2.0-static/ibm_db-2.6.1/ibm_db.so
My gemfile is as follows:
source 'http://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
gem 'backbone-on-rails'
gem 'whenever', :require => false
group :production do
gem 'ibm_db'
gem 'rails_12factor'
end
# 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-script-source', '1.8.0'
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', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
gem 'bcrypt-ruby', '>= 3.1.2', :platform => :ruby
gem 'httparty'
gem 'figaro'
gem "cf-autoconfig", "~> 0.2.1"
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development do
gem 'byebug'
gem 'annotate'
gem 'better_errors'
gem 'binding_of_caller'
gem 'pry-rails'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
end
# Use debugger
# gem 'debugger', group: [:development, :test]
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]
What could the issue be? I tried setting the ibm_db version to an older version, but that did not resolve the issue either.
Environment variable IBM_DB_HOME is not set. Set it to your
DB2/IBM_Data_Server_ Driver installation directory and retry gem
install.
What is the best way to handle this without having to install a driver on my local machine? I am just trying to deploy it to Bluemix.
I'm not entirely sure, but it appears that you need to set the IBM_DB_HOME environment variable. You can configure environment variables either using the cf set-env command, in your manifest.yml file, or in the Bluemix dashboard. I'm not familiar enough with ibm_db gem or DB2 to say what the value should be for this environment variable, but this README in the gem may be helpful (search the page for "IBM_DB_HOME").
You can track this question in ibm_db git issue repository here
The ibm_db gem auto downloads the required files while installing the gem. However after ibm_db gem is installed in Bluemix, it is not able to link the downloaded libraries.
To resolve this problem, please follow below steps.
Step-1. While pushing application with migration, pass a command to set LD_LIBRARY_PATH environment variable as below.
cf push BlogApp2 -c "export
LD_LIBRARY_PATH=/home/vcap/app/vendor/bundle/ruby/2.2.0/gems/ibm_db-3.0.0/lib/clidriver/lib:$LD_LIBRARY_PATH;
bundle exec rake db:migrate"
Note : While running above commad, please specify the Ruby version and ibm_db version that you have specified in gemfile. You can also refer the path in LoadError: libdb2.so error message that you see in server logs on Bluemix.
After application is pushed, you will see that migration has run and you will also see database connection error which is expected.
Step-2. Add below Environment Variable in your application. Login to bluemix -> select your Ruby application -> Click on Environment Variables manu -> Select User defined. -> Add below variable -> Save.
Name - LD_LIBRARY_PATH
Value - /home/vcap/app/vendor/bundle/ruby/2.2.0/gems/ibm_db-3.0.0/lib/clidriver/lib:$LD_LIBRARY_PATH [Refer step-1 for the value]
After adding LD_LIBRARY_PATH to your application in Bluemix, you can push your application from cf command as below.
cf push BlogApp2 -c "null"
Now your application will connect to SQLDB.
Thanks,
Arvind
I ran across this post when I was setting up a Docker image for a node.js server that uses ibm_db. I know this is a ruby app, but this information may help the next person down the road. Here is my Dockerfile that makes node_db available and working.
FROM node:10
# Create app directory
WORKDIR .
# need to download the ibm drivers and set IBM_DB_HOME
ENV NODE_TLS_REJECT_UNAUTHORIZED=0
RUN mkdir /ibmdriver
RUN curl https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/linuxx64_odbc_cli.tar.gz \
| tar -xzf - -C /ibmdriver/
ENV IBM_DB_HOME /ibmdriver/clidriver
ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:$IBM_DB_HOME/lib
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available ([email protected]+)
COPY package*.json ./
RUN npm install
# If you are building your code for production
# RUN npm install --only=production
# Bundle app source
COPY . .
ENV BCCB_DECISIONTREE_SERVICE_PORT 3000
EXPOSE 3000
CMD [ "npm", "start" ]

Assets only compiled after old releases purged when deploying with Capistrano

...I think that's what's happening anyway.
I'm deploying a Rails app to EC2 with Capistrano. The deployment always succeeds, but even if I've just pushed JS/CSS changes to Git, the assets won't compile the first time. When I kept 5 releases, I had to repeat the deployment until all of the old releases were eventually removed. I reduced it to 3, and then to 1. Now, I see a new version of the JS and CSS after 2 consecutive deployments.
In production there are also multiple application.js and application.css files in the shared/public/assets folder including the latest compiled version. Older versions don't seem to get cleaned unless I run rake assets:clobber. rake assets:clean doesn't remove them. I assume it's okay to have more than one version of an asset as long as the manifest points at the right file.
I'd really like assets to precompile when there are new changes. Any help would be appreciated.
Gemfile
gem 'rails', '4.2.3'
gem 'mysql2'
gem 'haml-rails', '~> 0.9'
gem 'sass-rails', '~> 5.0'
gem 'autoprefixer-rails'
gem 'bootstrap-sass', '~> 3.3.5'
gem 'font-awesome-rails'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'therubyracer', platforms: :ruby
gem 'jquery-rails'
gem 'underscore-rails'
gem 'ejs'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
group :development do
gem 'capistrano', '~> 3.4.0'
gem 'capistrano-rails', '~> 1.1'
gem 'capistrano-rbenv', '~> 2.0'
gem 'capistrano-passenger'
end
group :development, :test do
gem 'byebug'
gem 'web-console', '~> 2.0'
gem 'spring'
end
Capfile
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rbenv'
require 'capistrano/rails'
require 'capistrano/passenger'
deploy.rb
set :keep_releases, 1
namespace :deploy do
after :restart, :cleanup, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
...
end
end
end
Capistrano Output
INFO [b2b76675] Running RBENV_ROOT=~/.rbenv RBENV_VERSION=2.2.2 ~/.rbenv/bin/rbenv exec bundle exec rake assets:precompile as ec2-user#xx.xxx.xxx.xxx
DEBUG [b2b76675] Command: cd /var/www/my-app/releases/20150918071822 && ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.2.2 RAILS_ENV=production RBENV_ROOT=~/.rbenv RBENV_VERSION=2.2.2 ~/.rbenv/bin/rbenv exec bundle exec rake assets:precompile )
INFO [b2b76675] Finished in 2.014 seconds with exit status 0 (successful).
Make sure that you are running latest sprockets and sprockets-rails. If you have tmp/cache in linked_dirs, remove it.
If that fixes it and you want the shared cache back, you can try to write a Capistrano task which deletes the contents of tmp/cache/assets at the beginning of deployment.

Sass can't find bootstrap file from bootstrap-sass gem

I've got a fresh rails application, and I'm trying to use the bootstrap-sass gem. When I add #import "bootstrap"; in a .scss file in my app/assets/stylesheets folder, I get this SASS compilation error:
(Line 1: File to import not found or unreadable: bootstrap.
I've seen that many others have had this error, but everything suggested hasn't worked. I've made sure to reboot the server after running bundle install, I even deleted my entire gemset and started fresh. Still, while following the instructions on the bootstrap-sass github page, I get this error, and I can't figure it out!
Gemfile:
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '4.0.0.rc2'
gem 'pg', '~> 0.17.1'
gem 'coffee-rails', '~> 4.0.0'
gem 'sass-rails', '>= 3.2'
gem 'bootstrap-sass', '~> 3.0.3.0'
gem 'uglifier', '>= 1.3.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
group :doc do
gem 'sdoc', require: false
end
gem 'bcrypt-ruby', '~> 3.0.0'
And the error output:
sass --update '/app_root/app/assets/stylesheets/'
> error /path/to/app_root/app/assets/stylesheets/global.scss (Line 1: >File to >import not found or unreadable: bootstrap.
Load paths:
/path/to/app_root/app/assets/stylesheets
/path/to/app_root/app/assets/stylesheets)
>
Compilation exited abnormally with code 1
I'm thinking there may be an issue with the "Load Paths", but when I open a rails console and check Sass.load_paths, it includes the directory of the bootstrap-sass gem.
Any suggestions would be welcome. I've been trying to deal with this for hours now, to no avail.
Ok, I have no idea why this works, but I've been bashing my head against the problem for so long I no longer care.
I found this tutorial and followed it explicitly (easy, because my app is basically empty) from the start. It uses the rails_layout gem, and, somehow, bootstrap is now working as intended.

delayed_job gem won't start in production (Rails 4)

I'm having a problem with getting delayed_job to start in the production environment. Everything works as it should in development just using the rake jobs:work command, but after deploying to my server with Capistrano, and hours of failed attempts later, I cannot figure out how to get DJ running.
As it says to do on the github repository for delayed_job, I made sure I bundled the "daemons" gem, and also attempted to start it with the command "bin/delayed_job start" instead of "script/delayed_job start" since I'm on rails 4. I've also ran the required generator "rails generate delayed_job" which did generate this file inside the bin directory of my project:
#!/usr/bin/env ruby
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
require 'delayed/command'
Delayed::Command.new(ARGV).daemonize
The error I'm consistently getting is -bash: bin/delayed_job: No such file or directory which I think could be since I'm using rvm.
As for my gemfile, I've included delayed_job_active_record and daemons. At this point I'm completely stumped and out of links to explore.
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '4.0.0'
# Rails defaults
gem 'sass-rails', '~> 4.0.0'
gem 'bundler'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
# learn-rails
gem 'anjlab-bootstrap-rails', :require => 'bootstrap-rails', :github => 'anjlab/bootstrap-rails'
gem 'figaro'
gem 'gibbon'
gem 'high_voltage'
gem 'simple_form', '>= 3.0.0.rc'
gem 'delayed_job_active_record', '~> 4.0.0'
group :development, :test do
gem 'sqlite3'
gem 'better_errors'
gem 'quiet_assets'
gem 'capistrano', '~> 2.15.5'
gem 'rvm-capistrano'
gem 'rspec-rails'
end
group :test do
gem "factory_girl_rails", "~> 4.0"
gem 'capybara'
gem 'poltergeist'
gem "faker", "~> 1.2.0"
end
group :production do
gem 'unicorn'
gem 'pg'
gem 'daemons'
end
Make sure the first line in bin/delayed_job points to a valid Ruby executable. You're using just ruby which probably can't be resolved. rvm is adding the full path to ruby when you cd into the rails_root directory, but that's not happening when the script is executed. One slightly hacky solution would be to cd into the directory, do a which ruby and write that into bin/delayed_job, such as: #!<path_to_ruby>. No need to call /usr/bin/env since Capistrano is doing this already.