Skip to content

Instantly share code, notes, and snippets.

@catm705
Last active March 24, 2021 04:02
Show Gist options
  • Save catm705/10171658 to your computer and use it in GitHub Desktop.
Save catm705/10171658 to your computer and use it in GitHub Desktop.
Setting up HEROKU (Cat-style) ^^
--- HEROKU STEPS to SET UP: ---
(Make sure you're all pushed/pulled on master before doing anything heroku)
1. git init
2. git add -A
3. git commit -m “blah, blah”
4. heroku create
5. To add heroku ENV keys/variables → (If there are any).
Example: (See below "For adding multiple ENV keys")
heroku config:add BTCE_SECRET=ABCDEF BTCE_KEY=123456
6. git push heroku master
7. Put in gemfile:
- rails 12factor gem
- declare a ruby version → ruby -v then put ruby “2.1.0” in gemfile
gem 'rails_12factor', group: :production
ruby "2.1.0"
bundle install
____________________________________________________________________
Adding to the Database (heroku includes rake db:create so just do below):
- heroku run rake db:migrate
____________________________________________________________________
append .erb to files that need assets - ONLY style.css.erb
____________________________________________________________________
--- TO GET ASSETS/IMAGES TO SHOW UP ------
In production.rb file -> Must reset these:
1.) config.serve_static_assets = true
config.assets.compile = true
2.) rake assets:precompile
(MUST DO THIS IF YOU WANT THE IMAGES TO LOAD UP!!!) !!!!
____________________________________________________________________
--- MISC ---
--> rake assets:clean (Reverse of precompile - it deletes things.)
git commit -m “precompiling in production”
Seeding the Database:
heroku run rake db:seed
DEBUGGING:
heroku logs
RENAMING APP ON HEROKU:
- You have to change the name in your .git/config file too - if you change the name in Heroku's Dashboard-Settings!
____________________________________________________________________
***** WHEN IN DOUBT - Push to Heroku AGAIN!! *****
____________________________________________________________________
--------- IF YOU HAVE TO RUN MIGRATIONS WHILE ON HEROKU ------------
____________________________________________________________________
you also have to restart heroku after migrating - you'd want to run
heroku run rake db:migrate
heroku restart
@ghostropic
Copy link

=^.^=

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