gitbucket / gitbucket

A Git platform powered by Scala with easy installation, high extensibility & GitHub API compatibility
https://gitbucket.github.io/
Apache License 2.0
9.13k stars 1.25k forks source link

Not run with Postgresql 16 #3452

Open hrupin opened 9 months ago

hrupin commented 9 months ago

Hello!

First of all, I want to say thank you for such a very cool project!

I had a problem connecting to a Postgresql16 database.

I did everything according to the instructions as written in the documentation

It starts to launch and does not find the driver and stops:

$ java -jar gitbucket.war

SLF4J: No SLF4J providers were found. SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details. 22:46:39.142 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting... 22:46:39.180 [main] WARN c.z.hikari.util.DriverDataSource - Registered driver with driverClassName=org.postgresql.Driver2 was not found, trying direct instantiation. 22:46:41.534 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed. 22:46:41.697 [main] INFO g.core.servlet.InitializeListener - Check version 22:46:41.698 [main] INFO g.core.servlet.InitializeListener - Start schema update

Debian 10

Gitbucket version - 4.40.0

Java version

$ java -version java version "21.0.1" 2023-10-17 LTS Java(TM) SE Runtime Environment (build 21.0.1+12-LTS-29) Java HotSpot(TM) 64-Bit Server VM (build 21.0.1+12-LTS-29, mixed mode, sharing)

Tables in the database are not created

I remotely connect to the database using this account and tried to set the connection settings in different ways

db { url = "jdbc:postgresql://localhost:5432/git_db" user = "bd_user" password = "123321!" }

db { url = "jdbc:postgresql://localhost/git_db" user = "bd_user" password = "123321!" }

db { url = "jdbc:postgresql://98.45.15.65:5432/git_db" user = "bd_user" password = "123321" }

and created the user as in the documentation

db { url = "jdbc:postgresql://localhost/gitbucket" user = "gitbucket_user" password = "YOUR_PASSWORD!" }

takezoe commented 8 months ago

Is this everything you see?

SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.
22:46:39.142 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
22:46:39.180 [main] WARN c.z.hikari.util.DriverDataSource - Registered driver with driverClassName=org.postgresql.Driver2 was not found, trying direct instantiation.
22:46:41.534 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.
22:46:41.697 [main] INFO g.core.servlet.InitializeListener - Check version
22:46:41.698 [main] INFO g.core.servlet.InitializeListener - Start schema update
hrupin commented 8 months ago

yes

version 4.39.0 - started and connection is happening

takezoe commented 8 months ago

WARN message is not a problem. HikariCP just couldn't find a JDBC driver in the list of known JDBC drivers as GitBucket uses a custom JDBC driver. If GitBucket cannot actually fail to connect the database, you must see some error messages.

hrupin commented 8 months ago

understood thanks

takezoe commented 8 months ago

So, could you elaborate your situation if you have still issues, or can we close this issue?

Your meant that your GitBucket stopped working after that message?

sunnyone commented 4 months ago

The same issue occured on my environment (Ubuntu 24.04, openjdk-21, postgresql-16)

In conclusion, a permission to the public schema is required on postgresql >= 15. (cf. https://dev.to/dm8ry/postgresql-version-15-error-permission-denied-for-schema-public-2b7 )

$ psql -Upostgres gitbucket
psql (16.2 (Ubuntu 16.2-1ubuntu4))
Type "help" for help.

gitbucket=# GRANT ALL ON SCHEMA public TO gitbucket_user;
GRANT

It might be helpful if gitbucket outputs logs when the migration fails.

Logs

$ sudo -ugitbucket /usr/bin/java -jar /opt/gitbucket/gitbucket.war --gitbucket.home=/srv/gitbucket --port=8083 
SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.
13:15:56.481 [main] INFO  com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
13:15:56.487 [main] WARN  c.z.hikari.util.DriverDataSource - Registered driver with driverClassName=org.postgresql.Driver2 was not found, trying direct instantiation.
13:15:56.851 [main] INFO  com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.
13:15:56.867 [main] INFO  g.core.servlet.InitializeListener - Check version
13:15:56.867 [main] INFO  g.core.servlet.InitializeListener - Start schema update

The process does not output any logs after above logs, but it's still alive.

postgresql-16-main.log says permission denied.

2024-05-04 13:15:56.887 UTC [57734] gitbucket_user@gitbucket ERROR:  permission denied for schema public at character 14
2024-05-04 13:15:56.887 UTC [57734] gitbucket_user@gitbucket STATEMENT:  CREATE TABLE VERSIONS (MODULE_ID VARCHAR(100) NOT NULL PRIMARY KEY, VERSION VARCHAR(100) NOT NULL)