From f89c56869876c6100952739590734dc19195520a Mon Sep 17 00:00:00 2001 From: 0xkenj1 Date: Thu, 7 Nov 2024 16:09:39 -0300 Subject: [PATCH] fix: pr comments --- .env.example | 47 ++++++++++++++++++++++++----------- README.md | 18 +++++++++++--- apps/processing/.dockerignore | 5 ---- apps/processing/.env.example | 18 +++++++------- apps/processing/Dockerfile | 11 -------- apps/scripts/.env.example | 2 ++ docker-compose.yaml | 2 +- 7 files changed, 60 insertions(+), 43 deletions(-) delete mode 100644 apps/processing/.dockerignore delete mode 100644 apps/processing/Dockerfile create mode 100644 apps/scripts/.env.example diff --git a/.env.example b/.env.example index a07966b..e75f95b 100644 --- a/.env.example +++ b/.env.example @@ -3,25 +3,23 @@ ###################################################### DATALAYER_POSTGRES_PASSWORD=testing DATALAYER_PG_USER=postgres -DATALAYER_PG_DATABASE=datalayer-postgres +DATALAYER_PG_DATABASE=datalayer-postgres-db DATALAYER_POSTGRES_EXPOSED_PORT=5434 ###################################################### ############### DATALAYER HASURA API ################# ###################################################### -#for reference on Hasura configuration, see: https://hasura.io/docs/2.0/deployment/graphql-engine-flags/reference/ DATALAYER_HASURA_EXPOSED_PORT=8082 -DATALAYER_HASURA_ENABLE_CONSOLE=true -DATALAYER_HASURA_ADMIN_SECRET=my-admin-secret -DATALAYER_HASURA_UNAUTHORIZED_ROLE=public +DATALAYER_HASURA_ENABLE_CONSOLE="true" +DATALAYER_HASURA_ADMIN_SECRET="my-admin-secret" +DATALAYER_HASURA_UNAUTHORIZED_ROLE="public" DATALAYER_HASURA_CORS_DOMAIN=* -DATALAYER_HASURA_ENABLE_TELEMETRY=false -# HASURA_GRAPHQL_METADATA_DATABASE_EXTENSIONS_SCHEMA: "chain_data_schema_1" +DATALAYER_HASURA_ENABLE_TELEMETRY="false" ## enable debugging mode. It is recommended to disable this in production -DATALAYER_HASURA_DEV_MODE=true -DATALAYER_HASURA_ADMIN_INTERNAL_ERRORS=true +DATALAYER_HASURA_DEV_MODE="true" +DATALAYER_HASURA_ADMIN_INTERNAL_ERRORS="true" ## uncomment next line to run console offline (i.e load console assets from server instead of CDN) -# HASURA_GRAPHQL_CONSOLE_ASSETS_DIR: /srv/console-assets +# DATALAYER_HASURA_CONSOLE_ASSETS_DIR="/srv/console-assets" ############################################################ ############### ENVIO POSTGRES & INDEXER ################### @@ -38,20 +36,41 @@ ENVIO_POSTGRES_EXPOSED_PORT=5433 ############################################ ############### INDEXER #################### ############################################ -ENVIO_PG_HOST=envio-postgres +ENVIO_PG_HOST=indexer-postgres-db ENVIO_PG_PORT=5432 -HASURA_GRAPHQL_ENDPOINT=http://graphql-engine:8080/v1/metadata +HASURA_GRAPHQL_ENDPOINT=http://indexer-graphql-api:8080/v1/metadata TUI_OFF=true ############################################ ############### HASURA ##################### ############################################ HASURA_EXPOSED_PORT=8080 -HASURA_GRAPHQL_DATABASE_URL=postgres://postgres:testing@envio-postgres:5432/envio-dev +HASURA_GRAPHQL_DATABASE_URL=postgres://postgres:testing@indexer-postgres-db:5432/envio-dev HASURA_GRAPHQL_ENABLE_CONSOLE=true HASURA_GRAPHQL_ENABLED_LOG_TYPES=startup, http-log, webhook-log, websocket-log, query-log HASURA_GRAPHQL_NO_OF_RETRIES=10 HASURA_GRAPHQL_ADMIN_SECRET=testing HASURA_GRAPHQL_STRINGIFY_NUMERIC_TYPES="true" PORT=8080 -HASURA_GRAPHQL_UNAUTHORIZED_ROLE=public \ No newline at end of file +HASURA_GRAPHQL_UNAUTHORIZED_ROLE=public + +############################################ +############### PROCESSING ################# +############################################ + +RPC_URLS=["https://optimism.llamarpc.com","https://rpc.ankr.com/optimism","https://optimism.gateway.tenderly.co","https://optimism.blockpi.network/v1/rpc/public","https://mainnet.optimism.io","https://opt-mainnet.g.alchemy.com/v2/demo"] +CHAIN_ID=10 + +FETCH_LIMIT=1000 +FETCH_DELAY_MS=3000 + +DATABASE_URL=postgresql://postgres:testing@datalayer-postgres-db:5432/datalayer-postgres-db +DATABASE_SCHEMA=chain_data_schema_1 + +INDEXER_GRAPHQL_URL=http://indexer-graphql-api:8080/v1/graphql +INDEXER_ADMIN_SECRET=testing + +IPFS_GATEWAYS_URL=["https://ipfs.io","https://gateway.pinata.cloud","https://dweb.link", "https://ipfs.eth.aragon.network"] + +COINGECKO_API_KEY=CG-WPGoHFCHyzGHcyFkigiVgetT +COINGECKO_API_TYPE=demo \ No newline at end of file diff --git a/README.md b/README.md index 12a6f8b..9e90a49 100644 --- a/README.md +++ b/README.md @@ -21,19 +21,31 @@ Ensure you have the following installed on your machine: ### Setup -1. Build and start the services in detached mode: +1. Copy the Example Environment File and edit the `.env` file + +``` +cp .env.example .env +``` + +2. Build and start the services in detached mode: ``` docker-compose up -d --build ``` -2. After starting Docker Compose, run the following command to apply the database migrations: +3. Copy the Example Environment File on `apps/migration-scripts` and edit the `.env` file + +``` +cp apps/migration-scripts/.env.example apps/migration-scripts/.env +``` + +4. After starting Docker Compose, run the following command to apply the database migrations: ``` pnpm script:db:migrate ``` -3. Navigate to the processing service directory and start it with: +5. Navigate to the processing service directory and start it with: ``` cd apps/processing && pnpm dev diff --git a/apps/processing/.dockerignore b/apps/processing/.dockerignore deleted file mode 100644 index 3b00024..0000000 --- a/apps/processing/.dockerignore +++ /dev/null @@ -1,5 +0,0 @@ -node_modules -.git -.gitignore -*.md -generated \ No newline at end of file diff --git a/apps/processing/.env.example b/apps/processing/.env.example index 362d2e1..5f18d04 100644 --- a/apps/processing/.env.example +++ b/apps/processing/.env.example @@ -1,17 +1,17 @@ -# configuration for Optimism RPC_URLS=["https://optimism.llamarpc.com","https://rpc.ankr.com/optimism","https://optimism.gateway.tenderly.co","https://optimism.blockpi.network/v1/rpc/public","https://mainnet.optimism.io","https://opt-mainnet.g.alchemy.com/v2/demo"] CHAIN_ID=10 +LOG_LEVEL=debug -FETCH_LIMIT=500 -FETCH_DELAY_MS=3000 +FETCH_LIMIT=10000 +FETCH_DELAY_MS=30000 -DATABASE_URL= -DATABASE_SCHEMA=chainDataSchema +DATABASE_URL=postgresql://postgres:testing@localhost:5434/datalayer-postgres-db +DATABASE_SCHEMA=chain_data_schema_1 -INDEXER_GRAPHQL_URL= -INDEXER_ADMIN_SECRET= +INDEXER_GRAPHQL_URL=http://localhost:8080/v1/graphql +INDEXER_ADMIN_SECRET=testing IPFS_GATEWAYS_URL=["https://ipfs.io","https://gateway.pinata.cloud","https://dweb.link", "https://ipfs.eth.aragon.network"] -COINGECKO_API_KEY= -COINGECKO_API_TYPE= #demo or pro \ No newline at end of file +COINGECKO_API_KEY=CG-WPGoHFCHyzGHcyFkigiVgetT +COINGECKO_API_TYPE=demo \ No newline at end of file diff --git a/apps/processing/Dockerfile b/apps/processing/Dockerfile deleted file mode 100644 index c6d3060..0000000 --- a/apps/processing/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM node:20-slim AS base -ENV PNPM_HOME="/pnpm" -ENV PATH="$PNPM_HOME:$PATH" -RUN corepack enable -COPY . /app -WORKDIR /app - -RUN --mount=type=cache,id=pnpm,target=$PNPM_HOME/store pnpm install --frozen-lockfile -RUN pnpm dlx envio codegen - -CMD pnpm dlx envio local db-migrate up && pnpm dlx envio start \ No newline at end of file diff --git a/apps/scripts/.env.example b/apps/scripts/.env.example new file mode 100644 index 0000000..5c4038a --- /dev/null +++ b/apps/scripts/.env.example @@ -0,0 +1,2 @@ +DATABASE_URL=postgres://postgres:testing@localhost:5434/datalayer-postgres-db +DATABASE_SCHEMA=chain_data_schema_1 \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 69a557b..6cc2754 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -68,7 +68,7 @@ services: POSTGRES_USER: ${ENVIO_PG_USER} POSTGRES_PASSWORD: ${ENVIO_POSTGRES_PASSWORD} healthcheck: - test: ["CMD-SHELL", "pg_isready -U ${DATALAYER_PG_USER}"] + test: ["CMD-SHELL", "pg_isready -U ${ENVIO_PG_USER}"] interval: 5s timeout: 5s retries: 5