Adjust MySQL socket file name generation so that no socket parameter to the client is required for a standard installation
This commit is contained in:
parent
96f5f9c05e
commit
61563861a2
|
@ -2,12 +2,22 @@
|
|||
{port ? 3306, instanceSuffix ? "", instanceName ? "mysql${instanceSuffix}", containerName ? "mysql-database${instanceSuffix}", type}:
|
||||
|
||||
let
|
||||
mysqlSocket = "${runtimeDir}/${instanceName}/${instanceName}.sock";
|
||||
# By default, the socket file resides in $runtimeDir/mysqld/mysqld.sock.
|
||||
# We only change the path component: 'mysqld' into the instance name if no
|
||||
# instanceSuffix parameter is specified. Otherwise, we append the
|
||||
# instanceSuffix to 'mysqld'.
|
||||
#
|
||||
# This construction is used to allow the mysql client executable to work
|
||||
# without a socket parameter for the default configuration.
|
||||
|
||||
mysqlSocket =
|
||||
if instanceName != "mysql" && instanceSuffix == "" then "${runtimeDir}/${instanceName}/mysqld.sock"
|
||||
else "${runtimeDir}/mysqld${instanceSuffix}/mysqld.sock";
|
||||
|
||||
mysqlUsername = "root";
|
||||
|
||||
pkg = mysqlConstructorFun {
|
||||
inherit port instanceName;
|
||||
inherit port instanceName instanceSuffix;
|
||||
postInstall = ''
|
||||
# Add Dysnomia container configuration file for MySQL database
|
||||
mkdir -p $out/etc/dysnomia/containers
|
||||
|
|
|
@ -1,9 +1,21 @@
|
|||
{createManagedProcess, stdenv, mysql, stateDir, runtimeDir, forceDisableUserChange}:
|
||||
{port ? 3306, instanceSuffix ? "", instanceName ? "mysqld${instanceSuffix}", postInstall ? ""}:
|
||||
{port ? 3306, instanceSuffix ? "", instanceName ? "mysql${instanceSuffix}", postInstall ? ""}:
|
||||
|
||||
let
|
||||
dataDir = "${stateDir}/db/${instanceName}";
|
||||
instanceRuntimeDir = "${runtimeDir}/${instanceName}";
|
||||
|
||||
# By default, the socket file resides in $runtimeDir/mysqld/mysqld.sock.
|
||||
# We only change the path component: 'mysqld' into the instance name if no
|
||||
# instanceSuffix parameter is specified. Otherwise, we append the
|
||||
# instanceSuffix to 'mysqld'.
|
||||
#
|
||||
# This construction is used to allow the mysql client executable to work
|
||||
# without a socket parameter for the default configuration.
|
||||
|
||||
instanceRuntimeDir =
|
||||
if instanceName != "mysql" && instanceSuffix == "" then "${runtimeDir}/${instanceName}"
|
||||
else "${runtimeDir}/mysqld${instanceSuffix}";
|
||||
|
||||
user = instanceName;
|
||||
group = instanceName;
|
||||
in
|
||||
|
@ -27,7 +39,7 @@ createManagedProcess {
|
|||
'';
|
||||
|
||||
foregroundProcess = "${mysql}/bin/mysqld";
|
||||
foregroundProcessArgs = [ "--basedir" mysql "--datadir" dataDir "--port" port "--socket" "${instanceRuntimeDir}/${instanceName}.sock" ]
|
||||
foregroundProcessArgs = [ "--basedir" mysql "--datadir" dataDir "--port" port "--socket" "${instanceRuntimeDir}/mysqld.sock" ]
|
||||
++ stdenv.lib.optionals (!forceDisableUserChange) [ "--user" user ];
|
||||
|
||||
credentials = {
|
||||
|
|
Loading…
Reference in New Issue