Giter VIP home page Giter VIP logo

pg_ex_02's Introduction

PostgreSQL Deployment

Step 1

  • Ensure Everything Works Locally

Step 2

  • Add 'pg' as dependency

yarn add pg

or

npm install pg

Step 3

  • configure knexfile file for production
  production: {
    client: "pg",
    connection: process.env.DATABASE_URL,
    migrations: { directory: "./data/migrations" },
    seeds: { directory: "./data/seeds" }
  }

Step 3.5 (if not done prior)

  • configure dbConfig file for production
require('dotenv').config();

const knex = require("knex");
const config = require("../knexfile.js");
const environment = process.env.DB_CONNECT || "development";

module.exports = knex(config[environment]);

Step 4

  • Make sure everything is pushed to master

Step 5

  • Create a new heroku app alt text alt text

Step 6

  • Connect to Github Repo alt text alt text

Step 7

  • Deploy and Enable Auto Deployment alt text alt text

Step 8

  • Ensure Deployment Was Successful

Step 9

  • Go To Resources Tab of Heroku App alt text

  • Under Add-ons find Heroku Postgres alt text alt text

  • choose free version and click provision alt text

Step 10

Configure ENV variables

  • Go to settings tab alt text

  • Click Reveal Config Vars alt text alt text

  • Set DB_CONNECT to production alt text

  • Set any other needed ENV variables

Step 11

  • Check routes to ensure connection to PG DB, SHOULD get an error

Step 12

  • run migrations on heroku via

    npx heroku run knex migrate:latest --app your_heroku_app_name

Step 12.5 (optional)

  • run seeds on heroku via

    npx heroku run knex seed:run --app your_heroku_app_name

Step 13

  • Check routes to ensure connection to PG DB, SHOULD NOT get an error

pg_ex_02's People

Contributors

luishrd avatar trip4077 avatar amc-ai avatar mixelpixel avatar karthikv avatar ryan-hamblin avatar

Stargazers

Jonathan Picazo avatar Sofia Levin avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.