Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use stacks node queries for top protocols #57

Merged
merged 31 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/gorgeous-meals-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"stackspulse": minor
---

Migrate the Top protocol query to use the stacks-blockchain-api database. It is now required to have a stacks node and API running for Stackspulse.
5 changes: 5 additions & 0 deletions .changeset/rich-moles-allow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"stackspulse": patch
---

Make weekly users cron job route use the new protocol users API.
1 change: 1 addition & 0 deletions .env.production.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ NEXT_TELEMETRY_DISABLED=1
CHAINHOOKS_API_TOKEN=dev-api-token
CRON_API_TOKEN=dev-api-token
DATABASE_PATH=file:sqlite.db
DATABASE_URL=postgresql://postgres:postgres@postgres:5432/postgres?schema=public
TWITTER_API_KEY=dev
TWITTER_API_SECRET_KEY=dev
TWITTER_ACCESS_TOKEN=dev
Expand Down
1 change: 1 addition & 0 deletions .env.production.local
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ TWITTER_API_KEY="encrypted:BEVE1WbHYhzlbCfIep1pX1eE1NqmNdUnnZEwZpGbNm8PZM+BDyX99
TWITTER_API_SECRET_KEY="encrypted:BAzGfOVwJzzw65UWTcZFqjsD/aOHjW5LGzylH/otgThO3IppV4mXhoSeAPc1ClyUZF/nUfVUppPndhfA7i21pDaiqe8xzdH6q6VxBHhZESIfrrP845bc9m67xDgp2JP2QdVtJ7gCm4chUOXivqQW2wRFsyXYLwKwEUCloX6LUajoKwtBDQjNLBj85Dlxr6Cc2yil"
TWITTER_ACCESS_TOKEN="encrypted:BDcWkceU7SmTmwi/mE5WuJnSnFd+5D9hDfEcmKegJWykUAiw3VOjXJ5kCviCVP0UZtHWDpTMjVdGFWJyofI9zACAFjMNqnl+iI8mrnKk2gTBLsV7Kc+SwDChTqvaUeLGBYv9344dhZxpP4Cp8QUgU3t8yIcBTNy+gA6CeNNRDgcrdTtAhLYHjPG/48VYbcbfngeU"
TWITTER_ACCESS_TOKEN_SECRET="encrypted:BELL8fcZpyJjCDqVSqKJjfP8HeyOiRqwhw1mZ7i7vf4RcMtEEM8/oFw7VKZ0stycaedqk2F2WABsCgPWmCTUU055FINa5GWNGivYI/t4vcxS1SXt1KT9QXQLZaBez01niQbgj8IkfBya0Yu+GFQC1godwcOwoMkPN9tQ9Z40/H/xiRmbrzXEDIrs3j+RJQ=="
DATABASE_URL="encrypted:BINPNiSSmEDi5vLPuTeASP14qMaO5hCi/N859hGegSWsLyF+NLf9IRmXtG9GjINks66DV3gbhRFRdrxAVDO3qEr7u1NrZGsttNkEUNRTjgZgpu+XcN1rmYgtzhWYruvfEdemmkwaDkALRRNK7JBlMw9LjwlVgLBzyexaTFq/dQY69Yy1plESc827H6iTIjnocbWMKJ4tc4j2yRqxAaFHtYkzabGGq8sIkeuWvGXdn9S57BO6K57V7OVb7w=="
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Finally upload the chainhooks predicates file `chainhooks.production.json` to th
To add a new encrypted production environment variable (replace `MY_NAME` and `my-value` with your values) run the following command:

```bash
pnpm dotenvx set MY_NAME "my-value" -f .env.production.local --encrypt
pnpm dotenvx set MY_NAME "my-value" -f .env.production.local
```

If you need to read the value of an encrypted environment variable run the following command:
Expand Down
25 changes: 25 additions & 0 deletions ansible/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,31 @@ Run the playbook:
$ ansible-playbook -i hosts.ini -e @vars.yml playbook.yml
```

## Stacks node setup

Git clone the stacks-blockchain-docker repository and copy the sample.env file:

```bash
git clone https://github.com/stacks-network/stacks-blockchain-docker && cd stacks-blockchain-docker
cp sample.env .env
```

Now edit the .env file and set the values to your needs.

To run the long running seed script run:

```bash
tmux new -s seed-chainstate

./scripts/seed-chainstate.sh
```

To attach to the tmux session run:

```bash
tmux attach -t seed-chainstate
```

## Credits

Config adapted from https://github.com/guillaumebriday/kamal-ansible-manager.
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@
"db:generate": "drizzle-kit generate",
"db:push": "drizzle-kit push",
"db:migrate": "node ./scripts/drizzle-migrate.mjs",
"stacks-node:db:pull": "dotenvx run --env-file=.env.production.local --env-file=.env.production -- prisma db pull",
"version": "pnpm changeset version && node scripts/create-release.mjs",
"release": "pnpm changeset publish",
"deploy": "fly deploy --remote-only",
"prepare": "husky"
},
"dependencies": {
"@dotenvx/dotenvx": "0.44.2",
"@dotenvx/dotenvx": "1.6.1",
"@libsql/client": "0.4.3",
"@radix-ui/themes": "3.0.5",
"@sentry/nextjs": "8.14.0",
"@sentry/nextjs": "8.17.0",
"@stacks/transactions": "6.15.0",
"@t3-oss/env-core": "0.10.1",
"@t3-oss/env-nextjs": "0.10.1",
Expand All @@ -32,17 +33,19 @@
"clsx": "2.1.1",
"date-fns": "3.6.0",
"drizzle-orm": "0.31.2",
"fathom-client": "3.7.0",
"fathom-client": "3.7.2",
"husky": "9.0.11",
"javascript-time-ago": "2.5.10",
"next": "14.2.4",
"next": "14.2.5",
"postgres": "3.4.4",
"react": "18.3.1",
"react-dom": "18.3.1",
"recharts": "2.13.0-alpha.4",
"sharp": "0.33.4",
"tailwind-merge": "2.3.0",
"tailwindcss-animate": "1.0.7",
"twitter-api-v2": "1.17.1",
"unstorage": "1.10.2",
"zod": "3.23.8"
},
"devDependencies": {
Expand All @@ -55,10 +58,11 @@
"autoprefixer": "10.4.19",
"drizzle-kit": "0.22.7",
"eslint": "8.57.0",
"eslint-config-next": "14.2.4",
"eslint-config-next": "14.2.5",
"eslint-plugin-tailwindcss": "3.17.4",
"lint-staged": "15.2.7",
"postcss": "8.4.39",
"prisma": "5.16.2",
"radix-themes-tw": "0.2.3",
"tailwindcss": "3.4.4",
"typescript": "5.5.3"
Expand Down
Loading