fleetdm / fleet

Open-source platform for IT, security, and infrastructure teams. (Linux, macOS, Chrome, Windows, cloud, data center)
https://fleetdm.com
Other
3.01k stars 418 forks source link

Fleet migration fails on missing contraint: nano_enrollments_ibfk_2 in nano_users table. #19943

Closed mattj-monad closed 3 months ago

mattj-monad commented 3 months ago

Fleet version: v4.52.0 (and v4.51.0)

Web browser and operating system: Kubernetes

💥  Actual behavior

fleet-migration-rvmnz 2024/06/21 22:56:56 [2022-09-14] Create Host Disks Table                                                                                                                                                                                                    
fleet-migration-rvmnz 2024/06/21 22:56:56 [2022-09-15] Apple MDM Tables
fleet-migration-rvmnz 2024/06/21 22:56:56 FAIL 20220915165115_AppleMDMTables.go (failed to apply nanomdm schema: Error 6125 (HY000): Failed to add the foreign key constraint. Missing unique key for constraint 'nano_enrollments_ibfk_2' in the referenced table 'nano_users'),

🧑‍💻  Steps to reproduce

  1. Deploy helm chart into a new kubernetes (eks) cluster
  2. wait for migration job to fail
  3. see output.

🕯️ More info (optional)

Bitnami mysql helm chart:

chart: mysql-11.1.4
App version: 8.4.0

I know k8s isn't an officially supported deployment method anymore, but this doesn't seem like a bug related to the deployment method, rather an issue with the database migrations.

lucasmrod commented 3 months ago

Hi @mattj-monad!

I can see the same error here: https://github.com/fleetdm/fleet/issues/18900#issuecomment-2107506604. (It seems to be related to the version of MySQL.)

Let us know if changing the MySQL version to a supported version fixes the issue.

Fleet is tested with MySQL 5.7.21 and 8.0.28. Newer versions of MySQL 5.7 and MySQL 8 typically work well. AWS Aurora requires at least version 2.10.0. Please avoid using MariaDB or other MySQL variants that are not officially supported. Compatibility issues have been identified with MySQL variants, and these may not be addressed in future Fleet releases.

georgekarrv commented 3 months ago

I can confirm I just applied this helm chart with mysql chart version 9.12.5 app version 8.0.34 and have no issues. Can you try a chart w/ mysql app version 8.0.x and let us know if you have any issues?

mattj-monad commented 3 months ago

y'all are awesome. I'll be able to test this later today and will report back. Really appreciate it, both of you!

sharon-fdm commented 3 months ago

@lucasmrod moved this to waiting column. Please close if this is solved by the supported MySQL.

mattj-monad commented 3 months ago

update; I have not been able to test this yet, as some high urgency items have come up. I'm going to assume this is the fix until proven otherwise and close the ticket for now. Appreciate the help!

fleet-release commented 3 months ago

Migration fails, constraints lost, In cloud city, no more the cost. Fleet's journey, now robust.