Skip to content

Commit

Permalink
✨ More granular deployment + remove health checks
Browse files Browse the repository at this point in the history
  • Loading branch information
KONFeature committed Jul 31, 2024
1 parent 5491674 commit 3ef6401
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 25 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ jobs:
base: ${{ github.ref }}
list-files: 'shell'
filters: |
images:
erpc:
- 'packages/erpc/**'
ponder:
- 'packages/ponder/**'
- uses: pnpm/action-setup@v4
Expand Down Expand Up @@ -73,15 +74,15 @@ jobs:
uses: aws-actions/amazon-ecr-login@v2

- name: Set up QEMU
if: steps.changes.outputs.images == 'true'
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.images == 'true'
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.images == 'true'
if: steps.changes.outputs.ponder == 'true'
uses: docker/build-push-action@v6
with:
context: ./packages/ponder
Expand All @@ -95,7 +96,7 @@ jobs:
cache-to: type=gha,mode=min

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

Expand All @@ -114,4 +114,5 @@ jobs:
echo "Deploying with stage: prod"
pnpm sst deploy --stage prod
env:
IMAGE_TAG: ${{ steps.changes.outputs.images == 'true' && github.sha || 'latest' }}
ERPC_IMAGE_TAG: ${{ steps.changes.outputs.erpc == 'true' && github.sha || 'latest' }}
PONDER_IMAGE_TAG: ${{ steps.changes.outputs.ponder == 'true' && github.sha || 'latest' }}
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ Both services are deployed as containerized applications on AWS ECS (Elastic Con
This project uses SST for infrastructure deployment. To deploy:

1. Ensure you have AWS credentials configured.
2. Install dependencies: `npm install`
3. Deploy the stack: `npx sst deploy --stage prod`

(Add more detailed deployment instructions if necessary)
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

Expand Down
9 changes: 7 additions & 2 deletions iac/Indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,12 @@ function addErpcService({
const cdkSecretsMap = buildSecretsMap({ stack, secrets, name: "erpc" });

// Get the container props of our prebuilt binaries
const erpcImage = getImageFromName({ stack, app, name: "erpc" });
const erpcImage = getImageFromName({
stack,
app,
name: "erpc",
tag: process.env.ERPC_IMAGE_TAG,
});

// The service itself
const erpcService = new Service(stack, "ErpcService", {
Expand Down Expand Up @@ -284,7 +289,7 @@ function addIndexerService({
const cdkSecretsMap = buildSecretsMap({ stack, secrets, name: "indexer" });

// Get the container props of our prebuilt binaries
const indexerImage = getImageFromName({ stack, app, name: "indexer" });
const indexerImage = getImageFromName({ stack, app, name: "indexer", , tag: process.env.PONDER_IMAGE_TAG });

// The service itself
const indexerService = new Service(stack, "IndexerService", {
Expand Down
5 changes: 3 additions & 2 deletions iac/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export function getImageFromName({
stack,
app,
name,
}: { stack: Stack; app: App; name: string }) {
tag,
}: { stack: Stack; app: App; name: string; tag?: string }) {
// Get the container props of our prebuilt binaries
const containerRegistry = Repository.fromRepositoryAttributes(
stack,
Expand All @@ -24,7 +25,7 @@ export function getImageFromName({
}
);

const imageTag = process.env.IMAGE_TAG ?? "latest";
const imageTag = tag ?? "latest";
console.log(`Will use the image ${imageTag}`);
return ContainerImage.fromEcrRepository(containerRegistry, imageTag);
}
Expand Down
12 changes: 2 additions & 10 deletions packages/erpc/erpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ projects:
endpoint: alchemy://${ALCHEMY_API_KEY}
type: evm-alchemy
rateLimitBudget: alchemy
healthCheckGroup: default-hcg
failsafe:
timeout:
duration: 15s
Expand All @@ -68,12 +67,5 @@ rateLimiters:
- id: alchemy
rules:
- method: "*"
maxCount: 200
period: 1s
healthChecks:
groups:
- id: slow-hcg
checkInterval: 600s
maxErrorRatePercent: 10
maxP90LatencyMs: 5s
maxBlocksBehind: 5
maxCount: 300
period: 1s

0 comments on commit 3ef6401

Please sign in to comment.