Skip to content

Commit

Permalink
🗃️ Retest erpc no cache
Browse files Browse the repository at this point in the history
  • Loading branch information
KONFeature committed Aug 23, 2024
1 parent c5e227c commit c387b0f
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 83 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ jobs:
list-files: 'shell'
filters: |
erpc:
- 'packages/erpc/**'
- 'packages/erpc/erpc.yaml'
- 'packages/erpc/Dockerfile'
ponder:
- 'packages/ponder/**'
Expand Down
118 changes: 57 additions & 61 deletions iac/Indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type PonderInstanceConfig =
*/
const ponderInstanceTypeConfig = {
indexing: {
suffix: "Indexing",
suffix: "Indexer",
port: 42069,
entryPoint: [
"pnpm",
Expand All @@ -63,7 +63,7 @@ const ponderInstanceTypeConfig = {
},
},
serving: {
suffix: "Serving",
suffix: "IndexerServing",
port: 42068,
entryPoint: [
"pnpm",
Expand Down Expand Up @@ -390,8 +390,8 @@ function addIndexerService({
instanceType: PonderInstanceConfig;
}) {
// All the secrets env variable we will be using (in local you can just use a .env file)
const { ponderDb, ponderRpcSecret } = use(ConfigStack);
const secrets = [ponderDb, ponderRpcSecret];
const { rpcSecrets, ponderDb, ponderRpcSecret } = use(ConfigStack);
const secrets = [...rpcSecrets, ponderDb, ponderRpcSecret];

// Get our CDK secrets map
const cdkSecretsMap = buildSecretsMap({ stack, secrets, name: "indexer" });
Expand All @@ -405,65 +405,61 @@ function addIndexerService({
});

// The service itself
const indexerService = new Service(
stack,
`Indexer${instanceType.suffix}Service`,
{
path: "packages/ponder",
// SST not happy, can't connect to ECR to fetch the instance during the build process
// file: "Dockerfile.prebuilt",
port: instanceType.port,
// Domain mapping
// todo: could probably be deleted since we are building it before
customDomain: {
domainName: "indexer.frak.id",
hostedZone: "frak.id",
},
// Setup some capacity options
scaling: instanceType.scaling,
// Bind the secret we will be using
bind: secrets,
// Arm architecture (lower cost)
architecture: "arm64",
// Hardware config
cpu: "1 vCPU",
memory: "2 GB",
storage: "30 GB",
// Log retention
logRetention: "one_week",
// Set the right environment variables
environment: {
// Ponder related stuff
PONDER_LOG_LEVEL: "debug",
// Erpc external endpoint
ERPC_EXTERNAL_URL: "https://indexer.frak.id/ponder-rpc/evm",
},
cdk: {
vpc,
cluster,
// Don't auto setup the ALB since we will be using the one from the indexer service
// todo: setup the ALB after the indexer service is deployed
applicationLoadBalancer: false,
// Customise fargate service to enable circuit breaker (if the new deployment is failing)
fargateService: {
enableExecuteCommand: true,
circuitBreaker: {
enable: true,
},
// Increase health check grace period
healthCheckGracePeriod: Duration.seconds(120),
...instanceType.fargateService,
},
// Directly specify the image position in the registry here
container: {
containerName: "indexer",
image: indexerImage,
secrets: cdkSecretsMap,
entryPoint: instanceType.entryPoint,
const indexerService = new Service(stack, `${instanceType.suffix}Service`, {
path: "packages/ponder",
// SST not happy, can't connect to ECR to fetch the instance during the build process
// file: "Dockerfile.prebuilt",
port: instanceType.port,
// Domain mapping
// todo: could probably be deleted since we are building it before
customDomain: {
domainName: "indexer.frak.id",
hostedZone: "frak.id",
},
// Setup some capacity options
scaling: instanceType.scaling,
// Bind the secret we will be using
bind: secrets,
// Arm architecture (lower cost)
architecture: "arm64",
// Hardware config
cpu: "1 vCPU",
memory: "2 GB",
storage: "30 GB",
// Log retention
logRetention: "one_week",
// Set the right environment variables
environment: {
// Ponder related stuff
PONDER_LOG_LEVEL: "debug",
// Erpc external endpoint
ERPC_EXTERNAL_URL: "https://indexer.frak.id/ponder-rpc/evm",
},
cdk: {
vpc,
cluster,
// Don't auto setup the ALB since we will be using the one from the indexer service
// todo: setup the ALB after the indexer service is deployed
applicationLoadBalancer: false,
// Customise fargate service to enable circuit breaker (if the new deployment is failing)
fargateService: {
enableExecuteCommand: true,
circuitBreaker: {
enable: true,
},
// Increase health check grace period
healthCheckGracePeriod: Duration.seconds(120),
...instanceType.fargateService,
},
}
);
// Directly specify the image position in the registry here
container: {
containerName: "indexer",
image: indexerImage,
secrets: cdkSecretsMap,
entryPoint: instanceType.entryPoint,
},
},
});

stack.addOutputs({
indexerServiceId: indexerService.id,
Expand Down
23 changes: 9 additions & 14 deletions packages/erpc/erpc-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,20 +159,15 @@ const nexusProject: ProjectConfig = buildProject({
// Build the global config
const config: Config = {
logLevel: envVariable("ERPC_LOG_LEVEL"),
database: {
evmJsonRpcCache: {
driver: "postgresql",
postgresql: {
connectionUri: envVariable("ERPC_DATABASE_URL"),
table: "rpc_cache",
},
// No cache test
// driver: "memory",
// memory: {
// maxItems: 1,
// },
},
},
// database: {
// evmJsonRpcCache: {
// driver: "postgresql",
// postgresql: {
// connectionUri: envVariable("ERPC_DATABASE_URL"),
// table: "rpc_cache",
// },
// },
// },
server: {
httpHost: "0.0.0.0",
httpPort: 8080,
Expand Down
6 changes: 0 additions & 6 deletions packages/erpc/erpc.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
# Config generated using: https://github.com/KONFeature/erpc-config-generator
logLevel: ${ERPC_LOG_LEVEL}
database:
evmJsonRpcCache:
driver: postgresql
postgresql:
connectionUri: ${ERPC_DATABASE_URL}
table: rpc_cache
server:
httpHost: 0.0.0.0
httpPort: 8080
Expand Down
8 changes: 7 additions & 1 deletion packages/ponder/ponder.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ function getTransport(chainId: number) {
`${erpcUrl}/${chainId}?token=${process.env.PONDER_RPC_SECRET}`
);

return fallback([envioTransport, erpcTransport]);
return fallback([
erpcTransport,
http(
`https://arb-sepolia.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY}`
),
envioTransport,
]);
}

/**
Expand Down

0 comments on commit c387b0f

Please sign in to comment.