DependencyTrack / dependency-track

Dependency-Track is an intelligent Component Analysis platform that allows organizations to identify and reduce risk in the software supply chain.
https://dependencytrack.org/
Apache License 2.0
2.71k stars 580 forks source link

DependencyTrack-Bundled no longer able to connect to the database #4393

Open Dezrin opened 6 days ago

Dezrin commented 6 days ago

Current Behavior

2024-09-26 12:15:21,524 [] INFO [alpine.embedded.EmbeddedJettyServer] alpine-executable-war v2.2.5 (c3a1a709-acdc-4ca7-96dd-5eaab858ee32) built on: 2024-02-29T20:30:01Z 2024-09-26 12:15:23,884 [] INFO [alpine.Config] -------------------------------------------------------------------------------- 2024-09-26 12:15:23,885 [] INFO [alpine.Config] OS Name: Linux 2024-09-26 12:15:23,886 [] INFO [alpine.Config] OS Version: 6.2.0-39-generic 2024-09-26 12:15:23,886 [] INFO [alpine.Config] OS Arch: amd64 2024-09-26 12:15:23,886 [] INFO [alpine.Config] CPU Cores: 12 2024-09-26 12:15:23,888 [] INFO [alpine.Config] Max Memory: 4.0 GB (4,294,967,296.0 bytes) 2024-09-26 12:15:23,889 [] INFO [alpine.Config] Java Vendor: Eclipse Adoptium 2024-09-26 12:15:23,890 [] INFO [alpine.Config] Java Version: 21.0.4+7-LTS 2024-09-26 12:15:23,890 [] INFO [alpine.Config] Java Home: /opt/java/openjdk 2024-09-26 12:15:23,890 [] INFO [alpine.Config] Java Temp: /tmp 2024-09-26 12:15:23,890 [] INFO [alpine.Config] User: dtrack 2024-09-26 12:15:23,890 [] INFO [alpine.Config] User Home: /data/ 2024-09-26 12:15:23,890 [] INFO [alpine.Config] -------------------------------------------------------------------------------- 2024-09-26 12:15:23,890 [] INFO [alpine.Config] Initializing Configuration 2024-09-26 12:15:23,891 [] INFO [alpine.Config] System property alpine.application.properties not specified 2024-09-26 12:15:23,891 [] INFO [alpine.Config] Loading application.properties from classpath 2024-09-26 12:15:23,896 [] INFO [alpine.Config] -------------------------------------------------------------------------------- 2024-09-26 12:15:23,896 [] INFO [alpine.Config] Application: Dependency-Track 2024-09-26 12:15:23,897 [] INFO [alpine.Config] Version: 4.11.7 2024-09-26 12:15:23,897 [] INFO [alpine.Config] Built-on: 2024-08-14T12:37:10Z 2024-09-26 12:15:23,897 [] INFO [alpine.Config] -------------------------------------------------------------------------------- 2024-09-26 12:15:23,897 [] INFO [alpine.Config] Framework: Alpine 2024-09-26 12:15:23,898 [] INFO [alpine.Config] Version : 2.2.5 2024-09-26 12:15:23,898 [] INFO [alpine.Config] Built-on: 2024-02-29T20:30:01Z 2024-09-26 12:15:23,898 [] INFO [alpine.Config] -------------------------------------------------------------------------------- 2024-09-26 12:15:23,994 [] WARN [io.micrometer.core.instrument.binder.jvm.ExecutorServiceMetrics] Failed to bind as java.util.concurrent.Executors$AutoShutdownDelegatedExecutorService is unsupported. 2024-09-26 12:15:24,023 [] INFO [org.dependencytrack.RequirementsVerifier] Initializing requirements verifier 2024-09-26 12:15:24,023 [] INFO [alpine.server.metrics.MetricsInitializer] Registering system metrics 2024-09-26 12:15:24,091 [] INFO [org.dependencytrack.upgrade.UpgradeInitializer] Initializing upgrade framework 2024-09-26 12:15:24,310 [] ERROR [alpine.server.upgrade.UpgradeMetaProcessor] An error occurred connecting to the database. org.postgresql.util.PSQLException: The connection attempt failed. at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:358) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:54) at org.postgresql.jdbc.PgConnection.(PgConnection.java:273) at org.postgresql.Driver.makeConnection(Driver.java:446) at org.postgresql.Driver.connect(Driver.java:298) at java.sql/java.sql.DriverManager.getConnection(Unknown Source) at java.sql/java.sql.DriverManager.getConnection(Unknown Source) at alpine.server.upgrade.UpgradeMetaProcessor.createConnection(UpgradeMetaProcessor.java:187) at alpine.server.upgrade.UpgradeMetaProcessor.(UpgradeMetaProcessor.java:63) at org.dependencytrack.upgrade.UpgradeInitializer.contextInitialized(UpgradeInitializer.java:56) at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:1049) at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:624) at org.eclipse.jetty.server.handler.ContextHandler.contextInitialized(ContextHandler.java:984) at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:740) at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:392) at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1304) at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:901) at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:306) at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:532) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93) at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:171) at org.eclipse.jetty.server.Server.start(Server.java:470) at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114) at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:89) at org.eclipse.jetty.server.Server.doStart(Server.java:415) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93) at alpine.embedded.EmbeddedJettyServer.main(EmbeddedJettyServer.java:100) Caused by: java.net.UnknownHostException: dtrack-postgresql at java.base/sun.nio.ch.NioSocketImpl.connect(Unknown Source) at java.base/java.net.SocksSocketImpl.connect(Unknown Source) at java.base/java.net.Socket.connect(Unknown Source) at org.postgresql.core.PGStream.createSocket(PGStream.java:243) at org.postgresql.core.PGStream.(PGStream.java:98) at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:136) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:262) ... 26 common frames omitted 2024-09-26 12:15:24,311 [] ERROR [org.dependencytrack.upgrade.UpgradeInitializer] An error occurred determining database schema version. Unable to continue. alpine.server.upgrade.UpgradeException: An error occurred connecting to the database. at alpine.server.upgrade.UpgradeMetaProcessor.createConnection(UpgradeMetaProcessor.java:193) at alpine.server.upgrade.UpgradeMetaProcessor.(UpgradeMetaProcessor.java:63) at org.dependencytrack.upgrade.UpgradeInitializer.contextInitialized(UpgradeInitializer.java:56) at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:1049) at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:624) at org.eclipse.jetty.server.handler.ContextHandler.contextInitialized(ContextHandler.java:984) at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:740) at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:392) at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1304) at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:901) at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:306) at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:532) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93) at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:171) at org.eclipse.jetty.server.Server.start(Server.java:470) at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114) at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:89) at org.eclipse.jetty.server.Server.doStart(Server.java:415) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93) at alpine.embedded.EmbeddedJettyServer.main(EmbeddedJettyServer.java:100) Caused by: org.postgresql.util.PSQLException: The connection attempt failed. at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:358) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:54) at org.postgresql.jdbc.PgConnection.(PgConnection.java:273) at org.postgresql.Driver.makeConnection(Driver.java:446) at org.postgresql.Driver.connect(Driver.java:298) at java.sql/java.sql.DriverManager.getConnection(Unknown Source) at java.sql/java.sql.DriverManager.getConnection(Unknown Source) at alpine.server.upgrade.UpgradeMetaProcessor.createConnection(UpgradeMetaProcessor.java:187) ... 19 common frames omitted Caused by: java.net.UnknownHostException: dtrack-postgresql at java.base/sun.nio.ch.NioSocketImpl.connect(Unknown Source) at java.base/java.net.SocksSocketImpl.connect(Unknown Source) at java.base/java.net.Socket.connect(Unknown Source) at org.postgresql.core.PGStream.createSocket(PGStream.java:243) at org.postgresql.core.PGStream.(PGStream.java:98) at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:136) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:262) ... 26 common frames omitted

Steps to Reproduce

  1. Configure dependencytrack/bundled:4.11.7 using Docker Run
  2. Start the container
  3. It is unable to connect to it's own file based database.

Expected Behavior

Previously, DependencyTrack was working perfectly, and able to access and read/write to it's own database file. No file permissions have changed. No file structures have changed.

Dependency-Track Version

4.11.x

Dependency-Track Distribution

Container Image

Database Server

PostgreSQL

Database Server Version

No response

Browser

Google Chrome

Checklist

nscuro commented 5 days ago

Previously, DependencyTrack was working perfectly, and able to access and read/write to it's own database file.

It's trying to connect to an external PostgreSQL database called dtrack-postgresql though. Can you share how you configured it?

Dezrin commented 5 days ago

Previously, DependencyTrack was working perfectly, and able to access and read/write to it's own database file.

It's trying to connect to an external PostgreSQL database called dtrack-postgresql though. Can you share how you configured it?

I didn't configure a database called this, the DB is running as file based Postgresql from the standard Docker Run command: docker run -d -m 8192m -p 8080:8080 --name dependency-track -v dependency-track:/data dependencytrack/bundled

It has been running fine for the past 2 months, up until the container was restarted by Watchower.

There is no reference to dtrack-postgresql in any of my Environment Variables, or the run command.

For reference, here's my environment variables:

TZ=Europe/London
ALPINE_OIDC_ENABLED=true
ALPINE_OIDC_CLIENT_ID=[redacted]
ALPINE_OIDC_ISSUER=[redacted]
ALPINE_OIDC_USERNAME_CLAIM=preferred_username
ALPINE_OIDC_TEAMS_CLAIM=groups
ALPINE_OIDC_USER_PROVISIONING=true
ALPINE_OIDC_TEAM_SYNCHRONIZATION=false
ALPINE_METRICS_ENABLED=true
ALPINE_LDAP_ENABLED=true
ALPINE_LDAP_SERVER_URL=ldaps://[redacted]:636
ALPINE_LDAP_BASEDN=OU=Accounts,DC=[redacted],DC=[redacted]
ALPINE_LDAP_SECURITY_AUTH=simple
ALPINE_LDAP_BIND_USERNAME=CN=svc_ldap,OU=[redacted],OU=[redacted],OU=Accounts,DC=[redacted],DC=[redacted]
ALPINE_LDAP_BIND_PASSWORD=[redacted]
ALPINE_LDAP_AUTH_USERNAME_FORMAT=%s@[redacted]
ALPINE_LDAP_ATTRIBUTE_NAME=userPrincipalName
ALPINE_LDAP_ATTRIBUTE_MAIL=mail
ALPINE_LDAP_GROUPS_FILTER=(&(objectClass=group)(objectCategory=Group))
ALPINE_LDAP_USER_GROUPS_FILTER=(member:1.2.840.113556.1.4.1941:={cn=GRP_DEPENDENCYTRACK_USER,ou=DependencyTrack,ou=Applications,ou=[redacted],dc=[redacted],dc=[redacted]})
ALPINE_LDAP_GROUPS_SEARCH_FILTER=(&(objectClass=group)(objectCategory=Group)(cn=*{GRP_DEPENDENCYTRACK_USER}*,ou=DependencyTrack,ou=[redacted],ou=[redacted],dc=[redacted],dc=[redacted]))
ALPINE_LDAP_USERS_SEARCH_FILTER=(&(objectClass=user)(objectCategory=Person)(cn=*{GRP_DEPENDENCYTRACK_USER}*,ou=DependencyTrack,ou=[redacted],ou=[redacted],dc=[redacted],dc=[redacted]))
ALPINE_LDAP_USER_PROVISIONING=true
ALPINE_LDAP_TEAM_SYNCHRONIZATION=true
OIDC_ISSUER=[redacted]
OIDC_CLIENT_ID=[redacted]
OIDC_SCOPE=profile openid email
OIDC_FLOW=implicit
OIDC_LOGIN_BUTTON_TEXT=Authentik
PATH=/opt/java/openjdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LOGGING_LEVEL=INFO
JAVA_OPTIONS=-XX:+UseParallelGC -XX:MaxRAMPercentage=90.0
EXTRA_JAVA_OPTIONS=-Xmx5120m
CONTEXT=/
WAR_FILENAME=dependency-track-bundled.jar
JAVA_HOME=/opt/java/openjdk
LANG=C.UTF-8
HOME=/data/
DEFAULT_TEMPLATES_OVERRIDE_ENABLED=false
DEFAULT_TEMPLATES_OVERRIDE_BASE_DIRECTORY=/data/
LOGGING_CONFIG_PATH=logback.xml
API_BASE_URL=http://[redacted]:8095
DOCKER_DEFAULT_PLATFORM=linux/amd64

And the file structure that DependencyTrack is configured to utilise is as below;

Image

nscuro commented 5 days ago

That value is mentioned nowhere in the project either, though: https://github.com/search?q=repo%3ADependencyTrack%2Fdependency-track+%22dtrack-postgresql%22&type=code

So it's not coming from us.