Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: clarified Redis connection errors and added Redis dependency to docker-compose files #278

Merged
merged 6 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions examples/postgres-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: '3.7'

x-common-variables: &common-variables
CHAIN_ID: mainnet
REDIS_URL: redis://redis:6379/
DATABASE_URL: postgres:5432
DATABASE_USER: postgres
DATABASE_PASSWORD: password
Expand Down Expand Up @@ -29,6 +30,7 @@ services:
- 8000:8000
depends_on:
- postgres
- redis
restart: on-failure

state-indexer:
Expand All @@ -45,6 +47,7 @@ services:
- 8080:8080
depends_on:
- postgres
- redis
restart: on-failure

tx-indexer:
Expand All @@ -61,6 +64,7 @@ services:
- 8081:8081
depends_on:
- postgres
- redis
restart: on-failure

postgres:
Expand All @@ -72,3 +76,9 @@ services:
POSTGRES_PASSWORD: password
ports:
- 5432:5432

redis:
image: redis/redis-stack-server:latest
restart: always
ports:
- 6379:6379
12 changes: 11 additions & 1 deletion examples/rightsizing-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: '3.7'

x-common-variables: &common-variables
CHAIN_ID: mainnet
REDIS_URL: redis://redis:6379/
DATABASE_URL: postgres:5432
DATABASE_USER: postgres
DATABASE_PASSWORD: password
Expand Down Expand Up @@ -31,6 +32,7 @@ services:
- 8000:8000
depends_on:
- postgres
- redis

state-indexer:
build:
Expand All @@ -46,6 +48,7 @@ services:
- 8080:8080
depends_on:
- postgres
- redis
restart: on-failure

tx-indexer:
Expand All @@ -57,12 +60,12 @@ services:
environment:
<<: *common-variables
TX_INDEXER_ID: tx-indexer-local

command: [ "from-interruption" ]
ports:
- 8081:8081
depends_on:
- postgres
- redis
restart: on-failure

postgres:
Expand All @@ -74,3 +77,10 @@ services:
POSTGRES_PASSWORD: password
ports:
- 5432:5432

redis:
image: redis/redis-stack-server:latest
container_name: redis-stack-server
ports:
- 6379:6379
restart: always
7 changes: 6 additions & 1 deletion rpc-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,14 @@ async fn main() -> anyhow::Result<()> {
let blocks_info_by_finality_clone =
std::sync::Arc::clone(&server_context.blocks_info_by_finality);
let near_rpc_client_clone = near_rpc_client.clone();

let redis_client = redis::Client::open(rpc_server_config.general.redis_url.clone())?
.get_connection_manager()
.await?;
.await
.map_err(|err| {
tracing::error!("Failed to connect to Redis: {:?}", err);
err
})?;
let redis_client_clone = redis_client.clone();

// We need to update final block from Redis and Lake
Expand Down
Loading