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: faster ingestion and containerized #6

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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
47 changes: 30 additions & 17 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,50 @@
# CI for command line NodeJS Applications
name: nodejs
on:

on:
push:
paths:
- "**/**"
- "!**/*.md/**"

env:
CI: true
COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
PULL_NUMBER: ${{ github.event.pull_request.number }}
RUN_ID: ${{ github.run_id }}
FORCE_COLOR: 2

jobs:
run:
name: Node ${{ matrix.node }} on ${{ matrix.os }}
pipeline:
name: Node ${{ matrix.node-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
node: ['14']
node-version: ['16.x']
os: ['ubuntu-latest']

steps:
- name: Clone repository
uses: actions/[email protected]

- name: Set up Node.js
uses: actions/[email protected]
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
node-version: ${{ matrix.node-version }}

- name: Install npm dependencies
run: npm install
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install project dependencies
run: yarn --prefer-offline
id: install

- name: Run build
run: npm run build
- name: Install project dependencies
run: yarn run build
id: build
17 changes: 17 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: '3.1'

services:

mongo:
image: mongo
restart: always
ports:
- 27017:27017

mongo-express:
image: mongo-express
restart: always
ports:
- 8081:8081
environment:
ME_CONFIG_MONGODB_URL: mongodb://mongo:27017/
8 changes: 2 additions & 6 deletions example.env
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ CORS_ORIGIN=''
GAS_STATION_API_URL=''
BLOCKNATIVE_API_URL=''

CHAIN_ID=0x1

UNIV2="0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"
UNIV3="0xE592427A0AEce92De3Edee1F18E0157C05861564"
SUSHIV2="0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F"
Expand All @@ -47,9 +49,3 @@ KYBER="https://api.kyber.network/tokenlist"
MYCRYPTOAPI="https://uniswap.mycryptoapi.com/"
ZAPPER="https://zapper.fi/api/token-list"
ZERION="https://tokenlist.zerion.eth.link"

# Heroku
# cant run on free tier more than 20 days of the month
#HEROKU_APP_NAME_CONFIRMED_WORKER=''
#HEROKU_APP_NAME_PENDING_WORKER=''
#HEROKU_APP_NAME_WEBSOCKET_WORKER=''
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mempool-shark",
"private": false,
"version": "0.2.1",
"version": "0.3.0",
"author": "SEE CONTRIBUTORS",
"engines": {
"node": ">=14.0.0"
Expand All @@ -23,7 +23,6 @@
"dev:mempool": "npx ts-node-dev ./src/listener-mempool.ts",
"dev:confirm": "npx ts-node-dev ./src/listener-confirmation.ts",
"dev:ws": "npx ts-node-dev ./src/_websocket-server.ts",
"init:heroku": "npx ts-node ./src/utils/initServer/set-heroku.ts",
"reset:hard": "npx ts-node ./src/utils/dev-utils/drop-transactions.ts",
"reset:txs": "npx ts-node ./src/utils/dev-utils/reset-transactions.ts",
"reset:txc": "npx ts-node ./src/utils/dev-utils/reset-transactions-c.ts",
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
"outDir": "./lib",
"sourceMap": true,
"strict": true,
"target": "es2020",
"skipLibCheck": true
},
"include": [
"src/**/*.ts"
],
"exclude": ["test", "node_modules"]
}
}