[PR #813] [MERGED] chore: additional logs for database connections #605

Closed
opened 2025-10-07 00:19:20 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/pocket-id/pocket-id/pull/813
Author: @ItalyPaleAle
Created: 8/6/2025
Status: Merged
Merged: 8/6/2025
Merged by: @stonith404

Base: mainHead: log-db-connection


📝 Commits (1)

  • d73a5df chore: additional logs for database connections

📊 Changes

1 file changed (+4 additions, -1 deletions)

View changed files

📝 backend/internal/bootstrap/db_bootstrap.go (+4 -1)

📄 Description

Adding some additional log statements to the code creating database connections, to have some more debugging info.

This morning, I noticed that the pocket-id container in my server was not responding because something was wrong with the database (it probably wasn't up yet). Despite that, Pocket ID still started a server.

Logs here were not enough to understand what happened (they show a DNS resolution error, but it then didn't retry):

Aug 06 00:20:33 apps pocketid-pocketid[499293]: 2025/08/06 00:20:33 Server listening on 0.0.0.0:1411
Aug 06 00:20:33 apps pocketid-pocketid[499293]: 2025/08/06 00:20:33 INFO Starting job scheduler
Aug 06 00:20:33 apps pocketid-pocketid[499293]: 2025/08/06 00:20:33 INFO Starting job name=ClearAuditLogs id=a3df48ee-b481-4572-9fc1-4e81030891d5
Aug 06 00:20:33 apps pocketid-pocketid[499293]: 2025/08/06 00:20:33 INFO Starting job name=ClearOidcRefreshTokens id=90ad5821-0936-48f6-8558-604941eb8e9d
Aug 06 00:20:33 apps pocketid-pocketid[499293]: 2025/08/06 00:20:33 INFO Starting job name=ClearOneTimeAccessTokens id=1d632227-fe24-4bee-80bf-80f71c92ae7e
Aug 06 00:20:33 apps pocketid-pocketid[499293]: 2025/08/06 00:20:33 INFO Starting job name=SyncLdap id=f43a66c3-fdb7-4374-8c45-f56c3d2c82d0
Aug 06 00:20:33 apps pocketid-pocketid[499293]: 2025/08/06 00:20:33 INFO Job run successfully name=SyncLdap id=f43a66c3-fdb7-4374-8c45-f56c3d2c82d0
Aug 06 00:20:33 apps pocketid-pocketid[499293]: 2025/08/06 00:20:33 INFO Starting job name=ClearSignupTokens id=977effbf-ebbb-4bb9-b2b3-118229b38b99
Aug 06 00:20:33 apps pocketid-pocketid[499293]: 2025/08/06 00:20:33 INFO Starting job name=ClearOidcAuthorizationCodes id=a12ffd3c-5586-44a3-8fbf-d66786fbb39c
lines 1196-1229/1353 86%
Aug 06 00:20:30 apps pocketid-pocketid[499293]:
Aug 06 00:20:30 apps pocketid-pocketid[499293]: 2025/08/06 00:20:30 github.com/pocket-id/pocket-id/backend/internal/bootstrap/db_bootstrap.go:108
Aug 06 00:20:30 apps pocketid-pocketid[499293]: [error] failed to initialize database, got error failed to connect to `user=pocketid database=pocketid`:
Aug 06 00:20:30 apps pocketid-pocketid[499293]:         hostname resolving error: lookup postgres on 172.16.0.1:53: no such host
Aug 06 00:20:30 apps pocketid-pocketid[499293]:         lookup postgres on 172.16.0.1:53: no such host
Aug 06 00:20:30 apps pocketid-pocketid[499293]: 2025/08/06 00:20:30 Attempt 1: Failed to initialize database. Retrying...
Aug 06 00:20:33 apps pocketid-pocketid[499293]: 2025/08/06 00:20:33 Server listening on 0.0.0.0:1411

These new logs should help troubleshoot if the issue happens in the future, hopefully.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/pocket-id/pocket-id/pull/813 **Author:** [@ItalyPaleAle](https://github.com/ItalyPaleAle) **Created:** 8/6/2025 **Status:** ✅ Merged **Merged:** 8/6/2025 **Merged by:** [@stonith404](https://github.com/stonith404) **Base:** `main` ← **Head:** `log-db-connection` --- ### 📝 Commits (1) - [`d73a5df`](https://github.com/pocket-id/pocket-id/commit/d73a5dfae8fa452a2d611d19cb456adb6d2c8d67) chore: additional logs for database connections ### 📊 Changes **1 file changed** (+4 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `backend/internal/bootstrap/db_bootstrap.go` (+4 -1) </details> ### 📄 Description Adding some additional log statements to the code creating database connections, to have some more debugging info. This morning, I noticed that the pocket-id container in my server was not responding because something was wrong with the database (it probably wasn't up yet). Despite that, Pocket ID still started a server. Logs here were not enough to understand what happened (they show a DNS resolution error, but it then didn't retry): ``` Aug 06 00:20:33 apps pocketid-pocketid[499293]: 2025/08/06 00:20:33 Server listening on 0.0.0.0:1411 Aug 06 00:20:33 apps pocketid-pocketid[499293]: 2025/08/06 00:20:33 INFO Starting job scheduler Aug 06 00:20:33 apps pocketid-pocketid[499293]: 2025/08/06 00:20:33 INFO Starting job name=ClearAuditLogs id=a3df48ee-b481-4572-9fc1-4e81030891d5 Aug 06 00:20:33 apps pocketid-pocketid[499293]: 2025/08/06 00:20:33 INFO Starting job name=ClearOidcRefreshTokens id=90ad5821-0936-48f6-8558-604941eb8e9d Aug 06 00:20:33 apps pocketid-pocketid[499293]: 2025/08/06 00:20:33 INFO Starting job name=ClearOneTimeAccessTokens id=1d632227-fe24-4bee-80bf-80f71c92ae7e Aug 06 00:20:33 apps pocketid-pocketid[499293]: 2025/08/06 00:20:33 INFO Starting job name=SyncLdap id=f43a66c3-fdb7-4374-8c45-f56c3d2c82d0 Aug 06 00:20:33 apps pocketid-pocketid[499293]: 2025/08/06 00:20:33 INFO Job run successfully name=SyncLdap id=f43a66c3-fdb7-4374-8c45-f56c3d2c82d0 Aug 06 00:20:33 apps pocketid-pocketid[499293]: 2025/08/06 00:20:33 INFO Starting job name=ClearSignupTokens id=977effbf-ebbb-4bb9-b2b3-118229b38b99 Aug 06 00:20:33 apps pocketid-pocketid[499293]: 2025/08/06 00:20:33 INFO Starting job name=ClearOidcAuthorizationCodes id=a12ffd3c-5586-44a3-8fbf-d66786fbb39c lines 1196-1229/1353 86% Aug 06 00:20:30 apps pocketid-pocketid[499293]: Aug 06 00:20:30 apps pocketid-pocketid[499293]: 2025/08/06 00:20:30 github.com/pocket-id/pocket-id/backend/internal/bootstrap/db_bootstrap.go:108 Aug 06 00:20:30 apps pocketid-pocketid[499293]: [error] failed to initialize database, got error failed to connect to `user=pocketid database=pocketid`: Aug 06 00:20:30 apps pocketid-pocketid[499293]: hostname resolving error: lookup postgres on 172.16.0.1:53: no such host Aug 06 00:20:30 apps pocketid-pocketid[499293]: lookup postgres on 172.16.0.1:53: no such host Aug 06 00:20:30 apps pocketid-pocketid[499293]: 2025/08/06 00:20:30 Attempt 1: Failed to initialize database. Retrying... Aug 06 00:20:33 apps pocketid-pocketid[499293]: 2025/08/06 00:20:33 Server listening on 0.0.0.0:1411 ``` These new logs should help troubleshoot if the issue happens in the future, hopefully. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2025-10-07 00:19:20 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pocket-id#605