Skip to content

Commit 320b0cc

Browse files
amish kohliamish kohli
authored andcommitted
fixes indexer
1 parent a1299c0 commit 320b0cc

File tree

6 files changed

+27
-46
lines changed

6 files changed

+27
-46
lines changed

.github/workflows/aws.yml

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,17 @@
1-
# This workflow will build and push a new container image to Amazon ECR,
2-
# and then will deploy a new task definition to Amazon ECS, when there is a push to the "main" branch.
3-
#
4-
# To use this workflow, you will need to complete the following set-up steps:
5-
#
6-
# 1. Create an ECR repository to store your images.
7-
# For example: `aws ecr create-repository --repository-name my-ecr-repo --region us-east-2`.
8-
# Replace the value of the `ECR_REPOSITORY` environment variable in the workflow below with your repository's name.
9-
# Replace the value of the `AWS_REGION` environment variable in the workflow below with your repository's region.
10-
#
11-
# 2. Create an ECS task definition, an ECS cluster, and an ECS service.
12-
# For example, follow the Getting Started guide on the ECS console:
13-
# https://us-east-2.console.aws.amazon.com/ecs/home?region=us-east-2#/firstRun
14-
# Replace the value of the `ECS_SERVICE` environment variable in the workflow below with the name you set for the Amazon ECS service.
15-
# Replace the value of the `ECS_CLUSTER` environment variable in the workflow below with the name you set for the cluster.
16-
#
17-
# 3. Store your ECS task definition as a JSON file in your repository.
18-
# The format should follow the output of `aws ecs register-task-definition --generate-cli-skeleton`.
19-
# Replace the value of the `ECS_TASK_DEFINITION` environment variable in the workflow below with the path to the JSON file.
20-
# Replace the value of the `CONTAINER_NAME` environment variable in the workflow below with the name of the container
21-
# in the `containerDefinitions` section of the task definition.
22-
#
23-
# 4. Store an IAM user access key in GitHub Actions secrets named `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`.
24-
# See the documentation for each action used below for the recommended IAM policies for this IAM user,
25-
# and best practices on handling the access key credentials.
26-
271
name: Deploy to Amazon ECS
282

293
on:
304
push:
315
branches: [ "main" ]
326

337
env:
34-
AWS_REGION: MY_AWS_REGION # set this to your preferred AWS region, e.g. us-west-1
35-
ECR_REPOSITORY: MY_ECR_REPOSITORY # set this to your Amazon ECR repository name
36-
ECS_SERVICE: MY_ECS_SERVICE # set this to your Amazon ECS service name
37-
ECS_CLUSTER: MY_ECS_CLUSTER # set this to your Amazon ECS cluster name
38-
ECS_TASK_DEFINITION: MY_ECS_TASK_DEFINITION # set this to the path to your Amazon ECS task definition
39-
# file, e.g. .aws/task-definition.json
40-
CONTAINER_NAME: MY_CONTAINER_NAME # set this to the name of the container in the
41-
# containerDefinitions section of your task definition
8+
AWS_REGION: us-east-1
9+
ECR_REPOSITORY: ponder/indexer
10+
ECS_SERVICE: ponder-indexer
11+
ECS_CLUSTER: ponder-cluster
12+
ECS_TASK_DEFINITION: ponder-task-definition
13+
CONTAINER_NAME: indexer
14+
4215

4316
permissions:
4417
contents: read
@@ -64,18 +37,23 @@ jobs:
6437
id: login-ecr
6538
uses: aws-actions/amazon-ecr-login@v1
6639

40+
- name: Set up .env file
41+
run: |
42+
echo "SUPABASE_URL=${{ secrets.SUPABASE_URL }}" > .env
43+
echo "SUPABASE_ANON_KEY=${{ secrets.SUPABASE_ANON_KEY }}" >> .env
44+
6745
- name: Build, tag, and push image to Amazon ECR
6846
id: build-image
6947
env:
70-
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
7148
IMAGE_TAG: ${{ github.sha }}
7249
run: |
7350
# Build a docker container and
7451
# push it to ECR so that it can
7552
# be deployed to ECS.
76-
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
77-
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
78-
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
53+
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 058264122535.dkr.ecr.us-east-1.amazonaws.com
54+
docker build -t ponder/indexer .
55+
docker tag ponder/indexer:latest 058264122535.dkr.ecr.us-east-1.amazonaws.com/ponder/indexer:latest
56+
docker push 058264122535.dkr.ecr.us-east-1.amazonaws.com/ponder/indexer:latest
7957
8058
- name: Fill in the new image ID in the Amazon ECS task definition
8159
id: task-def

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ yarn-error.log*
1212

1313
# Env files
1414
.env*.local
15+
.env
1516

1617
# Ponder
1718
/generated/

Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Use the official Node.js image as a parent image
2-
FROM node:18
1+
# Use a more compatible image for cross-platform support
2+
FROM node:18-bullseye-slim
33

44
# Set the working directory
55
WORKDIR /app
@@ -14,7 +14,10 @@ RUN npm install
1414
COPY . .
1515

1616
# Expose the port the app runs on
17+
18+
19+
# Expose ports
1720
EXPOSE 3000
1821

1922
# Run the application
20-
CMD ["npm", "run", "dev"]
23+
CMD ["npm", "run", "ponder"]

ponder.schema.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ export const rewardAccrued = onchainTable("reward_accrued", (p) => ({
77
user: p.hex().notNull(),
88
reward: p.bigint().notNull(),
99
timestamp: p.integer().notNull(),
10-
chain: p.text().notNull(),
1110
}));

src/api/server.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import dotenv from 'dotenv';
55
dotenv.config();
66

77
const app = express();
8-
const port = process.env.PORT || 3000;
8+
const port = process.env.API_PORT || 3000;
99

1010
// Initialize Supabase client
11-
const supabaseUrl = process.env.SUPABASE_URL! || "https://uoagtjstsdrjypxlkuzr.supabase.co";
12-
const supabaseKey = process.env.SUPABASE_KEY! || "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InVvYWd0anN0c2RyanlweGxrdXpyIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTcwNzkwMTYxNywiZXhwIjoyMDIzNDc3NjE3fQ.s-VlvrdGIjLAwI4-4ZMDcGmAh3zCVmSCjvP2vEW1K-w"
11+
const supabaseUrl = process.env.SUPABASE_URL! || "";
12+
const supabaseKey = process.env.SUPABASE_ANON_KEY! || ""
1313
const supabase = createClient(supabaseUrl, supabaseKey);
1414

1515

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { v4 as uuidv4 } from 'uuid';
55
// Supabase Client Initialization
66
const supabase = createClient(
77
process.env.SUPABASE_URL || "",
8-
process.env.SUPABASE_KEY || ""
8+
process.env.SUPABASE_ANON_KEY || ""
99
);
1010

1111
// Utility to sanitize BigInt fields

0 commit comments

Comments
 (0)