Skip to content
This repository has been archived by the owner on Sep 20, 2022. It is now read-only.

Deploying OpenSchema Backend

Eduardo Chiang edited this page Sep 16, 2021 · 1 revision

Public Repository

The repository can be cloned to work locally using git with the following command:

git clone https://github.com/magma/openschema.git

The code can be found inside /openschema-backend.

Prerequisites

OpenSchema ETL runs using NodeJS.

You can use an IDE like Visual Studio Code.

Configure .env file

  1. Create a copy of the file named .env.template and rename it to .env.

  2. Fill the MONGODB_URI field. This should point towards the MongoDB instance you wish to use as your OpenSchema datalake.

    • MongoDB can be installed following the instructions on their website.

    Example:

    MONGODB_URI=mongodb://localhost:27017/openschema_datalake
    
  3. Fill the AUTH_USERNAME and AUTH_PASSWORD fields. These are credentials that will be used for HTTP Basic Auth.

    • You can generate your own values by running the following command: openssl rand -base64 96

    Example:

    AUTH_USERNAME = "ir8foanSHfN4NcgzB9NwrGHz+6tsEPPVMRnS4H06kuaqK0/OvylGGA+7BKMBfb3ypUlOle5KRwo5p3AL5DdhJOAe1VXtLGF2OB6IzRkrzJ9ZJ1iNrM0JY569UTUXvZmW"
    AUTH_PASSWORD = "R2e/Kql9eudixRPiYvpUckE8qr77tj0l4TOhoKxIqF21MfAxnnqBbYilfideM3fQ9yZsro3vgvSy8AQYJJF/t9nqqG2PIPDKr3+MBeCB+OpuQdUcPPp869HiabfskRYy"
    

Configure HTTPS certificate

  1. You can generate your own self-signed certificate by running the following command:

    openssl req -nodes -x509 -newkey rsa:2048 -keyout server.key -out server.crt -days 365

  2. Create a /keys folder and add server.crt and server.key to it.

Make sure you use the same server.crt (backend.crt) file when building openschema-android.

Prepare the NodeJS environment

  1. Install all the dependencies:

    npm install

  2. Run the application:

    node app.js