Skip to content

dru1208/finstagram-deployment-guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IMPORTANT

Please do not make any changes directly to your Github EVER. All the work asked of you below must be done form your Gitpod and/or Heroku

Deployment

  1. In the root (What is the root?) of your repository, create the two following files below if they don't already exist:
.gitpod.Dockerfile
.gitpod.yml

Open the above named files from the repo above and add their contents to your gitpod where you created or already had the files of the same name.

  1. Update your Gemfile to match the Gemfile in this repo (the files at the top of this guide)

  2. Update your gitpod config/database.rb file to match the github database.rb file in this repo (the files at the top of this guide)

  3. Copy bundle install into the terminal and run it (press Enter).

  4. Commit the changes, and push to the master branch of the repository by using the following commands in your terminal window. Copy and paste them each individually.

git add .
git commit -m "changes for deployment"
git push origin master

Note: if you receive an error after running git push origin master (access denied), go to the following url:

https://gitpod.io/access-control/

Select the check box "write public repos", press the update button, and re-run git push origin master in your terminal

  1. Now close your Gitpod tabs and access your Gitpod again by using the below url, but be sure to add your username from GitHub into the URL before you press ENTER

The URL/address that you paste into your browser window should match the following pattern: https://gitpod.io/#https://github.com/*[my_github_username_here]*/finstagram ***DELETE THE *[ and ]* when you add in your username

  1. Check that heroku has been properly installed by running the following command in your Gitpod terminal:
heroku --version
  1. Create a heroku account on heroku.com

  2. in the terminal of gitpod, run the following command and log in to heroku with your credentials

heroku login -i
  1. run the following command in the terminal to create the heroku project
heroku create
  1. Access the heroku dashboard with the following url: https://dashboard.heroku.com/apps

  2. Click on the newly created project, select the resources tab, and then under Add-ons, use the search bar to add Heroku Postgres with the free plan

  3. Click on heroku postgres to view the details, under settings tab, click on View Credentials in the row that is for Database Credentials. Copy the URI (should look something like postgres://[some string of text here])

  4. Inside the config/database.rb file, paste the copied URI into the database_url string (line 13)

  5. Run the following commands in your terminal

bundle install
git add .
git commit -m "updated database config"
git push origin master
  1. Push your app live with the following commands
git push heroku
heroku run bundle install
heroku run bundle exec rake db:migrate
  1. In the dashboard of heroku, you can find the link to your app with the button Open App (should be in the top right of the dashboard). After you open your application, you may realize that your posts are missing. This is because the database that we were working with previously was on our Gitpod workspace and now we're using a brand new database on Heroku, which is brand new and doesn't have any data yet.

  2. In order to populate your database with data, create a file in the db directory called seeds.rb ex. db/seeds.rb and fill it in with the values found in the seeds.rb file at the top of this page.

  3. Run the following commands in your terminal to populate your database:

git add .
git commit -m "created seeds file for db"
git push origin master
git push heroku
heroku run bundle exec rake db:seed

Updating the App

If you've made changes to your code, run the following commands in your terminal

git add .
git commit -m "made changes to app"
git push origin master
git push heroku

If you make changes to the database in your Gitpod in the future such as updating posts or adding posts, etc then you must run the following command to update Heroku's database.

heroku run rake db:migrate
  • Deleting all Users; go into tux on your gitpod and type the following command and it'll delete all users. FinstagramPost.where(user_id: 1).destroy_all

Resources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages