Git Product home page Git Product logo

nora-service's Introduction

nora-service

NORA (https://node-red-google-home.herokuapp.com) backend service deployed in Heroku.

Deployment instructions: (small guide on how to run nora-service on your own Heroku)

Needed:

HEROKU

  • Create a new Account and then a new app. From Overview, add new add-on "Heroku Postgres" To deploy, you can either use the heroku cli or connect your github account. (do not deploy anything yet)
  • Keep this browser tab open

FIREBASE

  • Create a new Firebase Project and name it accordingly.
  • Navigate to Project Overview - Project Settings - General and create a new web app.
  • Navigate to Project Overview - Project Settings - Service Accounts and generate new private key
  • Navigate to Develop - Authentication - Users - Set up sign-in method - Google - enable - check that Web SDK configuration is filled in.
  • Keep this browser tab open

Google Api Console

Google Actions

CONFIG HEROKU ENV VARS

In Heroku go to Settings - Config Vars and add

env vars

JWT_COOKIE = nora:auth
JWT_SECRET = downloaded service account json from firebase - private_key
OAUTH_ID = api console - credentials - oauth 2.0 client ids - web client - Client ID
OAUTH_SECRET = api console - credentials - oauth 2.0 client ids - web client - Client secret
PROJECT_ID = firebase - settings -general - your apps - project id
SERVICE_ACCOUNT_ISSUER =  downloaded service account json from firebase - client_email
SERVICE_ACCOUNT_KEY =  downloaded service account json from firebase - private_key (format it as multiline)
FIREBASE_APIKEY = firebase - settings -general - your apps
FIREBASE_AUTHDOMAIN = firebase - settings -general - your apps

USER.REPOSITORY.TS

Modify src/services/user.repository.ts

To create the Database Tables modify this lines:

(async function () {
    const service = new PostgressService();
    await service.query(`
        CREATE TABLE IF NOT EXISTS appuser (
            uid VARCHAR(30) CONSTRAINT pk PRIMARY KEY,
            linked boolean DEFAULT false
        )`
    );

    await service.query('ALTER TABLE appuser ADD COLUMN IF NOT EXISTS noderedversion integer DEFAULT 1');
	await service.query('ALTER TABLE appuser ADD COLUMN IF NOT EXISTS refreshtoken integer DEFAULT 1');
})().catch(err => {
    console.error(err);
}).then(() => {
    console.log('done');
});

PUSH

THAT'S IT, you are ready to deploy to Heroku! Build the app and the schema with npm run heroku-postbuild before deploying. To deploy follow the instructions from the Heroku website or if you linked your account in Heroku with Github just push to github.

README DISCLAIMER

The instructions might be incomplete. For issues with the instructions please create an issue and we'll take another look,

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.