Skip to content

It seems unable to initialize gogs (in docker) with a postgresql database #6233

@travishein

Description

@travishein

Describe the bug

When trying to start up a new gogs instance in docker, with postgresql database
Gogs version and commit

I was able to repropduce this on the current master, "latest" docker image built from git commit a7afa11

gogs/gogs:latest
DIGEST:sha256:77dc760b6004c96731dd89043dddba32fc9036151f8a0eab53b1073476051c6b

I was also able to reproduce this in the 0.11.91 release (c154721)

Git version

$ git version

I am using git 2.26.2

Operating system

$>cat /etc/redhat-release
Fedora release 32 (Thirty Two
$>uname -a
Linux bacchus.travnet.org 5.7.8-200.fc32.x86_64 #1 SMP Thu Jul 9 14:34:51 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

(though. I was attempting to launch gogs from the docker image,

gogs/gogs:latest
DIGEST:sha256:77dc760b6004c96731dd89043dddba32fc9036151f8a0eab53b1073476051c6b

Database

postgresql 10.13

To Reproduce
Steps to reproduce the behavior:

  1. Set up a new postgresql 10.13 database (i created a gogs database, a gogs role, password 'gogs')

  2. I launched gogs docker image via docker compose file,

gogs:
    ports:
      - "80:3000"
      - "22:22"
    environment:
      USER: git
    image: gogs/gogs:latest

(also not related, I noticed I needed to specify the USER environment variable into the docker image, as it was not being set.

  1. I navigated to the gogs application, which redirects to the install form.

  2. Specify postgresql for database type, and fill in host localhost:54342, user as gogs, password as gogs, database name as gogs.

  3. Under the "Log Path", check "Enable Console Mode" checkbox. This is helpful to see the messages.

  4. In a terminal, view the docker container logs. (e..g docker-compose logs -f gogs)

  5. On the install form, click "Install Gogs".

At this point for me the application does not continue to respond in the web browser.

  1. Observe in the docker container logs view, that the container is now repeating to attempt to restart gogs application.

Of interest, I was seeing this repeat

2020/07/17 07:21:58 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: sync: pq: column "id" of relation "version" already exists

  1. Observe in the postgresql database, the tables appear to have been created.

Can you reproduce the bug at https://try.gogs.io?

I have not been able to reproduce this on the https://try.gogs.io, because this seems to be a problem during installation of gogs, where this try side is already installed.

Expected behavior

I expect the installation application would continue to install and then return to the gogs sign in form at /user/login

Actual behavior

I see a blank page in the browser. And the gogs application inside the docker container is not able to start up, because it continues to try to create the "version" table in the postgresql database for some reason.

Screenshots

I don't think screenshots help this, but please let me know, and I can get some, for sure.

Additional context

I was able to perform the installation successfully, when I chose to set up and use a mysql database.
So this problem does seem to be specific to when we try to install using postgresql, or perhaps, this version 10.13 of postgresql.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions