-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:sygmaprotocol/squid-indexer into tc…
…ar/refactor-startup Signed-off-by: tcar <tcar121293@gmail.com>
- Loading branch information
Showing
19 changed files
with
932 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
DB_NAME=postgres | ||
DB_PASS=postgres | ||
DB_PORT=5432 | ||
DB_USERNAME=postgres | ||
DB_HOST=db | ||
SHARED_CONFIG_URL="https://ipfs.io/ipfs/bafkreiasnla2ya55of6nwm3swjstip4q2ixfa3t6tvixyibclfovxnerte" | ||
1_METADATA='{"id": 1, "rpcUrl": "http://evm1:8545"}' | ||
2_METADATA='{"id": 2, "rpcUrl": "http://evm2:8545"}' | ||
3_METADATA='{"id": 3, "rpcUrl": "ws://substrate-pallet:9944"}' | ||
|
||
ENV_DOMAINS='[1,2,3]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: Mainnet Squid Indexer | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release_tag: | ||
description: 'The Release tag Version' | ||
required: true | ||
type: string | ||
|
||
run-name: Deploy Squid-Indexer to Mainnet - ${{ inputs.release_tag }} by @${{ github.actor }} | ||
|
||
env: | ||
ENVIRONMENT: MAINNET | ||
REGISTRY: 'ghcr.io' | ||
VERSION: ${{ inputs.release_tag }} | ||
|
||
jobs: | ||
deploy: | ||
name: deploy | ||
runs-on: ubuntu-latest | ||
environment: mainnet | ||
permissions: | ||
contents: read | ||
id-token: write | ||
actions: write | ||
env: | ||
AWS_REGION: '${{ secrets.AWS_REGION }}' | ||
AWS_MAINNET: '${{ secrets.AWS_MAINNET }}' | ||
|
||
steps: | ||
- name: Authorised User only | ||
run: | | ||
if [[ ! " tcar121293 eedygreen MakMuftic akchainsafe mpetrun5 " =~ " ${{ github.actor }} " ]]; then | ||
echo "You are not authorized to deploy to mainnet!" | ||
exit 1 | ||
fi | ||
- name: checkout ecs repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: sygmaprotocol/devops | ||
token: ${{ secrets.GHCR_TOKEN }} | ||
ref: main | ||
|
||
- name: render jinja2 templates to task definition json files | ||
uses: cuchi/jinja2-action@v1.2.0 | ||
with: | ||
template: 'squid-indexer/ecs/task_definition-squid-indexer-${{ env.ENVIRONMENT }}.j2' | ||
output_file: 'suid-indexer/ecs/task_definition-squid-indexer-${{ env.ENVIRONMENT }}.json' | ||
data_format: json | ||
variables: | | ||
awsAccountId=${{ env.AWS_MAINNET }} | ||
awsRegion=${{ env.AWS_REGION }} | ||
awsEnv=${{ env.ENVIRONMENT }} | ||
imageTag=${{ env.VERSION }} | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: arn:aws:iam::${{ env.AWS_MAINNET }}:role/github-actions-${{ env.ENVIRONMENT }}-chainbridge | ||
aws-region: ${{ env.AWS_REGION }} | ||
role-session-name: GithubActions | ||
|
||
- name: Deploy to Amazon ECS | ||
uses: aws-actions/amazon-ecs-deploy-task-definition@v1 | ||
with: | ||
task-definition: squid-indexer/ecs/task_definition-squid-indexer-${{ env.ENVIRONMENT }}.json | ||
service: squid-indexer-service-${{ env.ENVIRONMENT }} | ||
cluster: sygma-explorer-${{ env.ENVIRONMENT }} | ||
wait-for-service-stability: true | ||
|
||
- name: slack notify | ||
uses: 8398a7/action-slack@v3 | ||
with: | ||
status: ${{ job.status }} | ||
fields: repo,message,commit,author,action,job,eventName,ref,workflow # selectable (default: repo,message) | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required | ||
if: always() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
name: Testnet Squid Indexer | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
run-name: Deploy Squid-Indexer to Testnet - ${{ inputs.release_tag }} by @${{ github.actor }} | ||
|
||
env: | ||
ENVIRONMENT: TESTNET | ||
REGISTRY: 'ghcr.io' | ||
TAG: 'latest' | ||
VERSION: ${{ github.event.release.tag_name }} | ||
|
||
jobs: | ||
push: | ||
name: push | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
packages: write | ||
actions: read | ||
|
||
steps: | ||
- name: checkout the source code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: login to ghcr | ||
id: ghcr | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: build / tag / push docker image into ghcr | ||
id: build-and-push-tag | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{ env.VERSION }},${{ env.REGISTRY }}/${{ github.repository }}:${{ github.ref_name }} | ||
|
||
- name: slack notify | ||
uses: 8398a7/action-slack@v3 | ||
with: | ||
status: ${{ job.status }} | ||
fields: repo,message,commit,author,action,job,eventName,ref,workflow | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
if: always() | ||
|
||
deploy: | ||
needs: push | ||
name: deploy | ||
runs-on: ubuntu-latest | ||
environment: testnet | ||
permissions: | ||
contents: read | ||
id-token: write | ||
actions: write | ||
env: | ||
AWS_REGION: '${{ secrets.AWS_REGION }}' | ||
AWS_TESTNET: '${{ secrets.AWS_TESTNET }}' | ||
steps: | ||
- name: checkout ecs repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: sygmaprotocol/devops | ||
token: ${{ secrets.GHCR_TOKEN }} | ||
ref: main | ||
|
||
- name: render jinja2 templates to task definition json files | ||
uses: cuchi/jinja2-action@v1.2.0 | ||
with: | ||
template: 'squid-indexer/ecs/task_definition-squid-indexer-${{ env.ENVIRONMENT }}.j2' | ||
output_file: 'squid-indexer/ecs/task_definition-squid-indexer-${{ env.ENVIRONMENT }}.json' | ||
data_format: json | ||
variables: | | ||
awsAccountId=${{ env.AWS_TESTNET }} | ||
awsRegion=${{ env.AWS_REGION }} | ||
awsEnv=${{ env.ENVIRONMENT }} | ||
imageTag=${{ env.VERSION }} | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: arn:aws:iam::${{ env.AWS_TESTNET }}:role/github-actions-${{ env.ENVIRONMENT }}-chainbridge | ||
aws-region: ${{ env.AWS_REGION }} | ||
role-session-name: GithubActions | ||
|
||
- name: Deploy to Amazon ECS | ||
uses: aws-actions/amazon-ecs-deploy-task-definition@v1 | ||
with: | ||
task-definition: squid-indexer/ecs/task_definition-squid-indexer-${{ env.ENVIRONMENT }}.json | ||
service: squid-indexer-service-${{ env.ENVIRONMENT }} | ||
cluster: explorer-indexer-${{ env.ENVIRONMENT }} | ||
wait-for-service-stability: true | ||
|
||
- name: slack notify | ||
uses: 8398a7/action-slack@v3 | ||
with: | ||
status: ${{ job.status }} | ||
fields: repo,message,commit,author,action,job,eventName,ref,workflow # selectable (default: repo,message) | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required | ||
if: always() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: E2E Tests | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2.4.0 | ||
- name: Install Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v2.5.1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Run Docker | ||
run: docker compose up --build -d | ||
- name: Wait | ||
run: sleep 80s | ||
- name: Install dependencies | ||
run: yarn install | ||
- name: Run tests | ||
run: yarn run test:e2e | ||
- name: Clean up Docker containers | ||
if: always() | ||
run: docker compose down |
Oops, something went wrong.