Skip to content

Commit

Permalink
fix: additional MySQL config on Windows, fixes ddev#3801 (ddev#5242)
Browse files Browse the repository at this point in the history
  • Loading branch information
rokclimb15 authored Aug 19, 2023
1 parent 07d09cd commit 5654135
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
4 changes: 3 additions & 1 deletion containers/ddev-dbserver/files/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ rm -f /tmp/raw_mysql_version.txt

# If we have extra mariadb cnf files, copy them to where they go.
if [ -d /mnt/ddev_config/mysql ] && [ "$(echo /mnt/ddev_config/mysql/*.cnf)" != "/mnt/ddev_config/mysql/*.cnf" ] ; then
echo "!includedir /mnt/ddev_config/mysql" >/etc/mysql/conf.d/ddev.cnf
cp /mnt/ddev_config/mysql/*.cnf /etc/mysql/conf.d
# Ignore errors on files such as .gitmanaged
chmod -f -R ugo-w /etc/mysql/conf.d/*
fi


Expand Down
26 changes: 26 additions & 0 deletions pkg/ddevapp/ddevapp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1801,6 +1801,32 @@ func TestDdevAllDatabases(t *testing.T) {
assert.Equal(dbType+"_"+dbVersion, strings.Trim(containerDBVersion, "\n\r "))
}

if dbType == nodeps.MariaDB || dbType == nodeps.MySQL {
// Make sure overriding configuration works
out, stderr, err := app.Exec(&ddevapp.ExecOpts{
Service: "db",
Cmd: `mysql -sN -e "SELECT @@global.time_zone"`,
})
assert.NoError(err)
assert.Equal("SYSTEM\n", out, "out: %s, stderr: %s", out, stderr)

err = os.MkdirAll(app.GetConfigPath("mysql"), 0750)
require.NoError(t, err)
err = os.WriteFile(app.GetConfigPath("mysql/override_param_test.cnf"), []byte("[mysqld]\n default-time-zone = \"+08:00\""), 0666)
require.NoError(t, err)
err = app.Restart()
require.NoError(t, err)
out, stderr, err = app.Exec(&ddevapp.ExecOpts{
Service: "db",
Cmd: `mysql -sN -e "SELECT @@global.time_zone"`,
})
assert.NoError(err)
assert.Equal("+08:00\n", out, "out: %s, stderr: %s", out, stderr)
// Delete override file for next dbType test
err = os.Remove(app.GetConfigPath("mysql/override_param_test.cnf"))
require.NoError(t, err)
}

c = map[string]string{
nodeps.MySQL: `echo "SELECT COUNT(*) FROM users;" | mysql -N`,
nodeps.MariaDB: `echo "SELECT COUNT(*) FROM users;" | mysql -N`,
Expand Down
2 changes: 1 addition & 1 deletion pkg/versionconstants/versionconstants.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var WebTag = "20230720_ted933_doc_installation_ubuntu_apt_vulnerability" // Note
var DBImg = "ddev/ddev-dbserver"

// BaseDBTag is the main tag, DBTag is constructed from it
var BaseDBTag = "v1.22.0"
var BaseDBTag = "20230806_mysql_config_windows"

const TraditionalRouterImage = "ddev/ddev-nginx-proxy-router:20230816_traefik_image"
const TraefikRouterImage = "ddev/ddev-traefik-router:20230816_traefik_image"
Expand Down

0 comments on commit 5654135

Please sign in to comment.