Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Latest commit

 

History

History
50 lines (34 loc) · 3.06 KB

INSTALLATION.md

File metadata and controls

50 lines (34 loc) · 3.06 KB

Installation

Hivemind Codebase

  1. Clone this repository.
  2. yarn install.
  3. Copy the contents of .env.local.example into a new file called .env.local.

Database

Important

If you're setting up your database on your localhost or on a machine on your local network, you must ensure there is a secure tunnel established into your DB server:port in order for the Firebase cloud functions (to be setup later) are able to access the DB. See the ngrok project for a way to achieve this.

Alternatively, you can install the DB on a publicly visible machine such as a cloud server. Either way, you must either configure your firewall rules or set up a secure tunnel in order to allow FB cloud functions (and your dev server) to directly access the database.

Installation

  1. Install ArangoDB and the RecallGraph extension by following the instructions here.
  2. Fill in the database access point, credentials and the RecallGraph service mount point in the .env.local file at the root of this project.

Database Scaffold

Run the scripts in the db-setup folder using the command below. These are idempotent scripts and is safe to execute them multiple times. In case of a partial or incomplete setup from a prior run, these scripts will pick up where they left the last time. It effectively behaves like a sync operation.

node db-setup

Configure Firebase

  1. Create a project at the Firebase console.
  2. Get your account credentials from the Firebase console at Project settings > Service accounts, where you can click on Generate new private key and download the credentials as a json file. It will contain keys such as project_id, client_email and client_id. Set them as environment variables in the .env.local file at the root of this project.
  3. Go to Develop, click on Authentication and in the Sign-in method tab enable authentication for the app.
  4. In the .firebaserc file at the root of this project, update the project ID for the default key.

Uploading Firebase Cloud Functions

  1. Install the Firebase CLI tool: npm install -g firebase-tools
  2. firebase login.
  3. Configure environment variables for cloud functions:
    1. firebase functions:config:set arango.host=<db host> # Make sure this host is publicly accessible.
    2. firebase functions:config:set arango.port=<db port> # Make sure this port is publicly open.
    3. firebase functions:config:set arango.db=<db name>
    4. firebase functions:config:set arango.user=<db user>
    5. firebase functions:config:set arango.password=<db password>
    6. firebase functions:config:set arango.svc.mount=<recallgraph mount point>
  4. Inside the functions directory at the root of the project: npm install. Note that this needs a specific version of node to run. Use nvm to manage multiple node versions on your system.
  5. Deploy cloud functions: firebase deploy --only functions

Your installation is now complete!