taigaio/taiga-back

[BUG] docker-compose AssertionError("database connection isn't set to UTC")

tdobrovolny opened this issue · 1 comments

database connection isn't set to UTC

On the run of docker-compose up container taiga-docker_taiga-back_1 exit with exit code 1. Failed migration users.0007_auto_20150209_1611 with AssertionError: database connection isn't set to UTC

This is probably the same case as described in https://stackoverflow.com/questions/68024060/assertionerror-database-connection-isnt-set-to-utc

I use PostgreSQL server 14.2 on Debian.

Database was created with command:
create database taiga with owner taiga ; alter database taiga set timezone to 'UTC' ;
or
create database taiga with owner = taiga encoding = 'utf-8' locale = 'en_US.utf8' template = 'template0' ; alter database taiga set timezone to 'UTC' ;

postgresql.conf contains settings:

timezone = 'Europe/Prague'
lc_messages = 'cs_CZ.utf8'
lc_monetary = 'cs_CZ.utf8'
lc_numeric = 'cs_CZ.utf8'
lc_time = 'cs_CZ.utf8'

How can we reproduce the behavior

Use this guide: https://resources.taiga.io/30min-setup/

  • clone repository
  • checkout stable (commit id bd87d40f3c22def83ea6a502d3f16797c2933b2e)
  • edit docker-compose.yml
  • launch-taiga.sh

Workarounds

I don't know

taiga-docker_taiga-back_1 log

Executing pending migrations
Operations to perform:
  Apply all migrations: admin, attachments, auth, bitbucket, contact, contenttypes, custom_attributes, djmail, easy_thumbnails, epics, external_apps, feedback, github, gitlab, gogs, history, issues, likes, milestones, notifications, projects, references, sessions, settings, tasks, telemetry, timeline, token_denylist, users, userstorage, userstories, votes, webhooks, wiki
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying users.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying users.0002_auto_20140903_0916... OK
  Applying projects.0001_initial... OK
  Applying projects.0002_auto_20140903_0920... OK
  Applying attachments.0001_initial... OK
  Applying attachments.0002_add_size_and_name_fields... OK
  Applying attachments.0003_auto_20150114_0954... OK
  Applying attachments.0004_auto_20150508_1141... OK
  Applying attachments.0005_attachment_sha1... OK
  Applying attachments.0006_auto_20160617_1233... OK
  Applying attachments.0007_attachment_from_comment... OK
  Applying attachments.0008_auto_20170201_1053... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0001_initial... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying users.0003_auto_20140903_0925... OK
  Applying users.0004_auto_20140913_1914... OK
  Applying users.0005_alter_user_photo... OK
  Applying users.0006_auto_20141030_1132... OK
  Applying bitbucket.0001_initial... OK
  Applying milestones.0001_initial... OK
  Applying issues.0001_initial... OK
  Applying userstories.0001_initial... OK
  Applying userstories.0002_auto_20140903_1301... OK
  Applying userstories.0003_userstory_order_fields... OK
  Applying userstories.0004_auto_20141001_1817... OK
  Applying userstories.0005_auto_20141009_1656... OK
  Applying userstories.0006_auto_20141014_1524... OK
  Applying userstories.0007_userstory_external_reference... OK
  Applying userstories.0008_auto_20141210_1107... OK
  Applying userstories.0009_remove_userstory_is_archived... OK
  Applying projects.0003_auto_20140913_1710... OK
  Applying projects.0004_auto_20141002_2337... OK
  Applying projects.0005_membership_invitation_extra_text... OK
  Applying notifications.0001_initial... OK
  Applying history.0001_initial... OK
  Applying history.0002_auto_20140916_0936... OK
  Applying history.0003_auto_20140917_1405... OK
  Applying history.0004_historyentry_is_hidden... OK
  Applying notifications.0002_historychangenotification... OK
  Applying notifications.0003_auto_20141029_1143... OK
  Applying notifications.0004_watched... OK
  Applying userstories.0010_remove_userstory_watchers... OK
  Applying userstories.0011_userstory_tribe_gig... OK
  Applying tasks.0001_initial... OK
  Applying tasks.0002_tasks_order_fields... OK
  Applying tasks.0003_task_external_reference... OK
  Applying tasks.0004_auto_20141210_1107... OK
  Applying tasks.0005_auto_20150114_0954... OK
  Applying tasks.0006_auto_20150623_1923... OK
  Applying tasks.0007_auto_20150629_1556... OK
  Applying tasks.0008_remove_task_watchers... OK
  Applying tasks.0009_auto_20151104_1131... OK
Traceback (most recent call last):
  File "manage.py", line 17, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/opt/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/venv/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/venv/lib/python3.7/site-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/opt/venv/lib/python3.7/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "/opt/venv/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 234, in handle
    fake_initial=fake_initial,
  File "/opt/venv/lib/python3.7/site-packages/django/db/migrations/executor.py", line 117, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/opt/venv/lib/python3.7/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/opt/venv/lib/python3.7/site-packages/django/db/migrations/executor.py", line 245, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/opt/venv/lib/python3.7/site-packages/django/db/migrations/migration.py", line 124, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/opt/venv/lib/python3.7/site-packages/django/db/migrations/operations/special.py", line 190, in database_forwards
    self.code(from_state.apps, schema_editor)
  File "/taiga-back/taiga/users/migrations/0007_auto_20150209_1611.py", line 18, in migrate_github_id
    for user in User.objects.all():
  File "/opt/venv/lib/python3.7/site-packages/django/db/models/query.py", line 274, in __iter__
    self._fetch_all()
  File "/opt/venv/lib/python3.7/site-packages/django/db/models/query.py", line 1242, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/opt/venv/lib/python3.7/site-packages/django/db/models/query.py", line 55, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "/opt/venv/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1175, in execute_sql
    return list(result)
  File "/opt/venv/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1554, in cursor_iter
    for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel):
  File "/opt/venv/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1554, in <lambda>
    for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel):
  File "/opt/venv/lib/python3.7/site-packages/django/db/utils.py", line 96, in inner
    return func(*args, **kwargs)
  File "/opt/venv/lib/python3.7/site-packages/django/db/backends/postgresql/utils.py", line 6, in utc_tzinfo_factory
    raise AssertionError("database connection isn't set to UTC")
AssertionError: database connection isn't set to UTC
  Applying users.0007_auto_20150209_1611...

Taiga environment

Self-hosted, installed with docker

Server:

  • OS: Linux Fedora 35 amd64
  • Docker: 20.10.14, build a224086
  • PostgreSQL: 14.2 on Debian amd64 docker image on another server

Hi @tdobrovolny,

can you test with postgres 12.x?