Failed to initialize ORM engine: dial tcp 127.0.0.1:5432: connect: connection refused #7078

Closed
opened 2025-11-02 07:15:21 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @johncadengo on GitHub (Mar 27, 2021).

  • Gitea version (or commit ref): 1.13.3
  • Git version: 1.13.3
  • Operating system: Docker running on Ubuntu Focal
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not Relevant
  • Log gist:
    Shown in screenshot

Description

I'm running the docker-compose.yml exactly as shown in documentation: https://docs.gitea.io/en-us/install-with-docker/#postgresql-database

Pretty much the same error as this: https://github.com/go-gitea/gitea/issues/3877

Screenshots

Screen Shot 2021-03-27 at 4 37 01 PM

Originally created by @johncadengo on GitHub (Mar 27, 2021). - Gitea version (or commit ref): 1.13.3 - Git version: 1.13.3 - Operating system: Docker running on Ubuntu Focal - Database (use `[x]`): - [X] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not Relevant - Log gist: Shown in screenshot ## Description I'm running the docker-compose.yml exactly as shown in documentation: https://docs.gitea.io/en-us/install-with-docker/#postgresql-database Pretty much the same error as this: https://github.com/go-gitea/gitea/issues/3877 ## Screenshots ![Screen Shot 2021-03-27 at 4 37 01 PM](https://user-images.githubusercontent.com/561587/112737842-c7445d00-8f1a-11eb-9319-38bd8a978fb1.png)
Author
Owner

@johncadengo commented on GitHub (Mar 27, 2021):

The docker-compose.yml is exactly as written in documentation:

version: "3"

networks:
  gitea:
    external: false

services:
  server:
    image: gitea/gitea:1.13.3
    container_name: gitea
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - DB_TYPE=postgres
      - DB_HOST=db:5432
      - DB_NAME=gitea
      - DB_USER=gitea
      - DB_PASSWD=gitea
    restart: always
    networks:
      - gitea
    volumes:
      - ./gitea:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "3000:3000"
      - "222:22"
    depends_on:
      - db

  db:
    image: postgres:9.6
    restart: always
    environment:
      - POSTGRES_USER=gitea
      - POSTGRES_PASSWORD=gitea
      - POSTGRES_DB=gitea
    networks:
      - gitea
    ports:
      - "5433:5432"
    volumes:
      - ./postgres:/var/lib/postgresql/data
@johncadengo commented on GitHub (Mar 27, 2021): The docker-compose.yml is exactly as written in documentation: ``` version: "3" networks: gitea: external: false services: server: image: gitea/gitea:1.13.3 container_name: gitea environment: - USER_UID=1000 - USER_GID=1000 - DB_TYPE=postgres - DB_HOST=db:5432 - DB_NAME=gitea - DB_USER=gitea - DB_PASSWD=gitea restart: always networks: - gitea volumes: - ./gitea:/data - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro ports: - "3000:3000" - "222:22" depends_on: - db db: image: postgres:9.6 restart: always environment: - POSTGRES_USER=gitea - POSTGRES_PASSWORD=gitea - POSTGRES_DB=gitea networks: - gitea ports: - "5433:5432" volumes: - ./postgres:/var/lib/postgresql/data ```
Author
Owner

@johncadengo commented on GitHub (Mar 27, 2021):

Ok, I found the issue. This should probably be added to the documentation.

If you incorrectly set the DB_HOST the first time, because it creates a local volume under ./gitea:/data it will store those settings in the file ./gitea/gitea/conf/app.ini and even if you update them on subsequent tries, it does not update those values which have already been stored. The solution is to erase the volume, update the values, and start again.

@johncadengo commented on GitHub (Mar 27, 2021): Ok, I found the issue. This should probably be added to the documentation. If you incorrectly set the `DB_HOST` the first time, because it creates a local volume under `./gitea:/data` it will store those settings in the file `./gitea/gitea/conf/app.ini` and even if you update them on subsequent tries, it does not update those values which have already been stored. The solution is to erase the volume, update the values, and start again.
Author
Owner

@zeripath commented on GitHub (Mar 28, 2021):

Feel free to send a PR to update the documentation.

@zeripath commented on GitHub (Mar 28, 2021): Feel free to send a PR to update the documentation.
Author
Owner

@techknowlogick commented on GitHub (Mar 28, 2021):

This is resolved in 1.14-dev with the introduction of env-to-ini functionality which is use is documented currently.

@techknowlogick commented on GitHub (Mar 28, 2021): This is resolved in 1.14-dev with the introduction of env-to-ini functionality which is use is documented currently.
Author
Owner

@johncadengo commented on GitHub (Apr 26, 2021):

@techknowlogick where is it documented? I am updating my docker to 1.14.1 and not sure how to get this to run.

@johncadengo commented on GitHub (Apr 26, 2021): @techknowlogick where is it documented? I am updating my docker to `1.14.1` and not sure how to get this to run.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#7078