Awx: Adding time zone information to all Docker containers leads to AssertionError: database connection isn't set to UTC

Created on 1 Mar 2019  ยท  2Comments  ยท  Source: ansible/awx

ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • Installer
  • First Startup
SUMMARY

Adding time zone information (unequal to UTC) to all Docker containers leads to the above error message.

ENVIRONMENT
  • AWX version: 3.0.1
  • AWX install method: docker on linux
  • Ansible version: 2.7.7
  • Operating System: Ubuntu 18.04 LTS with time zone set to Europe/Berlin
  • Web Browser: Safari, Firefox, Chrome
STEPS TO REPRODUCE
  • Set use_docker_compose=true inside inventory file to get the docker-compose.yml
  • Add the following time zone information to all Docker containers inside docker-compose.yml
volumes:
  - /etc/localtime:/etc/localtime:ro
  - /etc/timezone:/etc/timezone:ro
  • Start Docker containers by executing docker-compose up -d
EXPECTED RESULTS

All Docker containers run with the local time configured inside the host system.
In my case the time zone information of the host system is set to Europe/Berlin.

ACTUAL RESULTS

After initially starting the Docker containers and logging the awx-task container the following error messages occur.

Using /etc/ansible/ansible.cfg as config file
127.0.0.1 | SUCCESS => {
    "changed": false, 
    "elapsed": 0, 
    "path": null, 
    "port": 5432, 
    "search_regex": null, 
    "state": "started"
}
Using /etc/ansible/ansible.cfg as config file
127.0.0.1 | SUCCESS => {
    "changed": false, 
    "elapsed": 0, 
    "path": null, 
    "port": 11211, 
    "search_regex": null, 
    "state": "started"
}
Using /etc/ansible/ansible.cfg as config file
127.0.0.1 | SUCCESS => {
    "changed": false, 
    "elapsed": 7, 
    "path": null, 
    "port": 5672, 
    "search_regex": null, 
    "state": "started"
}
Using /etc/ansible/ansible.cfg as config file
127.0.0.1 | SUCCESS => {
    "changed": false, 
    "db": "awx"
}
Operations to perform:
  Apply all migrations: auth, conf, contenttypes, main, oauth2_provider, sessions, sites, social_django, sso, taggit
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying taggit.0001_initial... OK
  Applying taggit.0002_auto_20150616_2121... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0001_initial... OK
  Applying main.0001_initial... OK
  Applying main.0002_squashed_v300_release... OK
  Applying main.0003_squashed_v300_v303_updates... OK
  Applying main.0004_squashed_v310_release... OK
  Applying conf.0001_initial... OK
  Applying conf.0002_v310_copy_tower_settings... OK
  Applying main.0005_squashed_v310_v313_updates... OK
  Applying main.0006_v320_release... OK
2019-03-01 13:43:59,343 DEBUG    awx.main.migrations Removing all Rackspace InventorySource from database.
2019-03-01 13:43:59,689 DEBUG    awx.main.migrations Removing all Azure Credentials from database.
2019-03-01 13:43:59,866 DEBUG    awx.main.migrations Removing all Azure InventorySource from database.
2019-03-01 13:44:00,040 DEBUG    awx.main.migrations Removing all InventorySource that have no link to an Inventory from database.
2019-03-01 13:44:00,755 DEBUG    awx.main.models.credential adding Machine credential type
2019-03-01 13:44:00,760 DEBUG    awx.main.models.credential adding Source Control credential type
2019-03-01 13:44:00,764 DEBUG    awx.main.models.credential adding Vault credential type
2019-03-01 13:44:00,767 DEBUG    awx.main.models.credential adding Network credential type
2019-03-01 13:44:00,771 DEBUG    awx.main.models.credential adding Amazon Web Services credential type
2019-03-01 13:44:00,774 DEBUG    awx.main.models.credential adding OpenStack credential type
2019-03-01 13:44:00,777 DEBUG    awx.main.models.credential adding VMware vCenter credential type
2019-03-01 13:44:00,781 DEBUG    awx.main.models.credential adding Red Hat Satellite 6 credential type
2019-03-01 13:44:00,784 DEBUG    awx.main.models.credential adding Red Hat CloudForms credential type
2019-03-01 13:44:00,787 DEBUG    awx.main.models.credential adding Google Compute Engine credential type
2019-03-01 13:44:00,790 DEBUG    awx.main.models.credential adding Microsoft Azure Resource Manager credential type
2019-03-01 13:44:00,794 DEBUG    awx.main.models.credential adding Insights credential type
2019-03-01 13:44:00,797 DEBUG    awx.main.models.credential adding Red Hat Virtualization credential type
2019-03-01 13:44:00,801 DEBUG    awx.main.models.credential adding Ansible Tower credential type
  Applying main.0007_v320_data_migrations... OK
  Applying main.0008_v320_drop_v1_credential_fields... OK
  Applying main.0009_v322_add_setting_field_for_activity_stream... OK
  Applying main.0010_v322_add_ovirt4_tower_inventory... OK
  Applying main.0011_v322_encrypt_survey_passwords... OK
Traceback (most recent call last):
  File "/usr/bin/awx-manage", line 11, in <module>
    load_entry_point('awx==3.0.1.0', 'console_scripts', 'awx-manage')()
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/__init__.py", line 140, in manage
    execute_from_command_line(sys.argv)
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/commands/migrate.py", line 204, in handle
    fake_initial=fake_initial,
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/migrations/executor.py", line 115, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/migrations/migration.py", line 129, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/migrations/operations/special.py", line 193, in database_forwards
    self.code(from_state.apps, schema_editor)
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/migrations/_credentialtypes.py", line 208, in add_azure_cloud_environment_field
    name='Microsoft Azure Resource Manager')
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/models/query.py", line 374, in get
    num = len(clone)
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/models/query.py", line 232, in __len__
    self._fetch_all()
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/models/query.py", line 1121, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/models/query.py", line 62, in __iter__
    for row in compiler.results_iter(results):
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 844, in results_iter
    for rows in results:
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 1289, in cursor_iter
    sentinel):
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 1288, in <lambda>
    for rows in iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)),
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/utils.py", line 101, in inner
    return func(*args, **kwargs)
  File "/var/lib/awx/venv/awx/lib64/python3.6/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
Traceback (most recent call last):
  File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
psycopg2.IntegrityError: null value in column "last_login" violates not-null constraint
DETAIL:  Failing row contains (1, pbkdf2_sha256$36000$Ssyf1jrhIpg6$yx33D41DLSTrct2pi8KvAOddXhIjC9x..., null, t, awxadam, , , root@localhost, t, t, 2019-03-01 13:44:12.134472+01).
ADDITIONAL INFORMATION
installer bug

All 2 comments

Exact same issue here
Is there a way to configure the tz we want to use with db connection ?

This is an unsupported scenario.

Was this page helpful?
0 / 5 - 0 ratings