Hello, I've updated to the last version. I've chan...
# fleet
e
Hello, I've updated to the last version. I've changed the old env variables (KOLIDE_ format) to new format. But when doing the migration it gives me this error:
Copy code
2021/07/01 11:29:41 FAIL 20210601000001_CreateTeamsTables.go (alter hosts: Error 1005: Can't create table `fleet`.`hosts` (errno: 121 "Duplicate key on write or update")), quitting migration.
z
Which version are you upgrading from? What version of MySQL are you running?
e
I don't remember, previous to 4.0.0
I was still using KOLIDE_ env variables
MySQL Version: 5.7
z
I can see now that the identifier we use in this migration violates the global uniqueness requirement as mentioned in the MySQL docs (https://dev.mysql.com/doc/refman/5.7/en/create-table-foreign-keys.html)
The CONSTRAINT symbol value, if defined, must be unique in the database. A duplicate symbol results in an error similar to: ERROR 1005 (HY000): Can't create table 'test.fk1' (errno: 121).
I am not sure why this migration works in our development and testing environments. Let us think about how to best address this and make a 4.0.1 release.
Can you give me any more information about your MySQL database? It would be helpful if we could understand what configuration causes this issue so that we can reproduce it locally.
e
I'm using a Docker Container with MariaDB. I've tried to use a plain new database and i've got the same error
z
Ah, maybe MariaDB enforces it and plain MySQL doesn't. Let me see if that helps me reproduce.
e
I'll try with a mysql container in the same machine
ty 1
With mysql container it's working with the last version.
z
Super helpful, thank you. I was able to reproduce it locally and fix the issue. Going to cut a 4.0.1 when this is merged https://github.com/fleetdm/fleet/pull/1280
e
Your welcome, glad to help!
z
We published 4.0.1, please give it a try now 🙂
e
Did you publish the docker image? I'm using the fleetdm/fleet image
Hello, now there's another error
Copy code
2021/07/02 11:26:08 FAIL 20210601000002_AddRolesToInvites.go (create invite_teams: Error 1005: Can't create table `fleet`.`invite_teams` (errno: 121 "Duplicate key on write or update")), quitting migration.
r
Same error here.. using binary. Database: mysql Ver 15.1 Distrib 10.3.28-MariaDB, for Linux (x86_64) using readline 5.1
{"component":"service","err":"list users: missing destination name global_role in *[]*kolide.User","level":"info","method":"ListUsers","took":"698.826µs","ts":"2021-07-02T14:26:11.197380836Z","user":"none"}
Error fetching setup requirement: list users: missing destination name global_role in *[]*kolide.User
this 1
This error is when I start the old version...
e
Maybe it's happening before 4.0?
r
I tried to upgrade from previous version, with 4.0.0 same error as yours.. with 4.0.1 same error as yours, but now fleet (previous version) can't start... seems like it is between versions.
z
My apologies. It looks like you both ended up in a state that is only possible after hitting the error in v4.0.0 and then upgrading to v4.0.1. Things should be fixed in v4.0.1 for any MariaDB users that did not try v4.0.0. To fix your current issue, please run the following query in your database and then run the v4.0.1 migrations again.
Copy code
ALTER TABLE user_teams DROP FOREIGN KEY fk_team_id, ADD FOREIGN KEY fk_user_teams_team_id (team_id) REFERENCES teams (id) ON DELETE CASCADE ON UPDATE CASCADE;
r
No problem. Thank you for this product. It solved my problem. It worked for me... just having an error with the auth_jwt_key on the new version...
Started successfully without the auth_jwt_key option. Haven't tried to enroll a new agent still.
e
That worked great. Thanks!