Skip to content

Commit

Permalink
Merge branch 'feat/erpc-setup'
Browse files Browse the repository at this point in the history
  • Loading branch information
KONFeature committed Jul 31, 2024
2 parents fdf3777 + b5ac1aa commit c4b16c2
Show file tree
Hide file tree
Showing 14 changed files with 1,414 additions and 434 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
branches:
- main
- staging
- feat/erpc-setup

concurrency:
group: ${{ github.ref }}-deploy
Expand All @@ -30,6 +31,17 @@ jobs:
with:
node-version: '22'

- uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref }}
list-files: 'shell'
filters: |
erpc:
- 'packages/erpc/**'
ponder:
- 'packages/ponder/**'
- uses: pnpm/action-setup@v4
with:
run_install: false
Expand Down Expand Up @@ -62,12 +74,15 @@ jobs:
uses: aws-actions/amazon-ecr-login@v2

- name: Set up QEMU
if: steps.changes.outputs.ponder == 'true' || steps.changes.outputs.erpc == 'true'
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
if: steps.changes.outputs.ponder == 'true' || steps.changes.outputs.erpc == 'true'
uses: docker/setup-buildx-action@v3

- name: "🔨 Build Ponder docker dependencies"
if: steps.changes.outputs.ponder == 'true'
uses: docker/build-push-action@v6
with:
context: ./packages/ponder
Expand All @@ -78,9 +93,10 @@ jobs:
262732185023.dkr.ecr.eu-west-1.amazonaws.com/indexer:${{ github.sha }}
# Github actions cache
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to: type=gha,mode=min

- name: "🔨 Build ERPC docker dependencies"
if: steps.changes.outputs.erpc == 'true'
uses: docker/build-push-action@v6
with:
context: ./packages/erpc
Expand All @@ -91,11 +107,12 @@ jobs:
262732185023.dkr.ecr.eu-west-1.amazonaws.com/erpc:${{ github.sha }}
# Github actions cache
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to: type=gha,mode=min

- name: "🚀 SST Deploy"
run: |
echo "Deploying with stage: prod"
pnpm sst deploy --stage prod
env:
COMMIT_SHA: ${{ github.sha }}
ERPC_IMAGE_TAG: ${{ steps.changes.outputs.erpc == 'true' && github.sha || 'latest' }}
PONDER_IMAGE_TAG: ${{ steps.changes.outputs.ponder == 'true' && github.sha || 'latest' }}
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

52 changes: 49 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,51 @@
# Frak Indexing
# Frak Indexer

Repo used to index all of the events related to the Frak ecosystem.
Frak Indexer is an open-source project designed to index events from Frak smart contracts on the Arbitrum Sepolia network. It combines the power of Ponder for building robust crypto apps with eRPC for efficient RPC caching and load balancing, all deployed using SST (Serverless Stack) on AWS infrastructure.

Built using the awesome [Ponder](https://ponder.sh/).
## Architecture Overview

The Frak Indexer consists of two main components:

1. **Ponder Service**: An open-source backend framework for building robust, performant, and maintainable crypto apps. In this project, it's used for indexing blockchain events from Frak smart contracts.

2. **eRPC Service**: A fault-tolerant EVM RPC load balancer with reorg-aware permanent caching and auto-discovery of node providers. It provides a layer of caching on top of other RPCs, enhancing performance and reliability.

Both services are deployed as containerized applications on AWS ECS (Elastic Container Service) using Fargate, with an Application Load Balancer (ALB) routing traffic between them.

## Deployment Architecture

- **VPC**: A dedicated VPC is created to house all components.
- **ECS Cluster**: Both Ponder and eRPC services run in the same ECS cluster.
- **Application Load Balancer**:
- Listens on port 80
- Routes traffic based on path patterns:
- `/rpc-main/*` -> eRPC service (for cached RPC requests)
- `/*` (all other paths) -> Ponder service (for indexed data access)
- **CloudFront Distribution**: Sits in front of the ALB to provide additional caching and global content delivery.

## Key Features

- **Efficient Indexing**: Utilizes Ponder to create a robust and maintainable indexing solution for Frak smart contract events.
- **Optimized RPC Access**: eRPC provides caching and load balancing across multiple RPC providers, improving performance and reliability.
- **Scalable**: Utilizes AWS Fargate for serverless container management.
- **High Availability**: Deployed across multiple availability zones.
- **Secure**: Uses AWS security groups and VPC for network isolation.
- **Observable**: Includes CloudWatch logs and metrics for monitoring.
- **Maintainable**: Infrastructure as Code (IaC) using SST for easy updates and version control.

## Deployment

This project uses SST for infrastructure deployment. To deploy:

1. Ensure you have AWS credentials configured.
2. Setup the secrets required to run the project (check the `iac/Config.ts` file for the required secrets).
3. Install dependencies: `pnpm install`
4. Deploy the stack: `npx run deploy`

## Contributing

We welcome contributions to the Frak Indexer project!

## License

This project is licensed under the GNU GPLv3 License - see the LICENSE file for details.
96 changes: 0 additions & 96 deletions iac/Erpc.ts

This file was deleted.

Loading

0 comments on commit c4b16c2

Please sign in to comment.