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

[PLA-2166] Merge relay and matrix indexers #1516

Merged
merged 58 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
dedf89e
Changes
leonardocustodio Feb 6, 2025
f82a779
Overall improvements
leonardocustodio Feb 6, 2025
0631ac6
Some changes
leonardocustodio Feb 6, 2025
db7ec26
More rewrite
leonardocustodio Feb 6, 2025
90152bf
changes
leonardocustodio Feb 6, 2025
e23e6b8
Changes
leonardocustodio Feb 6, 2025
489800c
Changes
leonardocustodio Feb 6, 2025
4611ba7
Changes
leonardocustodio Feb 6, 2025
bfc9b81
Changes
leonardocustodio Feb 6, 2025
1b13f4b
More linting
leonardocustodio Feb 6, 2025
6ab4ecb
Cleanup
leonardocustodio Feb 6, 2025
1312d03
Changes
leonardocustodio Feb 6, 2025
401d07d
More changes
leonardocustodio Feb 6, 2025
92e90ec
More things
leonardocustodio Feb 6, 2025
512a95a
Rename
leonardocustodio Feb 6, 2025
1bd37c4
Changes
leonardocustodio Feb 7, 2025
57ba510
Changes
leonardocustodio Feb 7, 2025
2ce5859
Changes
leonardocustodio Feb 7, 2025
ed6c9a6
CHANGES
leonardocustodio Feb 7, 2025
6e82a4c
Changes
leonardocustodio Feb 7, 2025
04d5ea2
Improves
leonardocustodio Feb 7, 2025
576be68
Some changes
leonardocustodio Feb 7, 2025
a96a51e
more improvements
leonardocustodio Feb 7, 2025
8abcca8
More and more
leonardocustodio Feb 8, 2025
84f9a11
changes
leonardocustodio Feb 8, 2025
2d8d570
changes
leonardocustodio Feb 8, 2025
837aeaf
changes
leonardocustodio Feb 8, 2025
ed7e363
changes on types
leonardocustodio Feb 9, 2025
1d30a43
changes
leonardocustodio Feb 10, 2025
2530f6a
Change
leonardocustodio Feb 10, 2025
955cd35
commit
leonardocustodio Feb 10, 2025
720e1f5
changes
leonardocustodio Feb 10, 2025
d950ded
changes
leonardocustodio Feb 10, 2025
7c4d239
changes
leonardocustodio Feb 10, 2025
cc38d27
changes
leonardocustodio Feb 10, 2025
2fcaa17
changes
leonardocustodio Feb 10, 2025
c63dbf0
changes
leonardocustodio Feb 10, 2025
df91fe8
changes
leonardocustodio Feb 10, 2025
748d01b
changes
leonardocustodio Feb 10, 2025
d0a161f
changes
leonardocustodio Feb 11, 2025
1bc17f7
changes
leonardocustodio Feb 11, 2025
ca00ea3
changes
leonardocustodio Feb 11, 2025
fe6257e
changes
leonardocustodio Feb 11, 2025
0bf748b
changes
leonardocustodio Feb 11, 2025
2630b1a
changes
leonardocustodio Feb 12, 2025
6156d15
changes
leonardocustodio Feb 12, 2025
b2825cf
changes
leonardocustodio Feb 12, 2025
77a9909
changes
leonardocustodio Feb 12, 2025
f86092c
changes
leonardocustodio Feb 12, 2025
904de04
changes
leonardocustodio Feb 12, 2025
b2f4ceb
changes
leonardocustodio Feb 12, 2025
c3a75d8
changes
leonardocustodio Feb 12, 2025
578eed8
changes
leonardocustodio Feb 12, 2025
1b9d501
changes
leonardocustodio Feb 12, 2025
53be2f2
changes
leonardocustodio Feb 12, 2025
3b7b2f8
changes
leonardocustodio Feb 12, 2025
98b0a0e
changes
leonardocustodio Feb 12, 2025
e781802
changes
leonardocustodio Feb 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ DB_HOST=indexer_db
DB_PORT=5432
REDIS_URL=redis://indexer_redis:6379

# Hasura
HASURA_GRAPHQL_ENDPOINT=
HASURA_GRAPHQL_ADMIN_SECRET=


# OPTIONAL
NODE_ENV=
PROMETHEUS_PORT=7364
Expand All @@ -17,6 +22,7 @@ SQD_DEBUG=
GQL_PORT=4000
PINATA_GATEWAY_TOKEN=
SENTRY_DSN=
SENTRY_AUTH_TOKEN=

AWS_SNS_TOPIC_ARN=
AWS_DEFAULT_REGION=
Expand Down
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# This file is used to define a set of default reviewers.
* @leonardocustodio @justraman
* @leonardocustodio
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ updates:
schedule:
interval: daily
open-pull-requests-limit: 10

- package-ecosystem: github-actions
directory: /
schedule:
Expand Down
11 changes: 0 additions & 11 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
Expand Down
28 changes: 15 additions & 13 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
name: ESLint
on:
push:
branches:
- master
pull_request:

jobs:

tests:

lint:
name: Code Standard & Format
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Node v20

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: latest
run_install: false

- name: Install Node 20.x
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache: 'pnpm'

- name: Install modules
run: npm ci
- name: Install packages
run: |
pnpm add -g eslint
pnpm install

- name: Run ESLint
run: npm run lint
run: pnpm run lint:ci
7 changes: 2 additions & 5 deletions .github/workflows/link_checker.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
name: Link Check
name: Link Checker
on:
push:
branches:
- master
pull_request:

# Declare default permissions as read only.
permissions: read-all

jobs:
markdown-link-check:
check:
name: Markdown link checks
runs-on: ubuntu-latest
steps:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/publish_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: Publish docker image

on:
workflow_dispatch:

push:
tags:
- v*
Expand Down Expand Up @@ -31,7 +30,7 @@ jobs:
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: indexer-matrixchain
ECR_REPOSITORY: indexer-matrix
IMAGE_TAG: ${{ github.sha }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
run: |
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/push_image_to_dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: Publish docker image to DockerHub

on:
workflow_dispatch:

release:
types: [created]

Expand All @@ -20,7 +19,7 @@ jobs:
env:
DOCKERHUB_API_USERNAME: ${{ secrets.DOCKERHUB_API_USERNAME }}
DOCKERHUB_API_TOKEN: ${{ secrets.DOCKERHUB_API_TOKEN }}
DOCKER_REPOSITORY: indexer-matrixchain
DOCKER_REPOSITORY: indexer-matrix
IMAGE_TAG: ${{ github.ref_name }}
run: |
docker login --username $DOCKERHUB_API_USERNAME --password $DOCKERHUB_API_TOKEN
Expand Down
21 changes: 14 additions & 7 deletions .github/workflows/run_build.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Node CI
on:
push:
branches:
- master
pull_request:

jobs:
build:
Expand All @@ -16,10 +13,20 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: latest
run_install: false

- name: Install Node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
cache: 'pnpm'

- name: Install packages
run: pnpm install

- name: Build application
run: pnpm run build
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm exec lint-staged
24 changes: 24 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.github
.husky
.idea
db
lib
node_modules
src/model/generated
src/types/generated
**/*.sh
**/*.json
**/*.jsonl
**/*.md
**/*.yaml
**/*.yml
**/*.graphql
**/.env
**/.env.*
**/.dockerignore
.prettierrc
.prettierignore
.gitignore
LICENSE
Dockerfile
eslint.config.mjs
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"parser": "typescript",
"trailingComma": "es5",
"tabWidth": 4,
"useTabs": false,
"semi": false,
"singleQuote": true,
"arrowParens": "always",
"printWidth": 120,
"endOfLine": "lf"
}
11 changes: 0 additions & 11 deletions .prettierrc.json

This file was deleted.

4 changes: 4 additions & 0 deletions .squidignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
builds
lib
Dockerfile.git.github.idea
66 changes: 23 additions & 43 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,54 +1,34 @@
FROM node:20-alpine AS node

FROM node AS node-with-gyp
RUN apk add g++ make python3

FROM node-with-gyp AS builder

ARG SENTRY_AUTH_TOKEN
ENV SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN}

WORKDIR /squid

ADD package.json .
ADD package-lock.json .

RUN npm ci

ADD tsconfig.json .
ADD src src

RUN npm run build:prod

FROM node-with-gyp AS deps
WORKDIR /squid
ADD package.json .
ADD package-lock.json .
RUN npm ci --production
FROM node:20-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN npm install --global corepack@latest
RUN corepack enable
COPY . /app
WORKDIR /app

FROM base AS prod-deps
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile

FROM base AS build
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm run build

FROM base
LABEL org.opencontainers.image.source=https://github.com/enjin/indexer
LABEL org.opencontainers.image.description="Enjin Blockchain Indexer"
LABEL org.opencontainers.image.licenses=GPLv3

FROM node AS squid
WORKDIR /squid
COPY --from=deps /squid/package.json .
COPY --from=deps /squid/package-lock.json .
COPY --from=deps /squid/node_modules node_modules
COPY --from=builder /squid/lib lib
RUN apk add curl
RUN echo -e "loglevel=silent\nupdate-notifier=false" > /squid/.npmrc
COPY --from=prod-deps /app/node_modules /app/node_modules
COPY --from=build /app/lib /app/lib
ADD db db
ADD schema.graphql .
ENV PROCESSOR_PROMETHEUS_PORT 3000
EXPOSE 3000
EXPOSE 4000
# for worker
EXPOSE 9090
EXPOSE 8080

FROM squid AS matrixchain-indexer

LABEL org.opencontainers.image.source=https://github.com/enjin/indexer
LABEL org.opencontainers.image.description="Enjin Matrixchain Indexer"
LABEL org.opencontainers.image.licenses=GPLv3
EXPOSE 8000

COPY --chmod=0755 start.sh .

CMD ["/bin/sh", "-c", "/squid/start.sh"]
CMD ["/bin/sh", "-c", "/app/start.sh"]
38 changes: 0 additions & 38 deletions Makefile

This file was deleted.

Loading