Skip to content

Postgres Migration not working - database is empty #1634

@Poschinski

Description

@Poschinski

Hi,
i am trying to host bracket in production using docker as it is described here.

This is what my configuration looks like:

services:
  bracket-frontend:
    image: ghcr.io/evroon/bracket-frontend
    container_name: bracket-frontend
    environment:
      NODE_ENV: "production"
      VITE_API_BASE_URL: "https://bracket-api.my-domain.de"
    networks:
      - proxy
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=proxy"
      - "traefik.http.routers.bracket-fe.rule=Host(`bracket.my-domain.de`)"
      - "traefik.http.routers.bracket-fe.entrypoints=websecure"
      - "traefik.http.routers.bracket-fe.tls.certresolver=letsencrypt"
      - "traefik.http.services.bracket-fe.loadbalancer.server.port=3000"
    restart: unless-stopped

  bracket-backend:
    image: ghcr.io/evroon/bracket-backend
    container_name: bracket-backend
    environment:
      ENVIRONMENT: "PRODUCTION"
      PG_DSN: "postgresql://user:password@postgres:5432/bracket_prod"
      CORS_ORIGINS: "https://bracket.my-domain.de"
      JWT_SECRET: "mysecret..."
    volumes:
      - ./backend/static:/app/static
    networks:
      - proxy
      - bracket_lan
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=proxy"
      - "traefik.http.routers.bracket-api.rule=Host(`bracket-api.my-domain.de`)"
      - "traefik.http.routers.bracket-api.entrypoints=websecure"
      - "traefik.http.routers.bracket-api.tls.certresolver=letsencrypt"
      - "traefik.http.services.bracket-api.loadbalancer.server.port=8400"
    restart: unless-stopped
    depends_on:
      - postgres

  postgres:
    image: postgres
    restart: always
    environment:
      POSTGRES_DB: bracket_prod
      POSTGRES_USER: user
      POSTGRES_PASSWORD: password
    volumes:
      - ./postgres:/var/lib/postgresql
    networks:
      - bracket_lan

networks:
  proxy:
    external: true
  bracket_lan:
    driver: bridge

The frontend and the postgres instance are starting with no errors.

When the backend is starting up, is says it starts the migrations - but this leads to an error and the backend container is restarting.

Here is a part of the logs from the backend and the database:

bracket-backend   | [2026-04-04 14:44:32,454] [bracket] [INFO] Current env: PRODUCTION
bracket-backend   | [2026-04-04 14:44:37 +0000] [18] [INFO] Started server process [18]
bracket-backend   | [2026-04-04 14:44:37 +0000] [18] [INFO] Waiting for application startup.
bracket-backend   | [2026-04-04 14:44:38,398] [bracket] [INFO] Running migrations
postgres-1        | 2026-04-04 14:44:38.589 UTC [87] ERROR:  index "ix_users_email" does not exist
postgres-1        | 2026-04-04 14:44:38.589 UTC [87] STATEMENT:
postgres-1        |     DROP INDEX ix_users_email
bracket-backend   | [2026-04-04 14:44:38 +0000] [18] [ERROR] Traceback (most recent call last):
bracket-backend   |   File "/app/.venv/lib/python3.14/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
bracket-backend   |     self.dialect.do_execute(
bracket-backend   |     ~~~~~~~~~~~~~~~~~~~~~~~^
bracket-backend   |         cursor, str_statement, effective_parameters, context
bracket-backend   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
bracket-backend   |     )
bracket-backend   |     ^
bracket-backend   |   File "/app/.venv/lib/python3.14/site-packages/sqlalchemy/engine/default.py", line 951, in do_execute
bracket-backend   |     cursor.execute(statement, parameters)
bracket-backend   |     ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
bracket-backend   | psycopg2.errors.UndefinedObject: index "ix_users_email" does not exist
... here comes the trace
bracket-backend   | [SQL:
bracket-backend   | DROP INDEX ix_users_email]
bracket-backend   | (Background on this error at: https://sqlalche.me/e/20/f405)
bracket-backend   |
bracket-backend   | [2026-04-04 14:44:38 +0000] [18] [ERROR] Application startup failed. Exiting.
bracket-backend   | [2026-04-04 14:44:38 +0000] [18] [INFO] Worker exiting (pid: 18)
bracket-backend   | [2026-04-04 14:44:39 +0000] [11] [ERROR] Worker (pid:18) exited with code 3
bracket-backend   | [2026-04-04 14:44:39 +0000] [11] [ERROR] Shutting down: Master
bracket-backend   | [2026-04-04 14:44:39 +0000] [11] [ERROR] Reason: Worker failed to boot.
bracket-backend exited with code 3 (restarting)

Does anybody have the same issue?
I dont really know how to fix this.

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions