Skip to content

Commit

Permalink
feat: init
Browse files Browse the repository at this point in the history
  • Loading branch information
ratik committed May 22, 2024
0 parents commit 32c42f8
Show file tree
Hide file tree
Showing 21 changed files with 14,342 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@

# These are some examples of commonly ignored file patterns.
# You should customize this list as applicable to your project.
# Learn more about .gitignore:
# https://www.atlassian.com/git/tutorials/saving-changes/gitignore


# dependencies
/node_modules
/.pnp
.pnp.*
package-lock.json
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# local env files
.env*.local

# Compiled Java class files
*.class

# Compiled Python bytecode
*.py[cod]

# Log files
*.log

# Package files
*.jar

# Generated files
target/
dist/
src/types
project.yaml

# JetBrains IDE
.idea/
/tmp

# Unit test reports
TEST*.xml

# Generated by MacOS
.DS_Store

# Generated by Windows
Thumbs.db

# Applications
*.app
*.exe
*.war

# Large media files
*.mp4
*.tiff
*.avi
*.flv
*.mov
*.wmv

.data
dist
27 changes: 27 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on:
push:
branches:
- 'main'

name: Deploy

jobs:
build:
name: Build and Deploy
runs-on: ubuntu-latest
steps:
- name: Executing docker compose build and update
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script: |
cd /home/${{ secrets.USERNAME }}/subquery-indexer/;
git reset --hard;
git pull --rebase;
docker system prune -f;
docker compose -f docker-compose.production.yml build --force-rm --no-cache --compress;
docker compose -f docker-compose.production.yml up -d;
docker compose ps -a
68 changes: 68 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@

# These are some examples of commonly ignored file patterns.
# You should customize this list as applicable to your project.
# Learn more about .gitignore:
# https://www.atlassian.com/git/tutorials/saving-changes/gitignore


# dependencies
/node_modules
/.pnp
.pnp.*
package-lock.json
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# local env files
.env*.local

# Compiled Java class files
*.class

# Compiled Python bytecode
*.py[cod]

# Log files
*.log

# Package files
*.jar

# Generated files
target/
dist/
src/types
project.yaml

# JetBrains IDE
.idea/
/tmp

# Unit test reports
TEST*.xml

# Generated by MacOS
.DS_Store

# Generated by Windows
Thumbs.db

# Applications
*.app
*.exe
*.war

# Large media files
*.mp4
*.tiff
*.avi
*.flv
*.mov
*.wmv

.data
dist
894 changes: 894 additions & 0 deletions .yarn/releases/yarn-4.2.2.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.2.2.cjs
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT LICENSE

Copyright 2020-2021 SubQuery Pte Ltd authors & contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SubQuery Indexer for Drop points program


93 changes: 93 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
version: "3"

services:
postgres:
build:
context: .
dockerfile: ./docker/pg-Dockerfile
ports:
- 5432:5432
volumes:
- .data/postgres:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5

subquery-node-osmosis:
image: subquerynetwork/subql-node-cosmos:latest
depends_on:
"postgres":
condition: service_healthy
restart: always
environment:
DB_USER: postgres
DB_PASS: postgres
DB_DATABASE: postgres
DB_HOST: postgres
DB_PORT: 5432
volumes:
- ./:/app
command:
- ${SUB_COMMAND:-} # set SUB_COMMAND env variable to "test" to run tests
- -f=/app/project-osmosis.yaml
- --multi-chain
- --db-schema=multi-transfers
- --disable-historical
- --batch-size=30
healthcheck:
test: ["CMD", "curl", "-f", "http://subquery-node-osmosis:3000/ready"]
interval: 3s
timeout: 5s
retries: 10
subquery-node-secret:
image: subquerynetwork/subql-node-cosmos:latest
depends_on:
"postgres":
condition: service_healthy
restart: always
environment:
DB_USER: postgres
DB_PASS: postgres
DB_DATABASE: postgres
DB_HOST: postgres
DB_PORT: 5432
volumes:
- ./:/app
command:
- ${SUB_COMMAND:-} # set SUB_COMMAND env variable to "test" to run tests
- -f=/app/project-secret.yaml
- --multi-chain
- --db-schema=multi-transfers
- --disable-historical
- --batch-size=30
healthcheck:
test: ["CMD", "curl", "-f", "http://subquery-node-secret:3000/ready"]
interval: 3s
timeout: 5s
retries: 10

graphql-engine:
image: onfinality/subql-query:latest
ports:
- 3001:3000
depends_on:
"postgres":
condition: service_healthy
"subquery-node-secret":
condition: service_healthy
"subquery-node-osmosis":
condition: service_healthy
restart: always
environment:
DB_USER: postgres
DB_PASS: postgres
DB_DATABASE: postgres
DB_HOST: postgres
DB_PORT: 5432
command:
- --name=multi-transfers
- --playground
5 changes: 5 additions & 0 deletions docker/load-extensions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<EOF
CREATE EXTENSION IF NOT EXISTS btree_gist;
EOF
18 changes: 18 additions & 0 deletions docker/node-Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM subquerynetwork/subql-node-cosmos:latest

WORKDIR /app

RUN apk add --no-cache g++ make py3-pip
COPY package.json yarn.lock .yarnrc.yml ./
COPY .yarn/ ./.yarn/
RUN yarn workspaces focus --all

COPY . .

ARG ENV_FILE=.env.mainnet.sample
COPY ${ENV_FILE} .env.local

RUN yarn codegen
RUN yarn build

CMD ["-f=/app", "--db-schema=app", "--workers=4", "--batch-size=30", "--unfinalized-blocks=true"]
12 changes: 12 additions & 0 deletions docker/pg-Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM postgres:16-alpine

# Variables needed at runtime to configure postgres and run the initdb scripts
ENV POSTGRES_DB 'postgres'
ENV POSTGRES_USER 'postgres'
ENV POSTGRES_PASSWORD 'postgres'

# Copy in the load-extensions script
COPY docker/load-extensions.sh /docker-entrypoint-initdb.d/

# Convert line endings to LF
RUN sed -i 's/\r$//' /docker-entrypoint-initdb.d/load-extensions.sh && chmod +x /docker-entrypoint-initdb.d/load-extensions.sh
39 changes: 39 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "neutron",
"version": "0.0.1",
"description": "This project can be use as a starting point for developing your Cosmos (Neutron) based SubQuery project",
"main": "dist/index.js",
"scripts": {
"build": "subql build",
"codegen": "subql codegen",
"start:docker": "docker-compose pull && docker-compose up --remove-orphans",
"dev": "subql codegen && subql build && docker-compose pull && docker-compose up --remove-orphans",
"prepack": "rm -rf dist && npm run build",
"test": "jest"
},
"homepage": "https://github.com/subquery/cosmos-subql-starter",
"repository": "github:subquery/cosmos-subql-starter",
"files": [
"dist",
"schema.graphql",
"project.yaml"
],
"author": "SubQuery Team",
"license": "MIT",
"packageManager": "[email protected]",
"devDependencies": {
"@cosmjs/stargate": "^0.28.9",
"@subql/cli": "^4.10.0",
"@subql/node-cosmos": "latest",
"@subql/testing": "latest",
"typescript": "^5.2.2"
},
"dependencies": {
"@subql/types-cosmos": "latest",
"@subql/utils": "^2.7.0",
"@types/node": "^17.0.21",
"pino": "^7.8.0",
"ts-proto": "^1.112.1",
"tslib": "^2.3.1"
}
}
25 changes: 25 additions & 0 deletions project-osmosis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
specVersion: 1.0.0
version: 0.0.1
name: drop-points
description: Drop points
runner:
node:
name: '@subql/node-cosmos'
version: '>=3.0.0'
query:
name: '@subql/query'
version: '*'
schema:
file: ./schema.graphql
network:
chainId: osmosis-1
endpoint:
- https://osmosis-rpc.publicnode.com/
dataSources:
- kind: cosmos/Runtime
startBlock: 15952063
mapping:
file: ./dist/index.js
handlers:
- handler: handleCoin
kind: cosmos/TransactionHandler
Loading

0 comments on commit 32c42f8

Please sign in to comment.