Skip to content

Commit

Permalink
Merge branch 'main' into ft/addGitHubProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-aurele-besner authored Nov 18, 2024
2 parents 4a62486 + 3592721 commit afb0f08
Show file tree
Hide file tree
Showing 920 changed files with 539,354 additions and 144,514 deletions.
55 changes: 55 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
NODE_ENV=development

# Mainnet
NETWORK_ID=mainnet
# Testnet - Taurus
# NETWORK_ID=taurus

LOG_LEVEL=debug

# Mainnet
NODE_DOCKER_TAG=mainnet-2024-nov-13
# Testnet - Taurus
# NODE_DOCKER_TAG=taurus-2024-nov-05

DB_USER=postgres
DB_DATABASE=postgres
DB_PASSWORD=postgres
DB_PORT=5432
DB_HOST=postgres

# Mainnet
RPC_URLS="ws://caddy:8000"
CHAIN_ID="0x66455a580aabff303720aa83adbe6c44502922251c03ba73686d5245da9e21bd"

# Testnet - Taurus
# RPC_URLS="ws://caddy:8000
# CHAIN_ID="0x295aeafca762a304d92ee1505548695091f6082d3f0aa4d092ac3cd6397a6c5e"

HASURA_GRAPHQL_PORT=8080
HASURA_GRAPHQL_ADMIN_SECRET=helloworld

# In local dev, we want to disable this to run the metadata first and run console in another terminal
HASURA_GRAPHQL_ENABLE_CONSOLE=true
HASURA_GRAPHQL_JWT_SECRET='{"type":"HS256","key":"this_is_a_mock_secret_with_32_chars"}'
HASURA_GRAPHQL_CORS_DOMAIN="*"

# Mainnet
DICTIONARY_DIRECTORY=autonomys
# Testnet - Taurus
# DICTIONARY_DIRECTORY=autonomys-taurus
DICTIONARY_SUBQUERY_NODE_PORT=3000
DICTIONARY_URL="http://localhost:3000"

REDIS_PORT=6379

BULL_USERNAME=bull
BULL_PASSWORD=board
BULL_PORT=3020
BULL_SESSION_SECRET=keyboardcat

NR_API_KEY=""
NR_AGENT_IDENTIFIER=""

SLACK_TOKEN=""
SLACK_CONVERSATION_ID=""
1 change: 1 addition & 0 deletions .env.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Add environment variables here to override those in the .env file.
1 change: 1 addition & 0 deletions .env.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Add environment variables here to override those in the .env file.
Binary file added .github/images/autonomys-banner.webp
Binary file not shown.
69 changes: 51 additions & 18 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,32 @@ name: Build
on: [push, pull_request]

jobs:
ts-lint-and-build-squid:
codegen-and-build-indexers:
runs-on: ubuntu-latest
defaults:
run:
working-directory: indexers/squid-blockexplorer
name: Run eslint, check typescript and run tests
working-directory: indexers
name: Run codegen and build
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Set up Node.js 📦
uses: actions/setup-node@v2
with:
node-version: "16"
- run: npm ci --legacy-peer-deps
- run: npm test
- run: npm run lint
- run: npm run build
node-version: '18'

- name: Enable Corepack 📦
run: corepack enable

- name: Install dependencies 📦
run: yarn install

- name: Generate types and project manifest 🔗
run: yarn codegen

- name: Build project 🔧
run: yarn build
ts-lint-and-build-explorer:
runs-on: ubuntu-latest
defaults:
Expand All @@ -27,11 +38,24 @@ jobs:
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Set up Node.js 📦
uses: actions/setup-node@v2
with:
node-version: '18'

- name: Enable Corepack 📦
run: corepack enable

- name: Install dependencies 📦
run: yarn install

- name: Run linter 🔍
run: |
yarn install
yarn lint:fix
run: yarn lint:fix

- name: Build project 🔧
env:
NEXT_PUBLIC_GEMINI_3H_INDEXERS: ${{ secrets.NEXT_PUBLIC_GEMINI_3H_INDEXERS }}
run: yarn build
ts-lint-and-build-health-check:
runs-on: ubuntu-latest
Expand All @@ -40,10 +64,19 @@ jobs:
working-directory: health-check
name: Run eslint, check typescript
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Set up Node.js 📦
uses: actions/setup-node@v2
with:
node-version: "16"
- run: npm ci
- run: npm run lint
- run: npm run build

- name: Install dependencies 📦
run: npm ci

- name: Run linter 🔍
run: npm run lint

- name: Build project 🔧
run: npm run build
34 changes: 0 additions & 34 deletions .github/workflows/gh-account-image.yml

This file was deleted.

49 changes: 0 additions & 49 deletions .github/workflows/gh-container-image.yml

This file was deleted.

65 changes: 0 additions & 65 deletions .github/workflows/gh-deploy-micro-squids.yml

This file was deleted.

86 changes: 86 additions & 0 deletions .github/workflows/gh-deploy-subql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Deploy Subql Green (staging)

on:
push:
branches:
- main
paths:
- "indexers/**"
env:
DOCKER_HOST: ssh://${{ secrets.SSH_USER }}@${{ secrets.SUBQL_HOST }}
DEPLOY_PATH: /home/${{ secrets.SSH_USER }}/astral
BRANCH_NAME: ${{ github.ref_name }}

jobs:
deploy:
runs-on: ubuntu-latest

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

- name: Set Hasura secret
id: set_secret
run: echo "hasura_secret=${{ secrets.HASURA_GRAPHQL_ADMIN_SECRET }}" >> $GITHUB_ENV

- name: Install SSH key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SERVER_SSH_PRIVATE_KEY }}

- name: Add SSH host key fingerprint
run: |
ssh-keyscan -H ${{ secrets.SUBQL_HOST }} >> ~/.ssh/known_hosts
- name: Deploy with Docker Compose
env:
SSH_USER: ${{ secrets.SSH_USER }}
HASURA_GRAPHQL_ADMIN_SECRET: ${{ secrets.HASURA_GRAPHQL_ADMIN_SECRET }}
HASURA_GRAPHQL_JWT_SECRET: ${{ secrets.HASURA_GRAPHQL_JWT_SECRET }}
run: |
mkdir -p ~/.ssh
ssh-keyscan -H ${{ secrets.SUBQL_HOST }} >> ~/.ssh/known_hosts
ssh ${SSH_USER}@${{ secrets.SUBQL_HOST }} "
if [ ! -d ${DEPLOY_PATH} ]; then
git clone https://github.com/autonomys/astral.git ${DEPLOY_PATH}
else
cd ${DEPLOY_PATH}
git pull
fi
git checkout ${BRANCH_NAME}
# Securely update the .env file
if [ ! -f .env ]; then
echo 'HASURA_GRAPHQL_ADMIN_SECRET=${{ secrets.HASURA_GRAPHQL_ADMIN_SECRET }}' > .env
echo 'HASURA_GRAPHQL_JWT_SECRET=${{ secrets.HASURA_GRAPHQL_JWT_SECRET }}' >> .env
else
sed -i '/^HASURA_GRAPHQL_ADMIN_SECRET=/d' .env
echo 'HASURA_GRAPHQL_ADMIN_SECRET=${{ secrets.HASURA_GRAPHQL_ADMIN_SECRET }}' >> .env
sed -i '/^HASURA_GRAPHQL_JWT_SECRET=/d' .env
echo 'HASURA_GRAPHQL_JWT_SECRET=${{ secrets.HASURA_GRAPHQL_JWT_SECRET }}' >> .env
fi
export $(grep -v '^#' /home/${{ secrets.SSH_USER }}/astral/.env | xargs)
cd /home/${{ secrets.SSH_USER }}/astral/indexers
yarn build-dictionary
npx lerna run codegen
npx lerna run build
sudo docker compose -p prod-astral-indexers -f /home/${{ secrets.SSH_USER }}/astral/docker-compose.yml -f /home/${{ secrets.SSH_USER }}/astral/docker-compose.prod.yml --profile dictionary --profile task --profile taurus up -d --remove-orphans
echo 'Installation Complete'
"
- name: Notify on failure
if: failure()
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job
author_name: Deployment failed
mention: here
if_mention: failure,cancelled
job_name: Deploy Subql Green (staging)
channel: alerts
icon_emoji: ":github:"
Loading

0 comments on commit afb0f08

Please sign in to comment.