Skip to content

Latest commit

 

History

History
38 lines (34 loc) · 2.76 KB

README.md

File metadata and controls

38 lines (34 loc) · 2.76 KB

arora-api

Discord Continuous Integration Continuous Delivery

Prerequisites

Installation

  1. Create a Postgres user with permission to create databases.
  2. Create a new database as your just created Postgres user, named arora_api_<env> with <env> being your NODE_ENV environment variable. The project tries to connect to database arora_api_development on 127.0.0.1 (see ormconfig.js) if NODE_ENV is not set.
    To connect to a database on an external IP, use staging or production and set POSTGRES_HOST in .env containing the address of your external database server.
  3. Install the dependencies with yarn install or npm install.
  4. Copy .env.example to .env and update the fields to reflect your environment. POSTGRES_HOST and the last variables starting at SENTRY_DSN are optional, so if you don't set these, prepend them with a #.
  5. Generate an RSA key pair and add them as files named private.key and public.key respectively to the root of this project.
  6. Generate a JSON Web Token using the just generated RSA key pair. You can enter the public and private keys underneath "VERIFY SIGNATURE". What you enter underneath "PAYLOAD" doesn't matter since that's not being used in this project at the moment. Make sure to set the algorithm to RS256.
    Save this JWT somewhere as it's used for authenticating incoming requests.
  7. Configure the configurations in src/configs as desired. For example:
    • comment out configurations of cron jobs you don't want the server to run.
    • change 1018818 in the args arrays to your own group's ID to have the jobs run for your group instead.

Usage

  • If you're starting the project for the first time, or if a new database migration has been added (in src/migrations), you need to run typeorm migration:run before continuing to the next steps.
  • To compile the TypeScript source to .js files, run yarn build or npm run build.
  • To start the server, run yarn start or npm start.
  • The project is now accessible http://localhost:3000.