Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/mysql: fix service so it works with mysql80 package [20.03 backport] #83254

Merged
merged 2 commits into from Mar 24, 2020

Conversation

aanderse
Copy link
Member

Motivation for this change

I found out that the mysql80 package is broken with the mysql module 馃槺 I think this deserves a 20.03 backport.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@aanderse
Copy link
Member Author

@GrahamcOfBorg test mysql

@aanderse
Copy link
Member Author

ping @NixOS/nixos-release-managers - currently services.mysql is broken if you specify services.mysql.package = pkgs.mysql80;, and minimal non breaking changes to the module can correct this.

Comment on lines +302 to 311
preStart = if isMariaDB then ''
if ! test -e ${cfg.dataDir}/mysql; then
${mysql}/bin/mysql_install_db --defaults-file=/etc/my.cnf ${mysqldOptions}
touch /tmp/mysql_init
fi
'' else ''
if ! test -e ${cfg.dataDir}/mysql; then
${mysql}/bin/mysql_install_db --defaults-file=/etc/my.cnf ${installOptions}
${mysql}/bin/mysqld --defaults-file=/etc/my.cnf ${mysqldOptions} --initialize-insecure
touch /tmp/mysql_init
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is slightly duplicated, why not do

preStart = 
let
  initCommand = if isMariaDB then ''
    ${mysql}/bin/mysql_install_db --defaults-file=/etc/my.cnf ${mysqldOptions}
  '' else "${mysql}/bin/mysqld --defaults-file=/etc/my.cnf ${mysqldOptions} --initialize-insecure";
in ''
  if ! test -e ${cfg.dataDir/mysql; then
    ${initCommand}
    touch /tmp/mysql_init
  fi
'';

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As time goes by mariadb and mysql drift further apart so I figured in this case maybe just keep it separate in case there is more divergence... but yeah maybe it was a bit much and a bit premature.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As time goes by mariadb and mysql drift further apart so I figured in this case maybe just keep it separate in case there is more divergence...

That is a good point, this is probably fine if the actual conditional changes.

@worldofpeace
Copy link
Contributor

worldofpeace commented Mar 24, 2020

Lol, this is a cherry-pick. Didn't realize this right away (probably should read closer).

@flokli flokli merged commit 234bc36 into NixOS:release-20.03 Mar 24, 2020
@aanderse aanderse deleted the mysql80-backport branch March 24, 2020 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants