Skip to content

simulator-database-migration:latest — alembic.ini appears to hardcode localhost, migration container exits 1 on fresh genlayer up #1698

Description

@theboyplunger0x

Summary

The yeagerai/simulator-database-migration:latest image fails to boot when genlayer up --headless --numValidators 5 is run on a fresh install. The migration container exits with code 1 because its alembic configuration appears to hardcode sqlalchemy.url to localhost instead of reading DB_URL from the environment. In the docker-compose network, postgres is a service alias — not reachable at localhost from another container.

Repro

Fresh install, macOS on Apple Silicon, Docker Desktop 29.6.1, GenLayer CLI v0.39.2:

genlayer up --headless --numValidators 5

Observed

Containers after boot attempt:

  • genlayer-postgres-1 — starts healthy on 5432 ✅
  • genlayer-hardhat-1 / genlayer-webdriver-1 — healthy ✅
  • genlayer-database-migration-1 — starts, then exits with code 1 ❌
  • genlayer-jsonrpc-1 — stays in Created state (depends on migration completing) ❌
  • Port 4000 never bound → RPC unreachable → CLI eventually prints "Unable to initialize the GenLayer simulator"

Migration container logs (verbatim tail):

Running migrations online
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError)
  connection to server at "localhost" (::1), port 5432 failed: Connection refused
  connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused

Root cause

The migration container's DB_URL env is correctly set to a value pointing at the docker service name postgres, and postgres is reachable at postgres:5432 from the same genlayer_default network (verified via docker inspect). But alembic attempts to connect to localhost:5432 inside the migration container's own namespace, where nothing is listening, so it errors with Connection refused.

The most likely cause is that alembic.ini inside the image hardcodes sqlalchemy.url = ...@localhost/... and env.py doesn't override it with DB_URL.

Fix suggestions

Either:

  • Update env.py to override the URL at runtime: config.set_main_option("sqlalchemy.url", os.environ["DB_URL"]) before running migrations
  • Or publish an updated alembic.ini that uses the service alias (postgres) as the default host

Environment

  • macOS 14 (Darwin 24.6.0), Apple Silicon
  • Docker Desktop 29.6.1
  • GenLayer CLI v0.39.2
  • Image: yeagerai/simulator-database-migration:latest (pulled 2026-07-01)

Impact

Blocks fresh genlayer up on macOS across our lab environment. Workarounds (patching the running container, docker exec overrides) are brittle for CI/dev use.

Happy to test a fix if you have a candidate tag.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions