FreeTDS buildpack on Heroku Cedar OpenSSL Error - ruby

I have a sinatra rack ruby app that I want to deploy on heroku. The app needs to connect to an SQL Server Database. For that I need the TinyTds gem.
Gemfile
source 'http://rubygems.org'
ruby "1.9.3"
gem 'sinatra'
gem 'tiny_tds'
Gemfile.lock after bundle install
GEM
remote: http://rubygems.org/
specs:
rack (1.6.0)
rack-protection (1.5.3)
rack
sinatra (1.4.5)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
tilt (1.4.1)
tiny_tds (0.6.2)
PLATFORMS
ruby
DEPENDENCIES
sinatra
tiny_tds
TinyTds requires FreeTDS which heroku doesn't have apparently. So there are some crazy solutions on the internet with static compiles in heroku-similar VMs and stuff like that. The most reasonable solution was to set a custom buildpack for my app that includes FreeTDS:
heroku create my_new_app --buildpack https://github.com/firmhouse/heroku-buildpack-ruby-freetds.git
However
$ git push heroku master
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Fetching custom git buildpack... done
remote: -----> Ruby/Rack app detected
remote: Installing freetds into /tmp/build_7b7e059c43475a97d6c091bcf9162e16/vendor/freetds
remote:
remote: % Total % Received % Xferd Average Speed Time Time Time Current
remote: Dload Upload Total Spent Left Speed
remote: 100 3590k 100 3590k 0 0 17.8M 0 --:--:-- --:--:-- --:--:-- 17.8M
remote:
remote: -----> Using Ruby version: ruby-1.9.3
remote: -----> Installing dependencies using Bundler version 1.7.12
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
remote: Could not load OpenSSL.
remote: You must recompile Ruby with OpenSSL support or change the sources in your
remote: Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL using
remote: RVM are available at http://rvm.io/packages/openssl.
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote:
remote: ! Push rejected, failed to compile Ruby/Rack app
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to my_new_app.
remote:
To https://git.heroku.com/my_new_app.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/my_new_app.git'
Edit: My question is how do I get heroku to work with tiny_tds.

Related

How do I fix a Bundler Conflict when pushing to Heroku?

I'm attempting to deploy a Sinatra app to Heroku. Everything works locally. However I get an issue with bundler when I try to push it successfully to Heroku.
I've tried to delete the Gemfile lock and then the following
bundle update
git add .
git push "Gemfile.lock"
git push heroku master
gem install bundler:2.0.1
bundle install
git add .
git push "Gemfile.lock"
git push heroku master
bundle update --bundler
git add .
git push "Gemfile.lock"
git push heroku master
Here is my gemfile
source "https://rubygems.org"
# gem "rails"
gem 'sinatra'
gem 'activerecord', '~> 5.2', '>= 5.2.2.1'
gem 'rake'
gem 'sinatra-activerecord'
gem 'require_all'
gem 'bcrypt'
gem 'rack-flash3'
gem 'rb-readline'
group :development, :test do
gem 'sqlite3'
gem 'shotgun'
gem 'pry'
end
group :production do
gem 'pg'
end
Here are the error messages
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rack
remote: -----> Using Ruby version: ruby-2.5.5
remote: -----> Installing dependencies using bundler 2.0.2
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: Activating bundler (2.0.1) failed:
remote: Could not find 'bundler' (2.0.1) required by your /tmp/build_77505ef74596fc4dddd66c8b792d759b/Gemfile.lock.
remote: To update to the latest version installed on your system, run `bundle update --bundler`.
remote: To install the missing version, run `gem install bundler:2.0.1`
remote: Checked in 'GEM_PATH=vendor/bundle/ruby/2.5.0', execute `gem env` for more information
remote:
remote: To install the version of bundler this project requires, run `gem install bundler -v '2.0.1'`
remote: Bundler Output: Activating bundler (2.0.1) failed:
remote: Could not find 'bundler' (2.0.1) required by your /tmp/build_77505ef74596fc4dddd66c8b792d759b/Gemfile.lock.
remote: To update to the latest version installed on your system, run `bundle update --bundler`.
remote: To install the missing version, run `gem install bundler:2.0.1`
remote: Checked in 'GEM_PATH=vendor/bundle/ruby/2.5.0', execute `gem env` for more information
remote:
remote: To install the version of bundler this project requires, run `gem install bundler -v '2.0.1'`
remote:
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to infinite-waters-69714.
remote:
To https://git.heroku.com/infinite-waters-69714.git
! [remote rejected] master -> master (pre-receive hook declined)
Additionally, I've tried to remove sqlite3 altogether and repeat the above processes.
Any ideas on how to fix this?
I've ran into this issue some time ago: I contacted Heroku and they told me they have a locked version of Bundler, so your only option is to use the Bundler version they use:
gem uninstall bundler
gem install bundler -v 2.0.2
bundle update

"Unexpected token: name (closeBootstrapDatepicker)" during a rails deployment

When deploying a rails 5 application, I get this error:
remote: Bundle completed (3.85s)
remote: Cleaning up the bundler cache.
remote: Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.2). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
remote: The latest bundler is 1.16.3, but you are currently running 1.15.2.
remote: To update, run `gem install bundler`
remote: -----> Installing node-v8.10.0-linux-x64
remote: -----> Installing yarn-v1.5.1
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: yarn install v1.5.1
remote: [1/4] Resolving packages...
remote: [2/4] Fetching packages...
remote: info fsevents#1.2.0: The platform "linux" is incompatible with this module.
remote: info "fsevents#1.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
remote: [3/4] Linking dependencies...
remote: warning "#rails/webpacker > postcss-cssnext#3.1.0" has unmet peer dependency "caniuse-lite#^1.0.30000697".
remote: warning " > webpack-dev-server#2.11.2" has unmet peer dependency "webpack#^2.2.0 || ^3.0.0".
remote: warning "webpack-dev-server > webpack-dev-middleware#1.12.2" has unmet peer dependency "webpack#^1.0.0 || ^2.0.0 || ^3.0.0".
remote: [4/4] Building fresh packages...
remote: Done in 24.80s.
remote: I, [2018-07-31T05:34:58.372842 #459] INFO -- : Writing /tmp/build_e0b626d68337f6bf487c3718057509da/public/assets/placeholder-d28a0c1aa165374509a6d251adb89aa4c9f688dd2da914d199252b60f278a3fd.png
remote: rake aborted!
remote: Uglifier::Error: Unexpected token: name (closeBootstrapDatepicker). To use ES6 syntax, harmony mode must be enabled with Uglifier.new(:harmony => true).
remote: /tmp/build_e0b626d68337f6bf487c3718057509da/vendor/bundle/ruby/2.5.0/gems/uglifier-4.1.10/lib/uglifier.rb:234:in `parse_result'
r
My platform is heroku. How do I fix it?
This application used to deploy fine.

Deploying on Heroku, how to specify ruby version to use for bundler?

Something has changed recently on Heroku. I can't deploy my app as I've done before:
me#host my-project (master) $ git push staging master
Counting objects: 52, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (51/51), done.
Writing objects: 100% (52/52), 159.47 KiB | 0 bytes/s, done.
Total 52 (delta 42), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Deleting 4 files matching .slugignore patterns.
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.3.0
remote: -----> Installing dependencies using bundler 1.13.6
remote: Your app was upgraded to bundler 1.13.6.
remote: Previously you had a successful deploy with bundler 1.11.2.
remote:
remote: If you see problems related to the bundler version please refer to:
remote: https://devcenter.heroku.com/articles/bundler-version
remote: Ruby version change detected. Clearing bundler cache.
remote: Old: ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
remote: New: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: Your Ruby version is 2.3.0, but your Gemfile specified 2.2.0
remote: Bundler Output: Your Ruby version is 2.3.0, but your Gemfile specified 2.2.0
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to my-project-staging.
remote:
To https://git.heroku.com/my-project-staging.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/my-project-staging.git'
I don't get it, i'm using ruby 2.2.0 since the beginning:
me#host my-project (master) $ ruby -v
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
me#host my-project (master) $ cat .ruby-version
2.2.0
me#host my-project (master) $ cat Gemfile | grep 'ruby'
ruby '2.2.0'
I don't know how to tell bundler I'm still using ruby 2.2.0. My bundler have this in the bottom:
RUBY VERSION
ruby 2.3.0p0
BUNDLED WITH
1.12.1
Why bundler doesn't use the ruby 2.2.0 version? It's using 2.3.0 instead...
Check your Gemfile.lock. Recent versions of bundler add both the ruby version and bundler version that were used install the gems (and generate the Gemfile.lock).
At the bottom you'll find:
RUBY VERSION
ruby 2.3.0
BUNDLED WITH
1.13.1 # or whatever version of bundler you're using
Remove this, and re-run bundle install with the correct version of ruby - you may need to remove + re-add a gem to trigger a re-build of the Gemfile.lock file.
Finally I add to remove bundler and install the same version as Heroku.
Sometimes bundler doesn't generate in Gemfile.lock
RUBY VERSION
ruby 2.x.x
In that case, just add that entry manually inside the Gemfile.lock file commit and push it to master. Heroku will take that version and build.

"Internal error" when pushing to Heroku

Whenever I try to push this repo to Heroku, I get this absurdly unhelpful error:
Counting objects: 214, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (204/204), done.
Writing objects: 100% (214/214), 196.99 KiB | 306 KiB/s, done.
Total 214 (delta 98), reused 0 (delta 0)
-----> Removing .DS_Store files
-----> Ruby/Rack app detected
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.3.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
The source :rubygems is deprecated because HTTP requests are insecure.
Please change your source to 'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
Fetching gem metadata from http://rubygems.org/.........
Fetching gem metadata from http://rubygems.org/..
Fetching git://github.com/datamapper/dm-core.git
Fetching git://github.com/datamapper/dm-aggregates.git
Fetching git://github.com/datamapper/dm-do-adapter
Fetching git://github.com/datamapper/dm-migrations.git
Fetching git://github.com/datamapper/dm-postgres-adapter.git
Fetching git://github.com/datamapper/dm-serializer.git
Fetching git://github.com/datamapper/dm-timestamps.git
Fetching git://github.com/datamapper/dm-transactions.git
Fetching git://github.com/datamapper/dm-types.git
Fetching git://github.com/datamapper/dm-validations.git
Installing addressable (2.2.8)
Installing backports (3.3.3)
Installing bcrypt-ruby (3.0.1)
Installing daemons (1.1.9)
Installing data_objects (0.10.13)
Installing descendants_tracker (0.0.1)
Installing virtus (0.5.5)
Using dm-core (1.3.0.beta) from git://github.com/datamapper/dm-core.git (at master)
Using dm-aggregates (1.3.0.beta) from git://github.com/datamapper/dm-aggregates.git (at master)
Using dm-do-adapter (1.3.0.beta) from git://github.com/datamapper/dm-do-adapter (at master)
Using dm-migrations (1.3.0.beta) from git://github.com/datamapper/dm-migrations.git (at master)
Installing do_postgres (0.10.13)
Using dm-postgres-adapter (1.3.0.beta) from git://github.com/datamapper/dm-postgres-adapter.git (at master)
Installing fastercsv (1.5.5)
Installing multi_json (1.3.7)
Using dm-serializer (1.3.0.beta) from git://github.com/datamapper/dm-serializer.git (at master)
Using dm-timestamps (1.3.0.beta) from git://github.com/datamapper/dm-timestamps.git (at master)
Using dm-transactions (1.3.0.beta) from git://github.com/datamapper/dm-transactions.git (at master)
Installing stringex (1.5.1)
Installing uuidtools (2.1.4)
Using dm-types (1.3.0.beta) from git://github.com/datamapper/dm-types.git (at master)
Using dm-validations (1.3.0.beta) from git://github.com/datamapper/dm-validations.git (at master)
Installing eventmachine (1.0.3)
Installing pg (0.16.0)
Installing rack (1.5.2)
Installing rack-protection (1.5.0)
Installing tilt (1.4.1)
Installing sinatra (1.4.3)
Installing thin (1.5.1)
Using bundler (1.3.2)
Your bundle is complete! It was installed into ./vendor/bundle
Cleaning up the bundler cache.
The source :rubygems is deprecated because HTTP requests are insecure.
Please change your source to 'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
-----> WARNINGS:
You have not declared a Ruby version in your Gemfile.
To set your Ruby version add this line to your Gemfile:
ruby '2.0.0'
# See https://devcenter.heroku.com/articles/ruby-versions for more information."
-----> Discovering process types
Procfile declares types -> web
Default types for Ruby/Rack -> console, rake
-----> Compiled slug size: 44.4MB
-----> Launching...
! Push rejected, Internal error, please try again
To git#heroku.com:[...].git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:[...].git'
I've tried deleting and recreating the app, deleting and recreating the Gemfile lock, adding a Procfile, and declaring Ruby version '1.9.3' (which I use locally). The app runs without complaint locally. What could be wrong?
Pushed the exact same code without modification to Heroku successfully an hour or so later.
This was probably a service problem with Heroku.

Bundle Install works - but git push heroku master gives errors

Bundle install worked. But when I git push heroku master, I got this:
C:\Sites\first_app>git push heroku master
Warning: Permanently added the RSA host key for IP address '50.19.85.132' t
list of known hosts.
Counting objects: 65, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (51/51), done.
Writing objects: 100% (65/65), 26.10 KiB, done.
Total 65 (delta 3), reused 0 (delta 0)
-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.1.2
Running: bundle install --without development:test --path vendor/bun
-binstubs bin/
Fetching gem metadata from https://rubygems.org/.........
Bundler could not find compatible versions for gem "railties":
In Gemfile:
rails (= 3.2.1) ruby depends on
railties (= 3.2.1) ruby
jquery-rails (= 2.0.0) ruby depends on
railties (3.2.3)
Failed to install gems via Bundler.
Heroku push rejected, failed to compile Ruby/rails app
To git#heroku.com:evening-frost-9408.git
[remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:evening-frost-9408.git'
Here is my Gem file:
source 'https://rubygems.org'
gem 'rails', '3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :development do
gem 'sqlite3', '1.3.5'
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'
gem 'uglifier', '1.2.3'
end
gem 'jquery-rails', '2.0.0'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
I'm basically following Ruby on Rails tutorial. But the rails I have is 3.2.1, but the online book says rails 3.2.3. I tried changing it to 3.2.3 and ~>3.2.3, I still get the same error message
Thanks
I had the same problem, I could not run 'bundle install' and same problem when trying to deploy on heroku (and I'm following the same tutorial).
Found a good answer here: rubygems.org does not serve HTTPS, so change the header of your gemfile from https://rubygems.org to http://rubygems.org.
I had a similar problem and figured I'd add my solution.
Originally my main project was seperated into gems that were included into the main project. As the coupling between the gems and the project increased, it made sense to bring the code for the gems directly into /lib of the main rails project. During the merge, the .gitignore files were merged without any conflicts. Unfortunately, a .gitignore for a gem is very different than for a standalone project. As I proceeded, when I updated a gem locally it would fail on the remote push deploy to Heroku. It turns out the .gitignore from the gem had things like Gemfile.lock and *.gem in it.
TLDR; make sure your .gitignore file is sane

Resources