Title
#fleet
d

Daniel Cross

05/16/2022, 4:44 AM
Hello, trying to follow the docs for setting up a server. I’m running the
fleet prepare db
command, but it doesn’t output anything, and looks like the tables are not initialised. Any tips?
# /usr/bin/fleet prepare db  --mysql_address=127.0.0.1:3306  --mysql_database=fleet  --mysql_username=root --mysql_password=REDACTED
#

mysql> use fleet;
Database changed
mysql> show tables;
+-------------------------+
| Tables_in_fleet         |
+-------------------------+
| migration_status_data   |
| migration_status_tables |
+-------------------------+
2 rows in set (0.00 sec)

mysql> select * from migration_status_data;
+----+------------+------------+---------------------+
| id | version_id | is_applied | tstamp              |
+----+------------+------------+---------------------+
|  1 |          0 |          1 | 2022-05-13 07:08:27 |
+----+------------+------------+---------------------+
1 row in set (0.00 sec)

mysql> select * from migration_status_tables;
+----+------------+------------+---------------------+
| id | version_id | is_applied | tstamp              |
+----+------------+------------+---------------------+
|  1 |          0 |          1 | 2022-05-13 07:08:27 |
+----+------------+------------+---------------------+
1 row in set (0.00 sec)
Lucas Rodriguez

Lucas Rodriguez

05/16/2022, 4:07 PM
Hi @Daniel Cross. From the migration tables content it does look like an uninitialized database... Couple of questions:1. No output at all
/usr/bin/fleet prepare db
? (try adding
--logging_debug
) 2. What's the fleet version?
/usr/bin/fleet version
3. Have you set Fleet's MYSQL environment-variables/flags when running
/usr/bin/fleet prepare db
? (to connect to the
127.0.0.1:3306
instance)
d

Daniel Cross

05/17/2022, 3:25 AM
Hi @Lucas Rodriguez 1. Absolutely nothing even when adding --logging_debug 2.
fleet version 4.14.0
3. I’ve set the flags as per docs (as pasted above)
--mysql_address 127.0.0.1:3306  --mysql_database=fleet  --mysql_username=root --mysql_password=XXX
3:26 AM
I can confirm I can log in with the password specified by manual login, and it must be doing something as you can see those migration tables.
3:32 AM
some extra info:
# uname -a
Linux ip-10-100-4-62.eu-west-1.compute.internal 5.16.20-100.fc34.x86_64 #1 SMP PREEMPT Wed Apr 13 22:10:30 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
# getenforce
Permissive
# cat /etc/fedora-release
Fedora release 34 (Thirty Four)
Lucas Rodriguez

Lucas Rodriguez

05/17/2022, 12:22 PM
Absolutely nothing even when adding --logging_debug
OK, let's try re-doing the following steps: (Assuming that you have no data to lost in MySQL
fleet
database.) 1. Run the following in a mysql prompt
drop database if exists fleet; create database fleet;
2. Run
/usr/bin/fleet prepare db --mysql_address=127.0.0.1:3306  --mysql_database=fleet  --mysql_username=root --mysql_password=REDACTED
. It should run for a couple of minutes and output
Migrations completed.
and exit cleanly. 3. Check the prepare command exited successfully:
echo $?
(should print
0
). 4. Log in again to mysql and run
use fleet
and run
select * from migration_status_tables;
.
d

Daniel Cross

05/17/2022, 9:22 PM
This looks much better. So dropping the db and starting fresh helped here - I guess ‘prepare db’ hit something in those migration tables and silently failed 🤔
Lucas Rodriguez

Lucas Rodriguez

05/17/2022, 9:40 PM
Glad it helped!