In this document, we will describe a basic setup and installation of the platform. You can setup and try out the platform using a single machine and a smartphone.
You need to install and setup the following applications before setting up the backend server.
- Postgresql Server (version 12 or above) - Postgres drives our main database.
- Redis Server - Needed for bull library. We are working on removing this requirement
- Azure blobstore - You need to provide the account name and key as part of the configuration
- Google OpenID Client ID - This is needed for authenticating work providers and admins with the server.
- OTP Provider - If you need to send OTP for authentication. The codebase currently uses 2factor.in APIs.
We have converted the codebase into a monorepo to enable effective sharing of
modules between different server components. We currently use lerna
to manage
dependencies and compilation.
# > npm install
# > npx lerna bootstrap
This step must be run whenever there is an update to any of the package.json files.
# > npx lerna run compile
You can also use the following command to clean build.
# > npx lerna run build
Create a postgres database for the backend server. Copy the .sample.env
file
in the backend folder to .env
. Fill out all the fields in the .env
file.
# backend> node dist/scripts/ResetDB.js
This command resets the database and bootstraps authentication. Any one who wants to sign up on the platform (admin / work provider) needs an access code. This script sets up a admin record and spits out the access code for the admin to sign up.
# > sudo service redis-server start
# backend> node dist/Server.js
Copy the .sample.env
file to .env
and fill out the fields.
# frontend> npm start
Open the frontend server URL on a browser. Sign up using the admin access code
that you received from the backend ResetDB.js
script.
Click on the "Work Providers" tab and generate an access code for a work provider. This step is optional for the test setup as you can do all activities as an admin.
Click on the "Box" tab and generate an access code for a new box.
Copy the .sample.env
file to .env
and fill out the fields. If for the test
setup the box and the server are running on the same machine, then the box
database name should be different from the server database name.
Copy the .sample.box
file to another file (say .box
) and fill out the
details of the box.
# box> node dist/scripts/ResetDB.js
# box> node dist/scripts/RegisterBox.js .box
The argument to this script should be the filepath to the box-specific config file.
# box> node dist/Server.js
# box> node dist/cron/Cron.js
# box> node dist/scripts/GenerateWorkerCodes.js -h
This script will generate access codes for workers. The above command will list the command line argument to the script.
You can do this as a work provider or as an admin.
On the "Tasks" tab, click "Create Task". Choose the "Speech Data Collection" scenario. Choose "English" language. Fill out some test details for the name and description. Use the following information for the remaining fields and Submit Task.
Go to the task detail page of the newly created task. Under input files, you can
add a new input file for this task. You can use the sample task json file in the
samples
folder.
Go to "Task Assignment" and assign the newly created task to the box.
Number of Recordings: 10
Once the task is assigned to the box, the box will receive it the next time the sync cron job runs (the one started in Step 7 of the box setup).
Update the box server URL in <package>/networking/RetrofitFactory.kt
to the
address of your box. For local testing, it should just be the IP address (with
port number) of the your box.