Heroku setup demo

Overview

heroku-demo


A basic guide to setting up a project hosted on Heroku with a PostgreSQL database using Giovanna Aveiro's and OliverJam's tutorial for Founders & Coders Bootcamp, FAC22 cohort during Authentication week.

animated

Table of contents

Setup project

(Back to top)

  • Initialise git hub repo, with README & gitignore file (using node template)
  • Clone repo and open in VSCode
  • Install package.json, dependencies and devDependencies (express, pg, dotenv, bcryptjs, cookie-parser, nodemon, cypress)
  • Add automated server and cypress scripts to package.json.
  • Update gitignore file with .DS_Store file
  • Add Procfile in root directory of app to explicitly declare what command should be executed to start your app.
    • web: npm start
  • Add project files
    • server.js
    • layout.js
    • auth.js*
    • example.env*
    • public* (styles.css)
    • routes* (homes.js, logIn.js, logOut.js, posts.js, signUp.js)
    • database* (connection.js, init.sql, model.js)
    • scripts* (create_db, populate_db)
  • These files can be created after the app is deployed on Heroku, otherwise you will run into errors such as Error: Please set the DATABASE_URL environment variable (/app/database/connection.js:9:9).

Setup local postgres database

Use Oliverjam's Express Postgres Example tutorial

a) Copy and paste code from create_db & populate_db files into your project

(i) Amend file path of init.sql file in populate_db file L17 to

./database/init.sql

(ii) Do NOT change any code in create_db file

b) In the terminal run the following commands to allow permissions on each file to make them executable:

chmod +x ./scripts/create_db
chmod +x ./scripts/populate_db

c) In terminal run script commands (Note add the name of your db . This will dynamically input this name into all of the locations

./scripts/create_db <here>

(ii) Once you have a designed your database (init.sql), run the following command to populate your local db;

  ./scripts/populate_db

Setup Heroku CLI

(Back to top) I followed Heroku Dev Center's guide.

  • Check to see if you have heroku installed on your terminal
    heroku --version
  • Install heroku
    npm install -g heroku
  • Log in to heroku CLI
      heroku login

You’ll be prompted to enter any key to go to your web browser to complete login. The CLI will then log you in automatically.

Deploy your project on Heroku

(Back to top)

  • Sign up/log in to Heroku.

Create app

  • Top right of dashboard screen click New>Create new app> Add app name > Europe(if in uk)>Create app

There are two ways you can deploy your app; via Herouku CLI or GitHub in the Deploy section.

Connect to github

  • Under Deployment method click GitHub and under Connect to Github search and select your project repo
  • Next section Automatic deploys click Enable Automatic Deploys
    • This will automatic rebuild and deploy your app on Heroku with every push to main branch of your repository.
  • For the first deployment you need to deploy manually.
    • Under Manual deploy click Deploy Branch
    • You will be able to see the build log
  • Once app has successfully deployed you will see a View button which will open your app in another tab!

Screenshot 2021-10-13 at 17 21 55

Heroku Git using Heroku CLI

To use this method you must have installed Heroku CLI and follow these step. Screenshot 2021-10-13 at 17 20 10

Deploy your PostgreSQL database on Heroku

(Back to top)

Add Postgres database

Under Resources section under Add-ons search Heroku Postgres > Hobby Dev - Free > Provision Now you should see a tab under the Add-onssearch bar labelled Heroku Postgres

Connect to the database

Under Setting section > Config Vars section > Revel Config Vars > copy DATABASE_URL string. Note here is where you can also add API keys, tokens(cookie secrets) and environment variables & . Insert PGSSLMODE='no-verify' where PGSSLMODE is KEY and no-verify is VALUE. In the terminal connect your database(init.sql) to your production(Heroku) postgres database:

  • psql DATABASE_URL_FROM_HEROKU`
  • \i database/init.sql
  • You now have access/can query data from your heroku production database from your terminal.

View Postgres database

Under Resources section you should see a tab under the Add-onssearch bar labelled Heroku Postgres

Screenshot 2021-10-13 at 17 32 22

If you click on it you another tab will open showing data about your database (below is an example).

Screenshot 2021-10-13 at 17 35 11

Setup Team on Heroku

(Back to top)

There are two ways:

  • Access tab
  • Overview tab > under Collaborator activity click on Manage Access

Add collaborator > insert email > Save changes > ask team mate to check email > Accept Invitation Team mate now has access to Heroku app and add-ons.

Delete collaborator

Under Access tab click on the pen emoji next to the collaborator you wish to remove. Click Delete collaborator > Confirm

Debugging in Heroku

(Back to top)

In the terminal

Run command

  heroku logs --app=your-app-name --tail

In Heroku

Top right hand corner > More > View logs Here you can view your build logs especially handy when debugging!

Delete App

(Back to top)

Settings tab > bottom of page Delete App > Enter your app's name > Delete app

Resources

(Back to top)

Comments
  • Bump minimist from 1.2.5 to 1.2.6

    Bump minimist from 1.2.5 to 1.2.6

    Bumps minimist from 1.2.5 to 1.2.6.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump express from 4.17.1 to 4.17.3

    Bump express from 4.17.1 to 4.17.3

    Bumps express from 4.17.1 to 4.17.3.

    Release notes

    Sourced from express's releases.

    4.17.3

    4.17.2

    Changelog

    Sourced from express's changelog.

    4.17.3 / 2022-02-16

    4.17.2 / 2021-12-16

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump qs from 6.5.2 to 6.5.3

    Bump qs from 6.5.2 to 6.5.3

    Bumps qs from 6.5.2 to 6.5.3.

    Changelog

    Sourced from qs's changelog.

    6.5.3

    • [Fix] parse: ignore __proto__ keys (#428)
    • [Fix] utils.merge: avoid a crash with a null target and a truthy non-array source
    • [Fix] correctly parse nested arrays
    • [Fix] stringify: fix a crash with strictNullHandling and a custom filter/serializeDate (#279)
    • [Fix] utils: merge: fix crash when source is a truthy primitive & no options are provided
    • [Fix] when parseArrays is false, properly handle keys ending in []
    • [Fix] fix for an impossible situation: when the formatter is called with a non-string value
    • [Fix] utils.merge: avoid a crash with a null target and an array source
    • [Refactor] utils: reduce observable [[Get]]s
    • [Refactor] use cached Array.isArray
    • [Refactor] stringify: Avoid arr = arr.concat(...), push to the existing instance (#269)
    • [Refactor] parse: only need to reassign the var once
    • [Robustness] stringify: avoid relying on a global undefined (#427)
    • [readme] remove travis badge; add github actions/codecov badges; update URLs
    • [Docs] Clean up license text so it’s properly detected as BSD-3-Clause
    • [Docs] Clarify the need for "arrayLimit" option
    • [meta] fix README.md (#399)
    • [meta] add FUNDING.yml
    • [actions] backport actions from main
    • [Tests] always use String(x) over x.toString()
    • [Tests] remove nonexistent tape option
    • [Dev Deps] backport from main
    Commits
    • 298bfa5 v6.5.3
    • ed0f5dc [Fix] parse: ignore __proto__ keys (#428)
    • 691e739 [Robustness] stringify: avoid relying on a global undefined (#427)
    • 1072d57 [readme] remove travis badge; add github actions/codecov badges; update URLs
    • 12ac1c4 [meta] fix README.md (#399)
    • 0338716 [actions] backport actions from main
    • 5639c20 Clean up license text so it’s properly detected as BSD-3-Clause
    • 51b8a0b add FUNDING.yml
    • 45f6759 [Fix] fix for an impossible situation: when the formatter is called with a no...
    • f814a7f [Dev Deps] backport from main
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump minimatch from 3.0.4 to 3.1.2

    Bump minimatch from 3.0.4 to 3.1.2

    Bumps minimatch from 3.0.4 to 3.1.2.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump async from 3.2.1 to 3.2.4

    Bump async from 3.2.1 to 3.2.4

    Bumps async from 3.2.1 to 3.2.4.

    Changelog

    Sourced from async's changelog.

    v3.2.4

    • Fix a bug in priorityQueue where it didn't wait for the result. (#1725)
    • Fix a bug where unshiftAsync was included in priorityQueue. (#1790)

    v3.2.3

    • Fix bugs in comment parsing in autoInject. (#1767, #1780)

    v3.2.2

    • Fix potential prototype pollution exploit
    Commits
    Maintainer changes

    This version was pushed to npm by hargasinski, a new releaser for async since your current version.


    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
Owner
Safia
Hey, I'm Safia, a self-taught Full Stack JavaScript Web Developer. Graduated @foundersandcoders bootcamp @fac21. Currently working on a @tech-for-better project
Safia
This is a powerful ModMail bot for Discord. You can host it on Replit or Heroku.

DavidNordicInternational ModMail This is a professional ModMail bot. This bot is very powerful and can be hosted locally or on heroku, Replit.com Requ

David Sundberg 1 Dec 21, 2021
Base Bot WhatsApp With Baileys Multi Device, Working Heroku No Suspend ☑️, Working Okteto No Suspend ☑️

Base Bot WhatsApp Multi Device With Baileys Multi Device Note Base Ini Free Untuk Semua, Tidak Untuk Diperjualbelikan Kecuali Lu Udah Tambahin Fitur L

Nazril Afandi 36 Dec 25, 2022
A Node JS Express/Serverless demo application that creates a slideshow video using the Pexels image library and Shotstack video editing API.

Shotstack Pexels Slideshow Video Demo This project demonstrates how to use the Shotstack cloud video editing API to create a video using an HTML form

Shotstack 25 Dec 9, 2022
An attempt to create the simplest demo to describe a Consumer-Driven Contract Testing workflow with Pact

Let's Play with Pact Abstract This is an attempt to create the simplest demo to describe a Consumer-Driven Contract Testing workflow with Pact. Prereq

Patrice Krakow 4 Feb 22, 2022
Demo project to deploy front- and backend together on heroku.

spring-boot-react-bundle This is a demo project that shows how it is possible to deploy a react frontend and a Spring Boot backend into a heroku dyno.

André Schreck 5 Jul 22, 2022
Node.js Open CLI Framework. Built with 💜 by Heroku.

oclif: Node.JS Open CLI Framework ?? Description ?? Getting Started Tutorial ✨ Features ?? Requirements ?? CLI Types ?? Usage ?? Examples ?? Commands

oclif 8k Jan 4, 2023
Deploy the latest ghost v4 on Heroku

Ghost 4.X on Heroku Ghost is world's most popular modern publishing platform for creating a new media platform. It has been used by Apple, SkyNews, Bu

Lovekesh Kumar 105 Dec 15, 2022
Tonton video tutorial di YouTube saya untuk cara penginstalan & apabila kurang mengerti bisa hubungi saya di WhatsApp 🐣Klik link di bawah untuk tutorial penginstalan di heroku

BOTZ10 LAST Termux • Heroku • Session Setting • Thanks TERMUX Git clone this repo > git clone https://github.com/zeeoneofc/BOTZ10a.git > cd BOTZ10a >

zeeone 17 Dec 23, 2021
This is a powerful ModMail bot for Discord. You can host it on Replit or Heroku.

DavidNordicInternational ModMail This is a professional ModMail bot. This bot is very powerful and can be hosted locally or on heroku, Replit.com Requ

David Sundberg 1 Dec 21, 2021
Deploying Fake Back-End Server & DataBase Using JSON-SERVER, GitHub, and Heroku

Deploying Fake Back-End Server & DataBase Using JSON-SERVER, GitHub, and Heroku. In this article, we will create and host a fake server that we can de

Israel David 0 Sep 5, 2022
24/7 Steam ingame time idler with Heroku (simple version)

simple-steam-idler-heroku 24/7 Steam ingame time idler with Heroku (simple version) Requirements: Install Git: https://git-scm.com/downloads Install H

Gunther 9 Dec 18, 2022
Nodejs,Expreess,Mongodb,Reactjs,Redux,Java app,Google,Docker,Heroku,...

Tiến độ công việc Team: https://docs.google.com/spreadsheets/d/1BBv4CXNniNjqdIE7tjrG9UM4nprd3NSVy2FX9oaWq0Q/edit#gid=0 Web Online: https://movienetfli

Nguyễn Tiến Tài 10 Sep 17, 2022
Base Bot WhatsApp With Baileys Multi Device, Working Heroku No Suspend ☑️, Working Okteto No Suspend ☑️

Base Bot WhatsApp Multi Device With Baileys Multi Device Note Base Ini Free Untuk Semua, Tidak Untuk Diperjualbelikan Kecuali Lu Udah Tambahin Fitur L

Nazril Afandi 36 Dec 25, 2022
Nftix-demo-ui - Demo UI used in my NFT course on Egghead.io

NFTix Demo UI This repository contains the UI used for my Egghead course on building a NFT ticketing system ?? ?? If you're watching the videos, use t

Ryan Harris 10 Dec 17, 2022
Light speed setup for MEVN(Mongo Express Vue Node) Apps

Light speed setup for MEVN stack based web-apps Chat: Telegram Donate: PayPal, Open Collective, Patreon A CLI tool for getting started with the MEVN s

madlabsinc 791 Dec 14, 2022
Light speed setup for MEVN(Mongo Express Vue Node) Apps

Light speed setup for MEVN stack based web-apps Chat: Telegram Donate: PayPal, Open Collective, Patreon A CLI tool for getting started with the MEVN s

madlabsinc 791 Dec 14, 2022
A Minimal Setup & Fast Boilerplate for React.js with Vite.

A Minimal Setup & Fast Boilerplate for React.js with Vite Features ?? Dynamic Pages Routing with react-router-dom from React.js ?? Fast development wi

Muhammad Fauzan 26 Oct 25, 2022
generate bare minimum node typescript setup asap

nd.ts ?? generate bare minimum node typescript setup asap npx nd.ts This CLI setups the node.ts starter with simple command. tell the project name ??

Ayush 27 Dec 24, 2022
Turborepo with Tailwind CSS setup for shared ui components.

Turborepo starter This is an official Yarn v1 starter turborepo. What's inside? This turborepo uses Yarn as a package manager. It includes the followi

George Carl 46 Jan 2, 2023
Setup-graalvm - GitHub Action for setting up GraalVM CE.

GitHub Action for GraalVM This GitHub action sets up GraalVM Community Edition and GraalVM components such as Native Image and GraalVM languages. Key

GraalVM 105 Jan 2, 2023