Skip to content

Instantly share code, notes, and snippets.

@rodcul
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rodcul/af219bc3b1a1e7978bc7 to your computer and use it in GitHub Desktop.
Save rodcul/af219bc3b1a1e7978bc7 to your computer and use it in GitHub Desktop.
Bookmark Manager on Heroku

Heroku Toolbelt

https://toolbelt.heroku.com/

heroku login

Enter your heroku username and password

Terminal commands

Maker sure you've updated the following line to your app/data_mapper_setup.rb

DataMapper.setup(:default, ENV['DATABASE_URL'] || "postgres://localhost/bookmark_manager_#{env}")

https://github.com/makersacademy/bookmark_manager/pull/2/files

Also make sure your Rakefile contains the necessary task "auto_upgrade"

https://github.com/makersacademy/bookmark_manager/blob/master/Rakefile

rodcul at rodcul-mbp15 in ~/dev/makers-academy
$ git clone git@github.com:rodcul/bookmark-manager.git bookmark-manager-heroku
Cloning into 'bookmark-manager-heroku'...
remote: Counting objects: 168, done.
remote: Compressing objects: 100% (126/126), done.
remote: Total 168 (delta 71), reused 124 (delta 27), pack-reused 0
Receiving objects: 100% (168/168), 25.65 KiB | 0 bytes/s, done.
Resolving deltas: 100% (71/71), done.
Checking connectivity... done.

rodcul at rodcul-mbp15 in ~/dev/makers-academy
$ cd bookmark-manager-heroku/

rodcul at rodcul-mbp15 in ~/dev/makers-academy/bookmark-manager-heroku on master
$ heroku create
Creating fast-bayou-2116... done, stack is cedar-14
https://fast-bayou-2116.herokuapp.com/ | https://git.heroku.com/fast-bayou-2116.git
Git remote heroku added

rodcul at rodcul-mbp15 in ~/dev/makers-academy/bookmark-manager-heroku on master
$ heroku addons:create heroku-postgresql
Creating smiling-gently-5006... done
Adding smiling-gently-5006 to fast-bayou-2116... done
Setting DATABASE_URL and restarting fast-bayou-2116... done, v3
Database has been created and is available
 ! This database is empty. If upgrading, you can transfer
 ! data from another database with pgbackups:restore
Use `heroku addons:docs heroku-postgresql` to view documentation.

rodcul at rodcul-mbp15 in ~/dev/makers-academy/bookmark-manager-heroku on master
$ git push heroku master
Counting objects: 168, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (82/82), done.
Writing objects: 100% (168/168), 25.65 KiB | 0 bytes/s, done.
Total 168 (delta 71), reused 168 (delta 71)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rack
remote: -----> Using Ruby version: ruby-2.0.0
remote: -----> Installing dependencies using 1.9.7
remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote:        Fetching gem metadata from https://rubygems.org/.........
remote:        Fetching version metadata from https://rubygems.org/..
remote:        Rubygems 2.0.14 is not threadsafe, so your gems must be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem installation.
remote:        Installing addressable 2.3.8
remote:        Installing bcrypt 3.1.10
remote:        Installing bcrypt-ruby 3.1.5
remote:        Installing dm-core 1.2.1
remote:        Installing dm-aggregates 1.2.0
remote:        Installing dm-constraints 1.2.0
remote:        Installing dm-migrations 1.2.0
remote:        Installing fastercsv 1.5.5
remote:        Installing json 1.8.2
remote:        Installing json_pure 1.8.2
remote:        Installing multi_json 1.11.0
remote:        Installing dm-serializer 1.2.2
remote:        Installing dm-timestamps 1.2.0
remote:        Installing dm-transactions 1.2.0
remote:        Installing stringex 1.5.1
remote:        Installing uuidtools 2.1.5
remote:        Installing dm-types 1.2.2
remote:        Installing dm-validations 1.2.0
remote:        Installing data_mapper 1.2.0
remote:        Installing data_objects 0.10.16
remote:        Installing dm-do-adapter 1.2.0
remote:        Installing do_postgres 0.10.16
remote:        Installing dm-postgres-adapter 1.2.0
remote:        Installing rack 1.6.1
remote:        Installing rack-flash3 1.0.5
remote:        Installing rack-protection 1.5.3
remote:        Installing tilt 2.0.1
remote:        Installing sinatra 1.4.6
remote:        Installing sinatra-partial 0.4.0
remote:        Using bundler 1.9.7
remote:        Bundle complete! 10 Gemfile dependencies, 30 gems now installed.
remote:        Gems in the groups development and test were not installed.
remote:        Bundled gems are installed into ./vendor/bundle.
remote:        Post-install message from bcrypt-ruby:
remote:        #######################################################
remote:        The bcrypt-ruby gem has changed its name to just bcrypt.  Instead of
remote:        installing `bcrypt-ruby`, you should install `bcrypt`.  Please update your
remote:        dependencies accordingly.
remote:        #######################################################
remote:        Bundle completed (30.03s)
remote:        Cleaning up the bundler cache.
remote:        Could not detect rake tasks
remote:        ensure you can run `$ bundle exec rake -P` against your app with no environment variables present
remote:        and using the production group of your Gemfile.
remote:        rake aborted!
remote:        cannot load such file -- rspec/core/rake_task
remote:        /tmp/build_74b92593101f42a08c7be37b431e1e9e/vendor/ruby-2.0.0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
remote:        /tmp/build_74b92593101f42a08c7be37b431e1e9e/vendor/ruby-2.0.0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
remote:        /tmp/build_74b92593101f42a08c7be37b431e1e9e/Rakefile:1:in `<top (required)>'
remote:        /tmp/build_74b92593101f42a08c7be37b431e1e9e/vendor/ruby-2.0.0/lib/ruby/2.0.0/rake/rake_module.rb:25:in `load'
remote:        /tmp/build_74b92593101f42a08c7be37b431e1e9e/vendor/ruby-2.0.0/lib/ruby/2.0.0/rake/rake_module.rb:25:in `load_rakefile'
remote:        /tmp/build_74b92593101f42a08c7be37b431e1e9e/vendor/ruby-2.0.0/lib/ruby/2.0.0/rake/application.rb:604:in `raw_load_rakefile'
remote:        /tmp/build_74b92593101f42a08c7be37b431e1e9e/vendor/ruby-2.0.0/lib/ruby/2.0.0/rake/application.rb:89:in `block in load_rakefile'
remote:        /tmp/build_74b92593101f42a08c7be37b431e1e9e/vendor/ruby-2.0.0/lib/ruby/2.0.0/rake/application.rb:160:in `standard_exception_handling'
remote:        /tmp/build_74b92593101f42a08c7be37b431e1e9e/vendor/ruby-2.0.0/lib/ruby/2.0.0/rake/application.rb:88:in `load_rakefile'
remote:        /tmp/build_74b92593101f42a08c7be37b431e1e9e/vendor/ruby-2.0.0/lib/ruby/2.0.0/rake/application.rb:72:in `block in run'
remote:        /tmp/build_74b92593101f42a08c7be37b431e1e9e/vendor/ruby-2.0.0/lib/ruby/2.0.0/rake/application.rb:160:in `standard_exception_handling'
remote:        /tmp/build_74b92593101f42a08c7be37b431e1e9e/vendor/ruby-2.0.0/lib/ruby/2.0.0/rake/application.rb:70:in `run'
remote:        vendor/ruby-2.0.0/bin/rake:41:in `<main>'
remote:
remote: ###### WARNING:
remote:        You have not declared a Ruby version in your Gemfile.
remote:        To set your Ruby version add this line to your Gemfile:
remote:        ruby '2.0.0'
remote:        # See https://devcenter.heroku.com/articles/ruby-versions for more information.
remote:
remote: ###### WARNING:
remote:        No Procfile detected, using the default web server (webrick)
remote:        https://devcenter.heroku.com/articles/ruby-default-web-server
remote:
remote: -----> Discovering process types
remote:        Procfile declares types -> (none)
remote:        Default types for Ruby  -> console, rake, web
remote:
remote: -----> Compressing... done, 17.4MB
remote: -----> Launching... done, v5
remote:        https://fast-bayou-2116.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/fast-bayou-2116.git
 * [new branch]      master -> master


rodcul at rodcul-mbp15 in ~/dev/makers-academy/bookmark-manager-heroku on master
$ heroku open
Opening fast-bayou-2116... done

To keep an eye on what heroku is doing:

$ heroku logs -t

Also useful is to install a GUI for PSQL - http://www.psequel.com/

rodcul at rodcul-mbp15 in ~/dev/makers-academy/bookmark-manager-heroku on master

$ heroku config
=== fast-bayou-2116 Config Vars
DATABASE_URL: postgres://qfzthulclmdnaf:Mu_5umZlgyIYFMs50QNoh-41TI@ec2-174-129-26-115.compute-1.amazonaws.com:5432/ddq56henn9j2qr
LANG:         en_US.UTF-8
RACK_ENV:     production

copy the "DATABASE_URL" into the connection url (minus the postgres://), connect!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment