# This is data only part of buildout for mysql with senna
# made by Leonardo Rochael Almeida <leorochael@gmail.com> (thanks!)
# Original place: https://svn.erp5.org/repos/public/experimental/mysqlsenna.buildout/

[buildout]
parts =
    mycnf
    mysql-instance

[configuration]
mysql_port = 10002
mysql_host = 127.0.0.1
mysql_datadir = ${buildout:directory}/var/mysql
mysql_pid = ${:mysql_datadir}/mysql.pid
mysql_sock = ${:mysql_datadir}/mysql.sock
mysql_error_log = ${buildout:directory}/var/log/mysql.err.log
mysql_cnf_file = ${buildout:directory}/var/etc/my.cnf

[mysql-bin]
recipe = collective.recipe.template
input = ${buildout:directory}/mysql-instance/templates/mysql.in
output = ${buildout:directory}/bin/mysql

[mysql-admin]
recipe = collective.recipe.template
input = ${buildout:directory}/mysql-instance/templates/mysqladmin.in
output = ${buildout:directory}/bin/mysqladmin

[mysqld-bin]
recipe = collective.recipe.template
input = ${buildout:directory}/mysql-instance/templates/mysqld.in
output = ${buildout:directory}/bin/mysqld

[mysql-cnf]
depends = ${etc-directory:command}
recipe = collective.recipe.template
input = ${buildout:directory}/mysql-instance/templates/my.cnf.in
output = ${configuration:mysql_cnf_file}

[mysql-instance]
depends = ${log-directory:command}
recipe = plone.recipe.command
command =
    ${software_definition:mysql_software}/bin/mysql_install_db --datadir=${configuration:mysql_datadir}

[start-mysql-instance]
recipe = plone.recipe.command
command = ${buildout:bin-directory}/mysqld &
update-command = ${:command}

[stop-mysql-instance]
recipe = plone.recipe.command
command = kill `cat ${configuration:mysql_pid}`
update-command = ${:command}