📝
marcyannotes
  • Welcome
  • Student Guidelines & Policies
    • Student Handbook
    • AI Policy
    • Academic Calendar
  • Environment Setup
    • Local Environment Setup - Mac
    • Local Environment Setup - Windows
    • GitHub Setup
    • Postgres Setup
  • Fullstack Software Engineering Curriculum
    • Overview
    • How-Tos
      • How To Code at Marcy: Code Style Guide
      • How to Do Short Response and Coding Assignments
      • How to Debug
      • How to PEDAC
      • How to Create Projects with Vite
      • How to Deploy on GitHub Pages
      • How to Deploy on Render
    • Mod 0 - Command Line Interfaces, Git, and GitHub
      • Mod 0 Overview
      • Command Line Interfaces
      • Git & GitHub
      • Git Pulling & Merging
      • Git Branching & PRs
      • Pair Programming: BONUS
    • Mod 1 - JavaScriptFundamentals
      • Mod 1 Overview
      • Intro to Programming
      • Errors
      • Node & Node Modules
      • Variables, Functions & String Methods
      • Control Flow, typeof, and Math
      • Loops
      • Arrays
      • Objects
      • Higher Order Functions: Callbacks
      • Higher Order Functions: Array Methods
      • Regex
    • Mod 2 - HTML, CSS & the DOM
      • Mod 2 Overview
      • HTML
      • CSS
      • Accessibility (a11y)
      • The DOM
      • Events
      • Forms
      • The Box Model and Positioning
      • Flexbox
      • Grid & Media Queries
      • ESModules
      • LocalStorage
    • Mod 3 - Async & APIs
      • Mod 3 Overview
      • Promises
      • Fetch
      • Building a Fetching App
      • Async & Await
    • Mod 4 - Project Week!
      • Project Week Overview
    • Mod 5 - Object-Oriented Programming
      • Mod 5 Overview
      • Intro to OOP, Encapsulation, Factory Functions, and Closure
      • Classes
      • Private & Static
      • Has Many/Belongs To
      • Polymorphism
    • Mod 6 - Data Structures & Algorithms
      • Mod 6 Overview
      • Stacks & Queues
      • Nodes & Linked Lists
      • Singly & Doubly Linked Lists
      • Recursion
      • Trees
    • Mod 7 - React
      • Mod 7 Overview
      • Intro to React
      • Events, State, and Forms
      • Fetching with useEffect
      • Building a Flashcards App
      • React Context
      • Global Context Pattern
      • React Router
    • Mod 8 - Backend
      • Mod 8 Overview
      • Intro to Express
      • Building a Static Web Server with Middleware
      • Securing API Keys with Environment Variables
      • Building a RESTful API with MVC
      • SQL and Databases
      • JOIN (Association) SQL Queries
      • Knex
      • Your First Fullstack App!
      • Migrations & Seeds
      • Schema Design & Normalization
      • Hashing Passwords with Bcrypt
  • Code Challenge Curriculum
    • Unit 0
      • Lecture: Functions in JS
      • CC-00: Functions and Console Logs
      • CC-01: Conditionals
      • CC-02: Conditionals 2
    • Unit 1
      • CC-03: For Loops
      • CC-04: For Loops and Conditionals
      • CC-05: For Loops and Conditionals 2
    • Unit 2
      • CC-06: String Mutations
      • CC-07: Array Iteration
      • CC-08: String Mutation and Array Iteration
      • CC-09: Array Mutations
      • CC-10: Reading Objects
      • CC-11: Objects
      • CC-12: Objects
      • Unit 2 Diagnostic
    • Unit 3
      • Intro to PEDAC (and Algorithms)
      • validTime
      • fizzBuzz (array)
      • digitSumDifference
      • firstNotRepeating
      • compareEvenAndOddSum
      • countVowelConsonants
      • finalHP
      • canMakeTriangle
    • Unit 4
    • Unit 5
    • Unit 6
    • Unit 7
    • Unit 8
    • Sorting
Powered by GitBook
On this page
  • Overview
  • Render vs. Github Pages
  • Create An Account
  • Deploy A Simple No-Database App
  • Deploy A Fullstack Server With A Database
  • Future changes to your code
  1. Fullstack Software Engineering Curriculum
  2. How-Tos

How to Deploy on Render

PreviousHow to Deploy on GitHub PagesNextMod 0 - Command Line Interfaces, Git, and GitHub

Last updated 8 months ago

Table of Contents:

Overview

Render vs. Github Pages

  • Github Pages provides static site hosting.

    • This means that the server that Github Pages runs on your behalf can only send static files to the client (HTML, CSS, and JS files).

    • Github Pages static sites are not capable of receiving or sending messages via HTTP.

  • Render provides web service and database hosting (it can also host static sites).

    • This means that the server that Render runs on your behalf can send static assets, receive and send messages via HTTP, and interact with a database.

    • Render also can host your database giving you a one-stop-shop for running your fullstack application.

Create An Account

Start by creating an account using your GitHub account. This will let you easily deploy straight from a GitHub repository.

This will take you to your Dashboard where you can see existing deployments.

Deploy A Simple No-Database App

Follow these instructions to deploy an Express app that does NOT include a database. If your app includes a database, go to the next section.

  1. Make sure you are signed in using your GitHub account

  2. https://dashboard.render.com/ and click on New +

  3. Select Web Service

  4. Build and deploy from a Git repository

  5. Find and Connect your GitHub repository

  6. Find your repository and select Connect

  7. Fill out the information for your Server

  • Name - the name of your app (it will appear in the URL that render gives you. For example: app-name-here.onrender.com)

  • Region - select US East (Ohio)

  • Branch - main

  • Root Directory - server/ or wherever your index.js file lives. Use ./ if it is in the root of your repo.

  • Runtime - Node

  • Build Command - leave blank

  • Start Command - node index.js

  • Instance Type - select Free

  • Select Create Web Service

This should take you to your web service's dashboard where you can see the latest build information and the URL. In a few minutes your server will be up and running!

Any time that you want to make an update to your deployed server, just commit and push the change to your repo!

Deploy A Fullstack Server With A Database

  1. Make sure you have an account on https://render.com/ and that you sign in using Github

  2. Create a Postgres Server

    • https://dashboard.render.com/ and click on New +

    • Select PostgreSQL

    • Fill out information for your DB (leave all other fields blank)

      • Name - the name of your application

      • Region - select US East (Ohio)

      • Instance Type - select Free

    • Select Create Database

    • Keep the created database page open. You will need the Internal Database URL value from this page for step 4. This URL will look follow this pattern:

postgresql://user:password@host/dbname
  1. Deploy Your Express Server

  • https://dashboard.render.com/ and click on New +

  • Select Web Service

  • Connect your GitHub account (if not connected already)

  • Find your repository and select Connect

  • Fill out the information for your Server

    • Name - the name of your app (it will appear in the URL that render gives you. For example: app-name-here.onrender.com)

    • Region - select US East (Ohio) - the important thing is that it matches the PostgreSQL region

    • Branch - main

    • Root Directory - if you used the React Express Auth Template, leave this blank

    • Runtime - Node

    • Build Command - if you used the React Express Auth Template, use npm i && npm run migrate:rollback && npm run migrate && npm run seed

    • Start Command - if you used the React Express Auth Template, use npm start

    • Instance Type - select Free

  • Select Create Web Service (Note: The first build will fail because you need to set up environment variables)

  1. Set up environment variables

  • From the Web Service you just created, select Environment on the left side-menu

  • Under Secret Files, select Add Secret File

    • Filename - .env

    • Contents

      • Look at your local .env file and copy over the SESSION_SECRET variable and value.

      • Add a second variable called PG_CONNECTION_STRING. Its value should be the Internal Database URL value from step 2e above.

      • Add a third variable called NODE_ENV. Its value should be 'production'

      • Your file should look like this:

SESSION_SECRET='AS12FD42FKJ42FIE3WOIWEUR1283'
PG_CONNECTION_STRING='postgresql://user:password@host/dbname'
NODE_ENV='production'
  • Click Save Changes

Future changes to your code

If you followed these steps, your Render server will redeploy whenever the main branch is committed to. To update the deployed application, simply commit to main.

For frontend changes, make sure to run npm run build to update the public/ folder contents and push.

Overview
Render vs. Github Pages
Create An Account
Deploy A Simple No-Database App
Deploy A Fullstack Server With A Database
Future changes to your code
create an account using GitHub
alt text
alt text