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
- 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.
-
Update your Gemfile to match the Gemfile in this repo (the files at the top of this guide)
-
Update your gitpod
config/database.rb
file to match the githubdatabase.rb
file in this repo (the files at the top of this guide) -
Copy
bundle install
into the terminal and run it (press Enter). -
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
- 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
- Check that heroku has been properly installed by running the following command in your Gitpod terminal:
heroku --version
-
Create a heroku account on heroku.com
-
in the terminal of gitpod, run the following command and log in to heroku with your credentials
heroku login -i
- run the following command in the terminal to create the heroku project
heroku create
-
Access the heroku dashboard with the following url:
https://dashboard.heroku.com/apps
-
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
-
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 likepostgres://[some string of text here]
) -
Inside the
config/database.rb
file, paste the copiedURI
into the database_url string (line 13) -
Run the following commands in your terminal
bundle install
git add .
git commit -m "updated database config"
git push origin master
- Push your app live with the following commands
git push heroku
heroku run bundle install
heroku run bundle exec rake db:migrate
-
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.
-
In order to populate your database with data, create a file in the
db directory
calledseeds.rb
ex. db/seeds.rb and fill it in with the values found in the seeds.rb file at the top of this page. -
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
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