Skip to content

Instantly share code, notes, and snippets.

@kattak
Last active January 17, 2017 05:22
Show Gist options
  • Save kattak/3c28043cf3254161395bc19cc627f270 to your computer and use it in GitHub Desktop.
Save kattak/3c28043cf3254161395bc19cc627f270 to your computer and use it in GitHub Desktop.
(in progress)
```bash
'rails new APPNAME --database=postgresql’
*heroku doesn’t use sqlite3, which is default in new rails apps
***SQLite just stores the database to a file in your db/ folder, which is why it's incompatible with Heroku.***
**Redo blog app using postgresql DB
**Then try deploying to heroku
How to deploy app to heroku
=======================
heroku login (to login)
Need to init a local git repo first
cd myapp
git init
git add .
git commit -m “my first commit”
Create heroku remote
heroku create
git remote -v (to verify - see desired output below)
git push heroku master
heroku run rake db:seed
heroku run rake db:migrate
heroku open
```
***Can only deploy from master***
**to push a branch other than master:
git push heroku yourbranch:master**
###Add a remote to an existing git repo
heroku git:remote -a falling-wind-1624
Git remote heroku added.
ERROR SITUATION
failed to push some refs?
Execute this:
$ rake assets:precompile
$ git add .
$ git commit -m "Add precompiled assets for Heroku"
$ git push heroku master
git remote -v
heroku https://git.heroku.com/falling-wind-1624.git (fetch)
heroku https://git.heroku.com/falling-wind-1624.git (push)
#get into pgsql console
heroku pg:psql
rails console
rails dbconsole (get into pgsql console)
ctrl + D (exit)
====How to fix heroku DB====
(Convert from sqlite3 to pgsql)
in development,
use gem ‘sqlite3’
in production,
use gem ‘pgsql’
bundler (to bundle update)
git add .
git commit
git push heroku master
heroku rake db:migrate
#How to store json file API keys (like from Google Cloud APIs)
Make a bucket: http://docs.aws.amazon.com/AmazonS3/latest/gsg/CreatingABucket.html
Heroku instructions for dealing with S3 account keys: https://devcenter.heroku.com/articles/config-vars
@derekmpham
Copy link

Here's another way to make a rails app named "food"

rails new food-recommendations -d postgresql -T

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