- π About the Project
- π Arch Map
- π Built With
- π Live OpenAPI Docs
- π» Getting Started
- π€ Contributing
- βοΈ Show your support
- π Acknowledgements
- βFAQ
- π License
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.
Framework
Language
Testing Libraries
Data Store
Request Library
Scheduling
Validation
Environment Configuration
Containerization
API Documentation
- Supports Opt-in DSNP/Frequency Migration
- Updates Newly Migrated User Graph
- Updates Graphs of Connections
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:ProjectLibertyLabs/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.
- Copy the template values into the .env files.
cp env.template .env cp env.template .env.docker.dev
- Replace template values with values appropriate to your environment.
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:
1. Start the Redis server container and the Frequency container. You can view the logs with your Docker setup.
docker compose up -d redis frequency
2. Once Frequency is up, run the chain setup. This will setup 7000 MSAs on the chain with Graph.
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
5. Check the job in BullUI, to monitor job progress based on defined tests.
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: to stop containers, networks, volumes, and images created by
docker compose up
run...docker compose down
- You may have to go to your Docker Desktop app and manually remove containers.
-
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?
- Only if you have non-DSNP/Frequency users with existing graph connections that should be recreated on migration.
-
Does it need to run all the time?
- No. If the connected node is an archive node, then it can replay the blocks as needed.
-
What if something else already updated the graph?
- The Reconnection Service will check and only add the needed connections. If all the connections already exist, then the service will do nothing on chain and continue.
This project is Apache 2.0 licensed.