Bug 172408 - databases/mysql55-server: Allow to specify my.cnf path in /etc/rc.conf
Summary: databases/mysql55-server: Allow to specify my.cnf path in /etc/rc.conf
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Alex Dupre
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-06 18:50 UTC by Daniel Ylitalo
Modified: 2013-05-17 15:30 UTC (History)
0 users

See Also:


Attachments
file.diff (1.56 KB, patch)
2012-10-06 18:50 UTC, Daniel Ylitalo
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Ylitalo 2012-10-06 18:50:24 UTC
Right now you have to have the my.cnf file in your dbdir, which isnt optimal in all cases (for example when using a deploysystem that handles all the configfiles)

Fix: Attached as patch

Patch attached with submission follows:
Comment 1 Mark Linimon 2012-10-06 19:10:43 UTC
To which port does this PR apply?

mcl
Comment 2 Daniel Ylitalo 2012-10-06 19:15:37 UTC
sorry for not specifying that one, its databases/mysql55-server :)

// Daniel

Mark Linimon skrev 2012-10-06 20:10:
> To which port does this PR apply?
>
> mcl
Comment 3 Edwin Groothuis freebsd_committer freebsd_triage 2012-10-06 20:37:46 UTC
Responsible Changed
From-To: freebsd-ports-bugs->ale

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 4 Alex Dupre freebsd_committer freebsd_triage 2013-04-23 09:59:30 UTC
State Changed
From-To: open->closed

That's only one of the default paths where my.cnf is searched. 
Look at MySQL docs for a complete list.
Comment 5 daniel 2013-04-23 11:57:33 UTC
The point with the whole patch was that you would be able to specify 
where mysql should look for the my.cnf file from the rc.conf (because 
mine isnt located in a default path due to our deploysystem which has a 
repo for all configs).

Many other ports has this implementation already, (ie openvpn, lighttpd, 
haproxy among others)

Best regards
Daniel Ylitalo

<www.203webgroup.se>
ale@FreeBSD.org skrev 2013-04-23 11:00:
> Synopsis: databases/mysql55-server: Allow to specify my.cnf path in /etc/rc.conf
>
> State-Changed-From-To: open->closed
> State-Changed-By: ale
> State-Changed-When: Tue Apr 23 08:59:30 UTC 2013
> State-Changed-Why:
> That's only one of the default paths where my.cnf is searched.
> Look at MySQL docs for a complete list.
>
> http://www.freebsd.org/cgi/query-pr.cgi?pr=172408
Comment 6 dfilter service freebsd_committer freebsd_triage 2013-04-24 16:08:30 UTC
Author: ale
Date: Wed Apr 24 15:08:22 2013
New Revision: 316439
URL: http://svnweb.freebsd.org/changeset/ports/316439

Log:
  Allow to specify server-specific option file path in /etc/rc.conf
  
  PR:		ports/172408
  Submitted by:	Daniel Ylitalo <daniel@produktion203.se>

Modified:
  head/databases/mysql55-server/files/mysql-server.in
  head/databases/mysql56-server/files/mysql-server.in

Modified: head/databases/mysql55-server/files/mysql-server.in
==============================================================================
--- head/databases/mysql55-server/files/mysql-server.in	Wed Apr 24 14:21:12 2013	(r316438)
+++ head/databases/mysql55-server/files/mysql-server.in	Wed Apr 24 15:08:22 2013	(r316439)
@@ -16,6 +16,8 @@
 #			just before mysql starts.
 # mysql_dbdir (str):	Default to "/var/db/mysql"
 #			Base database directory.
+# mysql_optfile (str):	Server-specific option file.
+#			Default to "${mysql_dbdir}/my.cnf".
 # mysql_pidfile (str):	Custum PID file path and name.
 #			Default to "${mysql_dbdir}/${hostname}.pid".
 # mysql_args (str):	Custom additional arguments to be passed
@@ -32,12 +34,13 @@ load_rc_config $name
 : ${mysql_enable="NO"}
 : ${mysql_limits="NO"}
 : ${mysql_dbdir="/var/db/mysql"}
+: ${mysql_optfile="${mysql_dbdir}/my.cnf"}
 
 mysql_user="mysql"
 mysql_limits_args="-e -U ${mysql_user}"
 pidfile=${mysql_pidfile:-"${mysql_dbdir}/`/bin/hostname`.pid"}
 command="/usr/sbin/daemon"
-command_args="-c -f %%PREFIX%%/bin/mysqld_safe --defaults-extra-file=${mysql_dbdir}/my.cnf --user=${mysql_user} --datadir=${mysql_dbdir} --pid-file=${pidfile} ${mysql_args}"
+command_args="-c -f %%PREFIX%%/bin/mysqld_safe --defaults-extra-file=${mysql_optfile} --user=${mysql_user} --datadir=${mysql_dbdir} --pid-file=${pidfile} ${mysql_args}"
 procname="%%PREFIX%%/libexec/mysqld"
 start_precmd="${name}_prestart"
 start_postcmd="${name}_poststart"

Modified: head/databases/mysql56-server/files/mysql-server.in
==============================================================================
--- head/databases/mysql56-server/files/mysql-server.in	Wed Apr 24 14:21:12 2013	(r316438)
+++ head/databases/mysql56-server/files/mysql-server.in	Wed Apr 24 15:08:22 2013	(r316439)
@@ -16,6 +16,8 @@
 #			just before mysql starts.
 # mysql_dbdir (str):	Default to "/var/db/mysql"
 #			Base database directory.
+# mysql_optfile (str):	Server-specific option file.
+#			Default to "${mysql_dbdir}/my.cnf".
 # mysql_pidfile (str):	Custum PID file path and name.
 #			Default to "${mysql_dbdir}/${hostname}.pid".
 # mysql_args (str):	Custom additional arguments to be passed
@@ -32,12 +34,13 @@ load_rc_config $name
 : ${mysql_enable="NO"}
 : ${mysql_limits="NO"}
 : ${mysql_dbdir="/var/db/mysql"}
+: ${mysql_optfile="${mysql_dbdir}/my.cnf"}
 
 mysql_user="mysql"
 mysql_limits_args="-e -U ${mysql_user}"
 pidfile=${mysql_pidfile:-"${mysql_dbdir}/`/bin/hostname`.pid"}
 command="/usr/sbin/daemon"
-command_args="-c -f %%PREFIX%%/bin/mysqld_safe --defaults-extra-file=${mysql_dbdir}/my.cnf --user=${mysql_user} --datadir=${mysql_dbdir} --pid-file=${pidfile} ${mysql_args}"
+command_args="-c -f %%PREFIX%%/bin/mysqld_safe --defaults-extra-file=${mysql_optfile} --user=${mysql_user} --datadir=${mysql_dbdir} --pid-file=${pidfile} ${mysql_args}"
 procname="%%PREFIX%%/libexec/mysqld"
 start_precmd="${name}_prestart"
 start_postcmd="${name}_poststart"
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 7 daniel 2013-05-17 15:19:57 UTC
I found a minor bug<www.203webgroup.se> regarding this.

You do not have the argument --defaults-extra-file=${mysql_optfile} in 
the mysql_install_db_args variable so if you have a custom var that is 
used for mysql_install_db it will fail and use the default settings 
while mysqld uses the my.cnf values.

Correct values would be:
mysql_install_db_args="--basedir=/usr/local --datadir=${mysql_dbdir} 
--defaults-extra-file=${mysql_optfile} --force"

This was found with /usr/ports/databases/mysql56-server

Best regards
Daniel

Alex Dupre skrev 2013-04-24 17:12:
> Daniel Ylitalo ha scritto:
>> The point with the whole patch was that you would be able to specify
>> where mysql should look for the my.cnf file from the rc.conf (because
>> mine isnt located in a default path due to our deploysystem which has a
>> repo for all configs).
> After thinking twice I like the idea, commmitted, thanks.
>