git clone [email protected]:near-daos/astro-api-gateway.git
- Checkout to dev branch:
git checkout development
- Install dependencies:
yarn
VPN connection is required to access Astro Indexer Database.
- Go to self-service portal: https://vpn.dev.astrodao.com
- Download and install AWS Client VPN for your platform.
- Download the VPN client configuration file.
- Open AWS Client VPN, go to
File > Manage Profiles > Add Profile
. Enter display name, provide configuration file and click Add Profile.
- Open AWS Client VPN, select the profile and click connect.
- Wait until VPN connection is established.
- Install Docker: https://docs.docker.com/get-docker/
- Install Docker Compose: https://docs.docker.com/compose/install/
- Open console in project root folder and run:
docker-compose -f docker-compose-dev.yml up
After first docker start postgres database is empty, to run database migration:
yarn migration:run
To run dynamodb migration:
DATABASE_MIGRATIONS_LIST=DynamoTableMigration yarn start-migrations
By default .env
contains environment variables needed for local development besides some secrets that need to be added locally.
To override or add some local env variables create .env.local
in the root folder.
List of variables that might change depending on your needs:
- NEAR environment variables (testnet by default):
NEAR_ENV=development
NEAR_CONTRACT_NAME=sputnikv2.testnet
NEAR_TOKEN_FACTORY_CONTRACT_NAME=tokenfactory.testnet
- Indexer database connection variables (public testnet indexer by default):
NEAR_INDEXER_DATABASE_HOST=35.184.214.98
NEAR_INDEXER_DATABASE_PORT=5432
NEAR_INDEXER_DATABASE_NAME=testnet_explorer
NEAR_INDEXER_DATABASE_USERNAME=public_readonly
NEAR_INDEXER_DATABASE_PASSWORD=nearprotocol
- DAO database connection variables (docker's postgres by default):
DATABASE_USERNAME=sputnik
DATABASE_PASSWORD=sputnik
DATABASE_NAME=sputnik-v2
DATABASE_HOST=localhost
DATABASE_PORT=5437
- DynamoDB connection variables (docker's amazon/dynamodb-local by default):
DYNAMODB_REGION=local
DYNAMODB_ENDPOINT=http://localhost:8000
DYNAMODB_TABLE_NAME=entities_dev
AWS_ACCESS_KEY_ID=223344
AWS_SECRET_ACCESS_KEY=wJalrXUtTHISI/DYNAMODB/bPxRfiCYEXAMPLEKEY
- Drafts database connection variables (docker's mongodb by default):
DRAFT_DATABASE_HOST=localhost
DRAFT_DATABASE_PORT=27021
DRAFT_DATABASE_USERNAME=draft
DRAFT_DATABASE_PASSWORD=draft
DRAFT_DATABASE_CERT_PATH=
- Notifi config:
NOTIFI_ENV=Development
NOTIFI_SID=
NOTIFI_SECRET=
Note: Do not edit .env
file as you can accidentally commit some secrets.
After all previous steps are finished, services are ready to start. You can run all/some services in parallel or a single service separately dependent or your needs.
Provides a list of API endpoints (http and socket) used on Astro DAO application.
- Run service in dev mode:
yarn start-api:dev
- Go to swagger: http://localhost:3000/docs
Synchronization historical data from DAO Contracts with the Database, updating FT and NFT tokens data, storing DAO statistics
- Run service in dev mode:
yarn start-aggregator:dev
Exposing all API endpoints used for managing draft proposal and comments on Astro UI.
- Add
PORT=3001
to.env.local
to avoid port conflict with DAO API service. - Run service in dev mode:
yarn start-draft:dev
- Go to swagger: http://localhost:3001/docs
Responsible for sending notifications using Notifi
- Run service in dev mode:
yarn start-notifier:dev
Responsible for synchronization real time data from DAO Contracts with the Database.
Service depends on Astro Lake Framework
- Launch Astro Lake Framework locally with
redis://@localhost:6379/4
. - Run service in dev mode:
yarn start-indexer-processor:dev