Reconnection Service provides a way for Providers who are migrating their userbase to DSNP/Frequency to easily handle the graph updates as users opt into the migration.
The service scans the Frequency chain for new delegations for the Provider. It then requests, via a Provider's API, the user's Graph keys and the Provider's graph and proceeds to update the migrated user's graph and the graph of previously migrated users connected to the newly migrated user.
The Reconnection Service has one main loop that watches the chain for new blocks. Those blocks are then processed to look for new delegations and completed jobs.
To get a local copy up and running, follow these steps.
In order to run this project you need:
Clone this repository to your desired folder:
Example commands:
git clone git@github.com:AmplicaLabs/account-service.git
cd account-service
Modify any environment variables in the .env
file as needed. For docker compose env .env.docker.dev
file is used. The complete set of environment variables is documented here, and a sample environment file is provided here.
cp env.template .env
cp env.template .env.docker.dev
Install NPM Dependencies:
npm install
Note: using docker compose file to start the services. This will start the services in development mode.
In order to run the reconnection-service
in development mode without containers, you can use the following commands:
docker compose up -d redis frequency
npm run chain-setup
Note: If you change the env's PROVIDER_ACCOUNT_SEED_PHRASE
, you will also need to update PROVIDER_ACCOUNT_SEED_PHRASE
in setup/testing/index.ts
.
docker compose up -d webhook
Option 1: In a new terminal window, start the reconnection-service
app. Logs will be displayed in the terminal for easy reference.
npm run start:api:debug
-- or --
Option 2: Run the following command to start the reconnection service container. This will start the reconnection service in development mode.
docker compose up -d reconnection-service
npm run test
This will run the matching *.spec.ts
files.
You may also view and manage the application's queue at http://localhost:3000/reconnection-service/queue.
npm run lint
npm run format
docker compose up
run...
docker compose down
Follow step 1 from the Development Environment section above to set up the redis and frequency containers.
Use the debug panel and start the Debug Api (NestJS via ts-node)
configuration, if you wish to debug the api.
Set breakpoints in the code and debug your code.
Monitor the service worker jobs in BullUI.
Any API functions that require an extrinsic to be submitted to the blockchain will be queued here. The queue will manage the amount of capacity
this service is allowed to use.
Reference the Frequency Docs for more information about extrinsics and capacity.
Note: Reference .vscode/launch.json
for more details on the debug configurations and apply the concepts to your preferred debugger.
Contributions, issues, and feature requests are welcome!
If you would like to explore contributing bug fixes or enhancements, issues with the label good-first-issue
can be a good place to start.
Do I need this?
Does it need to run all the time?
What if something else already updated the graph?
This project is Apache 2.0 licensed.