Waiting for environment to be ready. It can take a few minutes

Hi @nolive

Thanks for the guidance. After trying the first steps
Try this first:
Stop your front-end containers, ./run.py -cf stop
Enter a one off KPI container with ./run.py -cf run --rm kpi bash.
Then inside the container.

./manage migrate auth 

given below, an error occurred.

root@kpi:/srv/src/kpi# python manage.py migrate
Traceback (most recent call last):
File “/srv/src/kpi/manage.py”, line 10, in
execute_from_command_line(sys.argv)
File “/opt/venv/lib/python3.10/site-packages/django/core/management/init.py”, line 442, in execute_from_command_line
utility.execute()
File “/opt/venv/lib/python3.10/site-packages/django/core/management/init.py”, line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File “/opt/venv/lib/python3.10/site-packages/django/core/management/base.py”, line 412, in run_from_argv
self.execute(*args, **cmd_options)
File “/opt/venv/lib/python3.10/site-packages/django/core/management/base.py”, line 458, in execute
output = self.handle(*args, **options)
File “/opt/venv/lib/python3.10/site-packages/django/core/management/base.py”, line 106, in wrapper
res = handle_func(*args, **kwargs)
File “/opt/venv/lib/python3.10/site-packages/django/core/management/commands/migrate.py”, line 120, in handle
executor.loader.check_consistent_history(connection)
File “/opt/venv/lib/python3.10/site-packages/django/db/migrations/loader.py”, line 327, in check_consistent_history
raise InconsistentMigrationHistory(
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration auth.0003_alter_user_email_max_length is applied before its dependency auth.0002_alter_permission_name_max_length on database ‘default’.

The second option you gave was also tried, but the same KPI log was found below the log.

If it does not work, try to downgrade the version of KoboToolbox first.

./run.py --stop 
./run.py --upgrade 2.024.19d (answer questions)
# wait for containers to be up...  
./run.py --stop 
./run.py --auto-upgrade 2.024.25c 
./run.py 

docker logs kobofe_kpi_1
KPI initializing…
Waiting for container mongo.
wait-for-it: waiting 40 seconds for mongo.kobo.private:27017
wait-for-it: mongo.kobo.private:27017 is available after 0 seconds
Container mongo up.
Waiting for container postgres.
wait-for-it: waiting 20 seconds for postgres.kobo.private:5432
wait-for-it: postgres.kobo.private:5432 is available after 1 seconds
Container postgres up.
Waiting for Postgres service.
postgres.kobo.private:5432 - accepting connections
Postgres service running; ensuring fieldmasterkf database exists and has PostGIS extensions…
ERROR: database “fieldmasterkf” already exists
You are now connected to database “fieldmasterkf” as user “kobo”.
NOTICE: extension “postgis” already exists, skipping
CREATE EXTENSION
NOTICE: extension “postgis_topology” already exists, skipping
CREATE EXTENSION
NOTICE: extension “fuzzystrmatch” already exists, skipping
CREATE EXTENSION
NOTICE: extension “postgis_tiger_geocoder” already exists, skipping
CREATE EXTENSION
Postgres database fieldmasterkf ready for use!
Postgres service running; ensuring fieldmasterkc database exists and has PostGIS extensions…
ERROR: database “fieldmasterkc” already exists
You are now connected to database “fieldmasterkc” as user “kobo”.
NOTICE: extension “postgis” already exists, skipping
CREATE EXTENSION
NOTICE: extension “postgis_topology” already exists, skipping
CREATE EXTENSION
NOTICE: extension “fuzzystrmatch” already exists, skipping
CREATE EXTENSION
NOTICE: extension “postgis_tiger_geocoder” already exists, skipping
CREATE EXTENSION
Postgres database fieldmasterkc ready for use!
Running migrations…
Traceback (most recent call last):
File “/srv/src/kpi/manage.py”, line 10, in
Exception while running run() in ‘scripts.fix_migrations_for_kobocat_django_app’
execute_from_command_line(sys.argv)
File “/opt/venv/lib/python3.10/site-packages/django/core/management/init.py”, line 442, in execute_from_command_line
utility.execute()
File “/opt/venv/lib/python3.10/site-packages/django/core/management/init.py”, line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File “/opt/venv/lib/python3.10/site-packages/django_extensions/management/email_notifications.py”, line 65, in run_from_argv
super().run_from_argv(argv)
File “/opt/venv/lib/python3.10/site-packages/django/core/management/base.py”, line 412, in run_from_argv
self.execute(*args, **cmd_options)
File “/opt/venv/lib/python3.10/site-packages/django_extensions/management/email_notifications.py”, line 77, in execute
super().execute(*args, **options)
File “/opt/venv/lib/python3.10/site-packages/django/core/management/base.py”, line 458, in execute
output = self.handle(*args, **options)
File “/opt/venv/lib/python3.10/site-packages/django_extensions/management/utils.py”, line 62, in inner
ret = func(self, *args, **kwargs)
File “/opt/venv/lib/python3.10/site-packages/django_extensions/management/commands/runscript.py”, line 281, in handle
run_script(script_mod, *script_args)
File “/opt/venv/lib/python3.10/site-packages/django_extensions/management/commands/runscript.py”, line 159, in run_script
exit_code = mod.run(*script_args)
File “/srv/src/kpi/scripts/fix_migrations_for_kobocat_django_app.py”, line 9, in run
if migrate_custom_user_model():
File “/srv/src/kpi/scripts/fix_migrations_for_kobocat_django_app.py”, line 80, in migrate_custom_user_model
raise Exception(‘Run ./manage.py migrate auth first’)
Exception: Run ./manage.py migrate auth first

""Hi, @Rejeesh , you cannot upgrade direct since your instance is older than 2.022.44

You have to follow the [upgrade process] as is, (kobo-docker/doc/November-2022-Upgrade.md at master · kobotoolbox/kobo-docker · GitHub"“”

I have followed the suggested steps to upgrade PostgreSQL and have also completed the MongoDB upgrade. Everything is working, and the database has been upgraded without any bugs. The final step is to run.py, but I am encountering a runtime error. its code broken.

Created a new version of KoboToolbox and plan to attach my old Vols backup this have full conversantion and screenshots.

After that, I will locally test with an upgraded dump file. However, we are currently facing problems with Django migration. I need my VMWare DB upgrade and code to work; otherwise, I need to localize it. Which option is easier to resolve? Please help me