Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add embedded PostgreSQL support via --embedded-postgres flag#8150

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/support-embedded-postgres-cli
Draft

Add embedded PostgreSQL support via --embedded-postgres flag#8150
Copilot wants to merge 5 commits intomainfrom
copilot/support-embedded-postgres-cli

Conversation

Copy link
Contributor

Copilot AI commented Feb 6, 2026

Describe the pull request

Implements embedded PostgreSQL database support using fergusstrange/embedded-postgres. Eliminates external database dependency for development and small deployments.

Link to the issue: n/a

Implementation

  • New package: internal/embeddedpg manages PostgreSQL lifecycle (start/stop)
  • CLI flag: --embedded-postgres on gogs web command
  • Auto-configuration: Sets postgres connection to localhost:15432 with credentials gogs/gogs
  • Initialization order: Calls conf.Init() and conf.InitLogging() before launching to ensure WorkDir() is available

Key decisions

  • Port 15432: Avoids conflicts with standard PostgreSQL installations
  • DataPath only: Simplified config; library handles runtime/binaries paths internally
  • Defer shutdown: Ensures graceful cleanup on exit
  • Storage: <work-dir>/data/local-postgres

Usage

gogs web --embedded-postgres

First run downloads PostgreSQL 18.0 binaries (~50-60s). Subsequent starts are instant.

Checklist

  • I agree to follow the Code of Conduct by submitting this pull request.
  • I have read and acknowledge the Contributing guide.
  • I have added test cases to cover the new code or have provided the test plan.
  • I have added an entry to CHANGELOG.

Test plan

  1. Run gogs web --embedded-postgres
  2. Verify PostgreSQL 18.0 starts on port 15432
  3. Verify web server becomes available
  4. Stop server (Ctrl+C) and verify clean shutdown logs
  5. Restart to confirm data persistence

Unit tests verify initialization and shutdown without active database.

Original prompt

Support embedded Postgres via https://github.com/fergusstrange/embedded-postgres, support enabling it via a cli flag for the gogs web command, ie, gogs web --embedded-postgres


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits February 6, 2026 01:29
This commit fixes the style issues introduced in 4616bd6 according to the output
from Go fmt and Gofumpt.

Details: #8150
Copilot AI changed the title [WIP] Add support for embedded Postgres via CLI flag Add embedded PostgreSQL support via --embedded-postgres flag Feb 6, 2026
Copilot AI requested a review from unknwon February 6, 2026 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants