V1.0.6: zrok-controller wont start (agent_enrollments does not exist)

Zrok controller starts with no error in v1.0.4 [3f5db643].

But v1.0.6 is different. It seems that I need to enroll the zrok-controller somehow.

Jun 30 12:21:56 buratino zrok[3964]: {"file":"/__w/zrok/zrok/controller/overview.go:41","func":"github.com/openziti/zrok/controller.(*overviewHandler).Handle","level":"error","msg":"error checking agent enrollment for environment 'token' (user@domain.name): pq: relation \"agent_enrollments\" does not exist","time":"2025-06-30T12:21:56.803Z"}

Somehow you've missed a database migration. In v1.0.5 a new agents_enrollments table was added.

Do you have store > disable_auto_migration turned on in your zrok controller?

So I have

store:
  path:                           "host=remote.database.name user=user password=**** dbname=zrok"
  type:                           "postgres"
  disable_auto_migration:         true
  enable_locking:                 true

Apparently you suggest to change the setting to perform the migration.
I have an array of 5 zrok-controllers. I would prefer to upgrade only one of them from v1.0.4 to v1.0.6.
I hope that by setting the store.disable_auto_migration=false and launching zrok v1.0.6 I will not break the remaining instances running zrok v1.0.4.

I have seen the release notes for v1.0.5 but I have not understood why zrok-controller can not start without enrollment. So far zrok-controllers do not require any environment.

You can use the zrok admin migrate command to manually perform the migration and leave the disable_auto_migration setting alone.

We don't necessarily support running mixed versions of zrok against the same database. In this case, the migration is purely additive and should be fine.

But in future cases that might not be the possible.

It's not an enrollment it can't start without. It's a table that's missing from the database that the logic in the zrok controller expects to be there or it's SQL queries fail.

I have tried to start zrok 1.0.6 with disable_auto_migration=false.

Jul 05 09:43:36 hostname zrok[20342]: panic: error opening store: error migrating database 'host=127.0.0.1 user=user password=passwd dbname=db': error running migrations: pq: relation "accounts" already exists handling 000_base.sql

So I am back to v1.0.4 again.

zrok admin migrate ctrl.yml does not help.

Without seeing your database it's hard to say what's going on here, but it appears that your migrations table might be corrupted or missing, because it's trying to apply the very first migration like it's a new database.

                 List of relations
 Schema |           Name           | Type  | Owner 
--------+--------------------------+-------+-------
 public | access_grants            | table | zrok
 public | account_requests         | table | zrok
 public | accounts                 | table | zrok
 public | applied_limit_classes    | table | zrok
 public | bandwidth_limit_journal  | table | zrok
 public | environments             | table | zrok
 public | frontend_grants          | table | zrok
 public | frontends                | table | zrok
 public | invite_tokens            | table | zrok
 public | limit_check_locks        | table | zrok
 public | limit_classes            | table | zrok
 public | migrations               | table | zrok
 public | organization_members     | table | zrok
 public | organizations            | table | zrok
 public | password_reset_requests  | table | zrok
 public | shares                   | table | zrok
 public | skip_interstitial_grants | table | zrok
(17 rows)

select count(*) from migrations;
 count 
-------
     0
(1 row)

The table migrations is empty. yes.

Is it possible to repair the table? Could you say what data I miss in the table.