I just updated my Foreman server and reboot, then this happened when I accessed the web console:

Service unavailable ERF64-6496 [Foreman::MaintenanceException]: There are migrations pending in the system.

This was the first time I’ve seen this message, and possibly because I haven’t done the update frequently enough. Fortunately, according to this blog post, it should be relatively easy to fix.

[root@foreman ~]# sudo foreman-rake db:migrate
API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.
== 20210525144427 EnforceUniqueTemplates: migrating ===========================
-- add_index(:templates, [:type, :name], {:unique=>true})
   -> 0.0232s
== 20210525144427 EnforceUniqueTemplates: migrated (0.0341s) ==================

== 20210610131920 RestrictSendmailLocation: migrating =========================
== 20210610131920 RestrictSendmailLocation: migrated (0.0016s) ================

[root@foreman ~]# sudo foreman-rake db:seed
API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.
User with login admin already exists, not seeding as admin.

As suggested, I also ran apipie:cache rake task to generate cache.

[root@foreman ~]# sudo foreman-rake apipie:cache
2021-06-29 20:58:23 +1000 | Started
2021-06-29 20:58:25 +1000 | Documents loaded...
2021-06-29 20:58:25 +1000 | Processing docs for
2021-06-29 20:58:38 +1000 | Processing docs for ca
2021-06-29 20:58:52 +1000 | Processing docs for cs_CZ
2021-06-29 20:59:06 +1000 | Processing docs for de
2021-06-29 20:59:20 +1000 | Processing docs for en
2021-06-29 20:59:33 +1000 | Processing docs for en_GB
2021-06-29 20:59:47 +1000 | Processing docs for es
2021-06-29 21:00:01 +1000 | Processing docs for fr
2021-06-29 21:00:15 +1000 | Processing docs for gl
2021-06-29 21:00:29 +1000 | Processing docs for it
2021-06-29 21:00:42 +1000 | Processing docs for ja
2021-06-29 21:00:55 +1000 | Processing docs for ko
2021-06-29 21:01:09 +1000 | Processing docs for nl_NL
2021-06-29 21:01:22 +1000 | Processing docs for pl
2021-06-29 21:01:35 +1000 | Processing docs for pt_BR
2021-06-29 21:01:49 +1000 | Processing docs for ru
2021-06-29 21:02:02 +1000 | Processing docs for sv_SE
2021-06-29 21:02:16 +1000 | Processing docs for zh_CN
2021-06-29 21:02:29 +1000 | Processing docs for zh_TW
2021-06-29 21:02:42 +1000 | Finished

That was it. After that I could navigate to Foreman login page and everything worked as normal.

Reference: