Skip to content

Conversation

@leoisadev8
Copy link
Member

Summary

  • default Electric HTTP port to 3000 across docker-compose and env example so services match the 1.1.x listener
  • keep server/web pointing at 3000 internally to avoid connection refusals in Dokploy setups

Testing

  • docker compose config (manual)
  • verified defaults now resolve to port 3000

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Greptile Summary

This PR fixes a port mismatch between ElectricSQL's 1.1.x default listener port (3000) and the configuration values used in docker-compose and environment templates. The change updates ELECTRIC_HTTP_PORT, ELECTRIC__HTTP__PORT, ELECTRIC_SERVICE_URL, and related environment variables from 3010 to 3000across docker-compose.yml and env.example. This alignment is critical for Dokploy deployments where the server and web apps connect to Electric's sync endpoint—when ports mismatch, connection attempts fail. The fix ensures that all port references in environment defaults, service URLs, and build arguments consistently point to 3000, matching the actual runtime listener of ElectricSQL 1.1.x.

Changed Files
Filename Score Overview
docker-compose.yml 1/5 Updated Electric HTTP port from 3010 to 3000 in environment variables and build args, but line 54's expose directive still defaults to 3010, creating a critical port mismatch
env.example 4/5 Updated Electric HTTP port defaults from 3010 to 3000 across ELECTRIC_HTTP_PORT, ELECTRIC__HTTP__PORT, and ELECTRIC_SERVICE_URL to align with Electric 1.1.x

Confidence score: 1/5

  • This PR has a critical port mismatch bug that will cause immediate connection failures in Docker deployments
  • Score reflects one blocking issue in docker-compose.yml: line 54's expose directive still defaults to 3010while the service now listens on 3000, which will prevent the server and web apps from reaching ElectricSQL
  • docker-compose.yml requires immediate attention—specifically line 54 where the expose directive must be changed from ${ELECTRIC_HTTP_PORT:-3010} to ${ELECTRIC_HTTP_PORT:-3000}

Issues Identified (as requested)

Issue 1: Port Exposure Mismatch in docker-compose.yml (line 54)

  • Severity Score: 5/5 (critical, will cause immediate failure)
  • Location: docker-compose.yml, line 54
  • Problem: The expose directive defaults to 3010 (${ELECTRIC_HTTP_PORT:-3010}) while the ElectricSQL service now listens on port 3000 (lines 47-48). This creates a port mismatch where Docker exposes port 3010 to other containers, but Electric is bound to 3000.
  • Impact: Server and web containers attempting to connect to openchat-electric:3010 will fail with connection refused errors because nothing is listening on that port.
  • Fix: Change line 54 to - "${ELECTRIC_HTTP_PORT:-3000}"
  • Confidence this is correct: 5/5—this is a definite bug that will break multi-container deployments

Sequence Diagram

sequenceDiagram
    participant DevOps as "DevOps/Developer"
    participant Docker as "Docker Compose"
    participant Postgres as "Postgres Container"
    participant Electric as "Electric Container"
    participant Server as "Server Container"
    participant Web as "Web Container"

    DevOps->>Docker: "docker compose up"
    Docker->>Docker: "Read docker-compose.yml"
    Docker->>Docker: "Parse ELECTRIC_HTTP_PORT=${ELECTRIC_HTTP_PORT:-3000}"
    
    Docker->>Postgres: "Start postgres service"
    Postgres->>Postgres: "Initialize with wal_level=logical"
    Postgres->>Postgres: "Run postgres-init scripts"
    Postgres->>Docker: "Healthcheck passes"
    
    Docker->>Electric: "Start electric service"
    Electric->>Electric: "Set ELECTRIC_HTTP_PORT=3000 (default)"
    Electric->>Electric: "Set ELECTRIC__HTTP__PORT=3000 (default)"
    Electric->>Electric: "Listen on port 3000"
    Electric->>Postgres: "Connect for logical replication"
    
    Docker->>Server: "Start server service"
    Server->>Server: "Set ELECTRIC_SERVICE_URL=http://openchat-electric:3000"
    Server->>Server: "Set NEXT_PUBLIC_ELECTRIC_URL=http://openchat-electric:3000"
    Server->>Postgres: "Wait for DB, run migrations"
    Server->>Electric: "Connect to Electric on port 3000"
    Server->>Server: "Start Elysia API on port 3000"
    
    Docker->>Web: "Start web service"
    Web->>Web: "Build with NEXT_PUBLIC_ELECTRIC_URL=http://openchat-electric:3000"
    Web->>Web: "Set NEXT_PUBLIC_SERVER_URL=http://openchat-server:3000"
    Web->>Server: "Connect to server on port 3000"
    Web->>Electric: "Connect to Electric on port 3000"
    Web->>Web: "Start Next.js on port 3001"
    
    DevOps->>Web: "Access application"
    Web->>Server: "API requests to port 3000"
    Server->>Electric: "Sync requests to port 3000"
    Electric->>Postgres: "Replicate data changes"
Loading

Additional Comments (1)

  1. docker-compose.yml, line 54 (link)

    logic: Port mismatch (score: 5/5 for correctness): expose still references the old 3010 default. This must be updated to 3000 to match lines 47-48.

Context used:

  • Context from dashboard - AGENTS.md (source)

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@leoisadev8 leoisadev8 merged commit b0a2d12 into main Oct 19, 2025
4 checks passed
@leoisadev8 leoisadev8 deleted the fix/electric-port-3000 branch November 2, 2025 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants