Skip to content

Separate TidesDB configuration from MariaDB configuration in Docker image#4

Closed
Copilot wants to merge 8 commits into
masterfrom
copilot/separate-tidesdb-config
Closed

Separate TidesDB configuration from MariaDB configuration in Docker image#4
Copilot wants to merge 8 commits into
masterfrom
copilot/separate-tidesdb-config

Conversation

Copilot AI commented Mar 27, 2026

Copy link
Copy Markdown

TidesDB-specific settings were co-mingled with MariaDB's my.cnf, making it harder to manage each independently. This PR also introduces a custom configuration directory for user-supplied overrides, and a /docker-entrypoint-initdb.d directory for container initialisation scripts.

Changes

  • New file docker/conf/inc/tidesdb.cfg — contains only TidesDB system variables under [mysqld]:

    [mysqld]
    tidesdb_flush_threads      = 2
    tidesdb_compaction_threads = 2
    tidesdb_block_cache_size   = 268435456
    tidesdb_max_open_sstables  = 256
    tidesdb_log_level          = WARN
  • New file docker/conf/custom/00-example.cfg — example custom configuration file with commented-out sql_mode and old_mode settings under [server], and a header comment explaining it is an example to be copied and edited.

  • New file docker/conf/custom/.gitignore — gitignores all files in the custom/ directory except itself and 00-example.cfg, so user-created config files remain local and unversioned.

  • docker/conf/my.cnf — TidesDB section replaced with a !include directive, and !includedir /etc/mysql/custom appended at the very end so custom files are loaded last and override all defaults:

    !include /etc/mysql/inc/tidesdb.cfg
    ...
    !includedir /etc/mysql/custom
  • New file docker/initdb.d/00-example.sql — example initialisation script with an explanatory comment and no SQL content, serving as a template for users to copy and edit.

  • New file docker/initdb.d/.gitignore — gitignores all files in the initdb.d/ directory except itself and 00-example.sql, so user-created init scripts remain local and unversioned.

  • docker/ubuntu/Dockerfile — copies docker/initdb.d/ to /docker-entrypoint-initdb.d/ in the image and declares it as a VOLUME.

  • docker/ubuntu/entrypoint.sh — MariaDB now starts in the background; after it is up and accepting connections, any .sql and .sh files in /docker-entrypoint-initdb.d are executed in alphabetical order, then the entrypoint waits on the server process.

  • docker/README.md — new "Customising the Configuration" section explaining how to add files to conf/custom to override defaults, and a new "Initialisation Scripts" section documenting the /docker-entrypoint-initdb.d feature, its backup-restore use case, and guidance on avoiding unintended re-execution on subsequent restarts.

The docker/conf/ tree is copied to /etc/mysql/ in the Dockerfile, so tidesdb.cfg lands at /etc/mysql/inc/tidesdb.cfg and the custom directory at /etc/mysql/custom/ — matching the include paths exactly. The initdb.d/ tree is copied to /docker-entrypoint-initdb.d/ in the image.


⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

Agent-Logs-Url: https://github.com/Vettabase/tidesql/sessions/32627f94-b1b2-42d9-9106-f0538ad92df9

Co-authored-by: federico-razzoli <497022+federico-razzoli@users.noreply.github.com>
Copilot AI changed the title [WIP] Separate TidesDB configuration from MariaDB configuration Separate TidesDB configuration from MariaDB configuration in Docker image Mar 27, 2026
Copilot AI requested a review from federico-razzoli March 27, 2026 03:00
@federico-razzoli

Copy link
Copy Markdown
Member

@copilot

The configuration directory should have a subdirectory called custom, with an 00-example.cfg file. This file includes settings for the sql_mode and old_mode variables, in the [server] option group, but they're commented because they're just an example. A comment at the beginning og 00-example.cfg should explain that it's just an example file. Any other file in the custom directory need to be gitignored.

Include custom contents in the main configuration file, at the very end of it, using the !includedir directive.

Add documentation in README.md to explain that files can be added to the conf/custom directory to customise the configuration of the image. Specify that these files won't be versioned, and their contents will override any default configuration.

Agent-Logs-Url: https://github.com/Vettabase/tidesql/sessions/0f095892-e6d9-4e1a-ac3f-874b082ca453

Co-authored-by: federico-razzoli <497022+federico-razzoli@users.noreply.github.com>

Copilot AI commented Mar 27, 2026

Copy link
Copy Markdown
Author

@copilot

The configuration directory should have a subdirectory called custom, with an 00-example.cfg file. This file includes settings for the sql_mode and old_mode vari...

Done in commit 7d36d4f:

  • docker/conf/custom/00-example.cfg added with a comment explaining it's an example, and commented-out sql_mode / old_mode under [server]
  • docker/conf/custom/.gitignore ignores everything in custom/ except itself and 00-example.cfg
  • !includedir /etc/mysql/custom appended at the very end of my.cnf
  • docker/README.md updated with a "Customising the Configuration" section explaining the conf/custom directory, that files there aren't versioned, and that they override defaults

@federico-razzoli

Copy link
Copy Markdown
Member

@copilot

Make the following changes to the Docker image.

Containers need a /docker-entrypoint-initdb.d directory. This directory needs to be a volume that users can map to a local directory. Its contents must not be versioned, except for a file called 00-example.sql with an explicative comment and no other contents.

As soon as MariaDB is up and responding, the entrypoint needs to execute any .sql and .sh file in this directory, in an alphabetical order.

Add documentation for this feature in the README. Explain that it can be used to initialise users or databases when containers start. Mention that a typical use case for this is to place a dump in this directory, so that a backup is restored in the newly created MariaDB containers.

Agent-Logs-Url: https://github.com/Vettabase/tidesql/sessions/b2b72453-bc0b-4003-ae9f-1c00c7d095e4

Co-authored-by: federico-razzoli <497022+federico-razzoli@users.noreply.github.com>

Copilot AI commented Mar 27, 2026

Copy link
Copy Markdown
Author

@copilot

Make the following changes to the Docker image.
...

Done in commit e1ffae8:

  • docker/initdb.d/00-example.sql — explanatory comment, no SQL content
  • docker/initdb.d/.gitignore — ignores all files except itself and 00-example.sql
  • Dockerfile — copies initdb.d/ to /docker-entrypoint-initdb.d/ and declares it as a VOLUME
  • entrypoint.sh — MariaDB now starts in the background; the entrypoint waits for it to accept connections, then executes all .sql and .sh files from /docker-entrypoint-initdb.d in alphabetical order, then waits on the server process
  • README.md — new "Initialisation Scripts" section explaining the feature, the backup-restore use case, and a note to remove/unmap scripts after first run if they should only execute once

@federico-razzoli

Copy link
Copy Markdown
Member

@copilot

Right now the Dockerfile fails because docker/initdb.d doesn't exist. The directory should exist and contain a .keep file to make sure that it's preserved by git when the repository is cloned.

Agent-Logs-Url: https://github.com/Vettabase/tidesql/sessions/6dc9212c-7f70-40a7-8673-cfb7567697cd

Co-authored-by: federico-razzoli <497022+federico-razzoli@users.noreply.github.com>

Copilot AI commented Mar 27, 2026

Copy link
Copy Markdown
Author

@copilot

Right now the Dockerfile fails because docker/initdb.d doesn't exist. The directory should exist and contain a .keep file to make sure that it's preserved by git whe...

Fixed in commit 933ab2c. The root .gitignore had a *.d pattern that was silently excluding the entire docker/initdb.d/ directory. Added a !docker/initdb.d/ exception there, then committed the directory with .keep, 00-example.sql, and .gitignore.

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