*This guide is a work in progress in the feat/nico/cfs-in-backend branch

We are migrating all the coordinator functionalities from Google Cloud Functions to an independent API application built using NestJS (Typescript) and SQLite3. This new app is located in the /packages/api directory.

Deployment

Development (local)

To deploy the Coordinator API locally for testing purposes you need to follow these steps:

  1. Clone https://github.com/privacy-scaling-explorations/p0tion repository
  2. Move to packages/api
  3. Run yarn install (could be done globally in the root directory)
  4. Create an .env file (you can clone it with cp .env.default .env
  5. Setup the correct values
    1. ADMIN_ID is the Github username of the API admin
    2. JWT_SECRET a seed secret for the authentication JWTs
    3. JWT_EXPIRES_IN when the authentication JWTs expire
    4. DB_STORAGE_PATH where the database files will be stored
    5. DB_SYNCRONIZE if true, use the existing database files
    6. GITHUB_CLIENT_ID check Authentication Service
    7. GITHUB_SECRET check Authentication Service
    8. GITHUB_CALLBACK_URL use the API route (in local should be http://localhost:3000/auth/github/callback)
    9. GITHUB_ACCESS_TOKEN create a personal token (for rate limiting purposes)
    10. All AWS_* keys check Amazon Web Service (AWS) account (required to use AWS S3 Storage, Lambda, SNS and EC2).
  6. Run yarn run start:dev

Running some of the CLI commands

After you run the coordinator API application you will be able to interact with it using some of the CLI commands. For example to run a new ceremony:

  1. Authenticate: Run yarn run auth:github and follow the instructions
  2. Create ceremony: Run ****yarn run ceremony:create --template=configFile.json (use the template from https://github.com/privacy-scaling-explorations/DefinitelySetup/tree/main/ceremonies#template-in-details
  3. Open the ceremony: Wait until the API opens the ceremony at the specified time (by default it takes 10 minutes but you can change the parameters here /api/src/ceremonies/service/ceremonies.service.ts in the startCeremony and stopCeremony