Skip to content

Add DB_SOCKET support for MySQL/MariaDB and make it override TCP DB settings - #603

Merged
jcormier merged 2 commits into
masterfrom
copilot/feature-support-mysql-socket
Sep 23, 2026
Merged

jcormier merged 2 commits into
masterfrom
copilot/feature-support-mysql-socket

Conversation

Copilot AI commented Sep 22, 2026 •

Copy link
Copy Markdown

This change adds first-class support for MySQL/MariaDB Unix socket connections in Redmine container configuration. When DB_SOCKET is provided (with DB_ADAPTER=mysql2), generated DB config now prefers socket-based connectivity over DB_HOST/DB_PORT while preserving current TCP behavior when unset.

  • Runtime DB parameter handling

    • Added DB_SOCKET to runtime environment defaults.
    • Updated DB parameter finalization to allow MySQL socket-based config without requiring DB_HOST.
  • database.yml generation behavior

    • Added socket templating support in the database config template.
    • In MySQL mode:
      • if DB_SOCKET is set: remove host/port keys from generated database.yml
      • if DB_SOCKET is unset: remove socket key
    • Keeps generated config mutually consistent and avoids mixed transport fields.
  • MySQL connection checks and command safety

    • Updated MySQL readiness and isolation checks to use socket mode when configured.
    • Refactored command construction to array-based invocation for safe argument handling (spaces/special chars).
    • Kept PostgreSQL readiness path resolution robust (command -v first, fallback scan).
  • Documentation updates

    • Added DB_SOCKET to the configuration reference.
    • Added a socket-based MySQL/MariaDB run example and clarified precedence semantics.
# Example env configuration (socket mode)
DB_ADAPTER: mysql2
DB_SOCKET: /var/run/mysqld/mysqld.sock
DB_NAME: redmine_production
DB_USER: redmine
DB_PASS: password

Generated database.yml (MySQL socket mode) now includes socket: and omits host:/port:.

Copilot AI linked an issue Sep 22, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add support for MySQL/MariaDB socket configuration Add DB_SOCKET support for MySQL/MariaDB and make it override TCP DB settings Sep 22, 2026
Copilot AI requested a review from jcormier September 22, 2026 18:05
Comment thread assets/runtime/functions Resolved
Comment thread assets/runtime/functions Resolved
Comment thread assets/runtime/functions Resolved
Comment thread assets/runtime/functions Resolved
Comment thread assets/runtime/functions Resolved
Build the mysqladmin, mysql, pg_isready, and true probe/query commands
as arrays instead of strings, so hostnames, ports and paths containing
spaces or glob characters survive word-splitting/pathname expansion
intact. Also stop passing the MySQL password as a literal -p argument
(visible via `ps`) and pass it through MYSQL_PWD instead, for both the
mysqladmin connection check and the mysql transaction-isolation query.
Allow connecting to MySQL/MariaDB over a Unix socket via DB_SOCKET.
When set (with DB_ADAPTER=mysql2), it takes precedence over
DB_HOST/DB_PORT for the connection check, the transaction-isolation
query, and database.yml, and the host/port keys are stripped from the
rendered config instead of the socket key.
@jcormier
jcormier force-pushed the copilot/feature-support-mysql-socket branch from 8876354 to f511b65 Compare September 23, 2026 13:33
@jcormier
jcormier marked this pull request as ready for review September 23, 2026 13:37
Copilot AI lite review requested due to automatic review settings September 23, 2026 13:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@jcormier
jcormier merged commit df1fe93 into master Sep 23, 2026
1 check passed
@jcormier
jcormier deleted the copilot/feature-support-mysql-socket branch September 23, 2026 13:40
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.

Feature request: Support for MySQL/MariaDB database socket configuration

3 participants