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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql_service resource silently fails when not named default #666

Open
axl89 opened this issue Mar 21, 2021 · 0 comments
Open

mysql_service resource silently fails when not named default #666

axl89 opened this issue Mar 21, 2021 · 0 comments

Comments

@axl89
Copy link

axl89 commented Mar 21, 2021

👻 Brief Description

When using the mysql_service resource with a different name than default, although the Chef converge phase exits successfully, the MySQL service is not able to start.

⚠️ This only happens with Dokken based kitchens, not with Vagrant.

🥞 Cookbook version

10.1.1

👩‍🍳 Chef-Infra Version

16.11.7

🎩 Platform details

Dokken Ubuntu 20.04 (see used kitchen YAML file)

Steps To Reproduce

  1. Create a recipe as follows:
apt_update 'all platforms' do
  action :update
  only_if { platform_family?('debian') }
end

yum_mysql_community_repo 'mysql_repo' do
  version node['scalefast_mysql']['service']['version']
  only_if { platform_family?('rhel') || platform_family?('amazon') }
end

# Copy pasted from the README.md
mysql_service 'foo' do
  port '3306'
  version '8.0'
  initial_root_password 'change me'
  action [:create, :start]
end
  1. Converge
  2. Use kitchen login to go inside the system
  3. Confirm that MySQL is dead:
root@dokken:/# systemctl status mysql-foo.service
● mysql-foo.service - mysql_service[mysql-foo]
     Loaded: loaded (/etc/systemd/system/mysql-foo.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sun 2021-03-21 13:20:12 UTC; 22s ago
    Process: 1006 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
    Process: 1014 ExecStart=/usr/sbin/mysqld --defaults-file=/etc/mysql-foo/my.cnf --basedir=/usr (code=exited, status=1/FAILURE)
    Process: 1015 ExecStartPost=/usr/share/mysql/mysql-systemd-start (code=exited, status=0/SUCCESS)
   Main PID: 1014 (code=exited, status=1/FAILURE)

Mar 21 13:20:12 dokken systemd[1]: mysql-foo.service: Scheduled restart job, restart counter is at 5.
Mar 21 13:20:12 dokken systemd[1]: Stopped mysql_service[mysql-foo].
Mar 21 13:20:12 dokken systemd[1]: mysql-foo.service: Start request repeated too quickly.
Mar 21 13:20:12 dokken systemd[1]: mysql-foo.service: Failed with result 'exit-code'.
Mar 21 13:20:12 dokken systemd[1]: Failed to start mysql_service[mysql-foo].

🚓 Expected behavior

MySQL service should be running.

➕ Additional context

The problem seems to be a permission's issue, since when running MySQL manually with /usr/sbin/mysqld --defaults-file=/etc/mysql-foo/my.cnf --basedir=/usr the output is:

root@dokken:/# /usr/sbin/mysqld --defaults-file=/etc/mysql-foo/my.cnf --basedir=/usr
mysqld: [ERROR] Failed to open required defaults file: /etc/mysql-foo/my.cnf
mysqld: [ERROR] Fatal error in defaults handling. Program aborted!

I have confirmed that this behavior does not occur when the mysql_service is just named default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant