This web application and back-end builds a Stacking tracker for all PoX/Signer/Miner infrastructure needs on Stacks.
The development of this application is supported by a critical bountry from the Stacks foundation, see https://github.com/stacksgov/critical-bounties/issues/28
Next.JS
See package.json
for available commands.
AWS CLI
https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
AWS CDK
https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html
npm install -g aws-cdk
Credentials
Create a .env
file similar to .env.example
in /cdk
Run aws configure
. The access_key_id
and secret_access_key
can be found via AWS IAM console. Output format should be set to json
.
This should create 2 files:
~/.aws/credentials
~/.aws/config
Deploy
Test docker build:
docker build -t stacking-tracker .
Setup domain:
Deploy setup:
cdk bootstrap
cdk deploy Setup
Setup Database:
.env
in /packages/database
/packages/database
run npm db:generate
/packages/database
run npm db:push
Deploy Services:
cdk deploy StacksListener
cdk deploy PublicApi
cdk deploy Web
cdk deploy Lambdas
Setup CloudFront:
cdk deploy CloudFront
Local Postgresql on Mac OS
Needed to run tests.
brew install postgresql
brew services start postgresql
psql postgres
CREATE ROLE test WITH LOGIN PASSWORD 'test';
CREATE DATABASE tracker_test;
GRANT ALL PRIVILEGES ON DATABASE tracker_test TO test;
Environment Variables
Create a .env
file similar to .env.example
in:
/cdk
/apps/functions
/apps/stacks-listener
/packages/database
/packages/stacks
CDK
cdk bootstrap
cdk deploy
cdk destroy
Drizzle
npx drizzle-kit studio
Create bot via BotFather chat.
Use ngrok to set up tunnel to local machine.
curl -X POST "https://api.telegram.org/bot{{botid}}/setWebhook" -d "url=https://5.ngrok-free.app/telegram"
curl -X POST "https://api.telegram.org/bot{{botid}}/getWebhookInfo"
curl -X POST "https://api.telegram.org/bot{{botid}}/deleteWebhook"