Skip to content

Commit

Permalink
Merge branch 'main' into fix/fix-events-extrinsics-relation
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-aurele-besner authored Nov 11, 2024
2 parents deed052 + 8c90428 commit bff68db
Show file tree
Hide file tree
Showing 27 changed files with 1,150 additions and 425 deletions.
8 changes: 7 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ NETWORK_ID=mainnet
# Testnet - Taurus
# NETWORK_ID=taurus

LOG_LEVEL=debug

# Mainnet
NODE_DOCKER_TAG="mainnet-2024-nov-05"
# Testnet - Taurus
Expand Down Expand Up @@ -44,6 +46,10 @@ REDIS_PORT=6379
BULL_USERNAME=bull
BULL_PASSWORD=board
BULL_PORT=3020
BULL_SESSION_SECRET=keyboardcat

NR_API_KEY=""
NR_AGENT_IDENTIFIER=""
NR_AGENT_IDENTIFIER=""

SLACK_TOKEN=""
SLACK_CONVERSATION_ID=""
4 changes: 2 additions & 2 deletions .vscode/astral.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"path": "../indexers/gemini-3h"
},
{
"name": "indexer - Gemini 3G",
"path": "../indexers/gemini-3g"
"name": "Taskboard",
"path": "../indexers/taskboard"
}
],
"settings": {
Expand Down
25 changes: 18 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ services:
hard: 65536 # Hard limit for open files
image: caddy:latest
ports:
- "80:9944" # Map external 80 to Caddy's 9944 for Node/RPC
- "443:9944" # Map external 443 to Caddy's 9945 for HTTPS
- "8081:8080" # Map external 8081 to Caddy's 8080 for Hasura
- "3011:3001" # Map external 3011 to Caddy's 3001 for Consensus
- "3012:3002" # Map external 3012 to Caddy's 3002 for Leaderboard
- "3013:3003" # Map external 3013 to Caddy's 3003 for Staking
- "80:9944" # Map external 80 to Caddy's 9944 for Node/RPC
- "443:9944" # Map external 443 to Caddy's 9945 for HTTPS
- "8081:8080" # Map external 8081 to Caddy's 8080 for Hasura
- "3011:3001" # Map external 3011 to Caddy's 3001 for Consensus
- "3012:3002" # Map external 3012 to Caddy's 3002 for Leaderboard
- "3013:3003" # Map external 3013 to Caddy's 3003 for Staking
volumes:
- ./indexers/Caddyfile:/etc/caddy/Caddyfile # Mount the Caddyfile
- caddy_data:/data # Volume for Let's Encrypt certificates
Expand Down Expand Up @@ -140,6 +140,10 @@ services:
# Hasura Migrations and Metadata
HASURA_GRAPHQL_MIGRATIONS_DIR: /hasura-migrations
HASURA_GRAPHQL_METADATA_DIR: /hasura-metadata

# Task Board Action Endpoint
HASURA_GRAPHQL_ACTION_TASK_BOARD: http://taskboard:${BULL_PORT}
HASURA_GRAPHQL_ACTION_TASK_BOARD_SESSION_SECRET: ${BULL_SESSION_SECRET}
ports:
- "${HASURA_GRAPHQL_PORT}:8080"
command:
Expand Down Expand Up @@ -334,11 +338,12 @@ services:
hostname: taskboard
restart: unless-stopped
ports:
- "${BULL_PORT}:3000"
- "${BULL_PORT}:${BULL_PORT}"
environment:
BULL_USERNAME: ${BULL_USERNAME}
BULL_PASSWORD: ${BULL_PASSWORD}
BULL_PORT: ${BULL_PORT}
BULL_SESSION_SECRET: ${BULL_SESSION_SECRET}

REDIS_HOST: redis
REDIS_PORT: ${REDIS_PORT}
Expand All @@ -348,3 +353,9 @@ services:
DB_DATABASE: ${DB_DATABASE}
DB_HOST: ${DB_HOST}
DB_PORT: ${DB_PORT}

NETWORK_ID: ${NETWORK_ID}
LOG_LEVEL: ${LOG_LEVEL}

SLACK_TOKEN: ${SLACK_TOKEN}
SLACK_CONVERSATION_ID: ${SLACK_CONVERSATION_ID}
28 changes: 28 additions & 0 deletions indexers/db/metadata/actions.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
type Mutation {
slackNotification(args: SlackNotificationInput!): SlackNotificationOutput
}

type Mutation {
updateAccount(args: UpdateAccountInput!): UpdateAccountOutput
}

input UpdateAccountInput {
networkId: String!
accountId: String!
}

input SlackNotificationInput {
title: String!
path: String
message: String
logData: String
messageId: String
}

type UpdateAccountOutput {
blockNumber: String!
}

type SlackNotificationOutput {
title: String!
}
32 changes: 29 additions & 3 deletions indexers/db/metadata/actions.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
actions: []
actions:
- name: slackNotification
definition:
kind: asynchronous
handler: "{{HASURA_GRAPHQL_ACTION_TASK_BOARD}}/add-task"
forward_client_headers: true
headers:
- name: taskboard_session_secret
value: "{{HASURA_GRAPHQL_ACTION_TASK_BOARD_SESSION_SECRET}}"
permissions:
- role: astral-api
comment: Send a slack notification
- name: updateAccount
definition:
kind: asynchronous
handler: "{{HASURA_GRAPHQL_ACTION_TASK_BOARD}}/add-task"
forward_client_headers: true
headers:
- name: taskboard_session_secret
value: "{{HASURA_GRAPHQL_ACTION_TASK_BOARD_SESSION_SECRET}}"
permissions:
- role: astral-api
comment: Update account in db (will add the account if it was not indexed before)
custom_types:
enums: []
input_objects: []
objects: []
input_objects:
- name: UpdateAccountInput
- name: SlackNotificationInput
objects:
- name: UpdateAccountOutput
- name: SlackNotificationOutput
scalars: []
6 changes: 3 additions & 3 deletions indexers/taskboard/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14-alpine
FROM node:18-alpine

# Switch to root user to install packages
USER root
Expand Down Expand Up @@ -32,7 +32,7 @@ USER node
RUN yarn install

# Expose the port the app runs on
EXPOSE 3000
EXPOSE ${BULL_PORT}

# Command to run the app
CMD ["yarn", "start"]
CMD yarn start
183 changes: 0 additions & 183 deletions indexers/taskboard/index.js

This file was deleted.

18 changes: 15 additions & 3 deletions indexers/taskboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,35 @@
"description": "A taskboard using Express and BullMQ to manage tasks",
"private": true,
"license": "MIT",
"main": "index.js",
"main": "src/index.ts",
"scripts": {
"start": "node index.js"
"start": "ts-node src/index.ts",
"dev": "export $(grep -v '^#' ../../.env | xargs) && export $(grep -v '^#' ../../.env.dev | xargs) && ts-node-dev src/index.ts"
},
"dependencies": {
"@autonomys/auto-consensus": "^1.0.1",
"@autonomys/auto-utils": "^1.0.1",
"@bull-board/api": "^5.23.0",
"@bull-board/express": "^5.23.0",
"body-parser": "^1.20.0",
"bullmq": "^4.6.0",
"connect-ensure-login": "^0.1.1",
"connect-redis": "^7.1.1",
"express": "^4.21.0",
"express-session": "^1.17.2",
"ioredis": "^5.4.1",
"passport": "^0.6.0",
"passport-local": "^1.0.0",
"pg": "^8.13.0"
},
"devDependencies": {
"@types/bull": "^4.10.4",
"@types/express": "^5.0.0",
"@types/express-session": "^1.18.0",
"@types/node": "^22.9.0",
"ts-node": "^10.9.2",
"ts-node-dev": "^2.0.0",
"typescript": "^5.2.2"
},
"workspaces": {
"nohoist": [
"**"
Expand Down
Loading

0 comments on commit bff68db

Please sign in to comment.