Describe the bug
Trying to run a totally clean setup on mysql (8) and creation of tables etc fails.
To Reproduce
DB similar to this
mysql:
image: mysql:8.0.35
command: --default-authentication-plugin=mysql_native_password
restart: unless-stopped
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 2s
timeout: 20s
retries: 10
environment:
MYSQL_DATABASE: 'karrio'
MYSQL_USER: 'user'
MYSQL_PASSWORD: 'password'
MYSQL_ROOT_PASSWORD: 'password'
ports:
- '3306:3306'
expose:
- '3306'
A karrio service with mysql dependency added, such as this
(hacked in for now trying to see if it all works, see also #726)
FROM karrio/server:2024.9.15
USER root
RUN apt install -y pkg-config default-libmysqlclient-dev
RUN python -m venv /karrio/venv
ENV PATH="/karrio/venv/bin:$PATH"
RUN cd /karrio/ && \
pip install --upgrade pip && \
pip install dumb-init && \
pip install mysqlclient
USER karrio
And an API service that is as follows
karrio-api:
container_name: karrio.api
# image: karrio/server:2024.9.15
build:
dockerfile: ./karrio.Dockerfile
restart: unless-stopped
ports:
- 8086:8086
depends_on:
- mysql
- redis
environment:
DEBUG_MODE: "True"
SECRET_KEY: xxxx
REDIS_HOST: redis
REDIS_PORT: 6379
DATABASE_HOST: mysql
DATABASE_PORT: 3306
DATABASE_NAME: karrio
DATABASE_ENGINE: mysql
DATABASE_USERNAME: user
DATABASE_PASSWORD: password
KARRIO_HTTP_PORT: 8086
You end up with the following sample errors
karrio.api | Applying events.0001_initial... OK
karrio.api | Applying events.0002_event... OK
karrio.api | Applying events.0003_auto_20220303_1210... OK
karrio.api | Applying events.0004_custom_migration_2022_4... OK
karrio.api | Traceback (most recent call last):
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 87, in _execute
karrio.api | return self.cursor.execute(sql)
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/backends/mysql/base.py", line 75, in execute
karrio.api | return self.cursor.execute(query, args)
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/MySQLdb/cursors.py", line 179, in execute
karrio.api | res = self._query(mogrified_query)
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/MySQLdb/cursors.py", line 330, in _query
karrio.api | db.query(q)
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/MySQLdb/connections.py", line 265, in query
karrio.api | _mysql.connection.query(self, query)
karrio.api | MySQLdb.OperationalError: (3757, 'Cannot create a functional index on an expression that returns a BLOB or TEXT. Please consider using CAST.')
karrio.api |
karrio.api |
karrio.api | The above exception was the direct cause of the following exception:
karrio.api |
karrio.api |
karrio.api | Traceback (most recent call last):
karrio.api | File "/karrio/venv/bin/karrio", line 8, in <module>
karrio.api | sys.exit(main())
karrio.api | ^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/karrio/server/__main__.py", line 17, in main
karrio.api | execute_from_command_line(sys.argv)
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
karrio.api | utility.execute()
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute
karrio.api | self.fetch_command(subcommand).run_from_argv(self.argv)
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/core/management/base.py", line 412, in run_from_argv
karrio.api | self.execute(*args, **cmd_options)
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/core/management/base.py", line 458, in execute
karrio.api | output = self.handle(*args, **options)
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/core/management/base.py", line 106, in wrapper
karrio.api | res = handle_func(*args, **kwargs)
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/core/management/commands/migrate.py", line 356, in handle
karrio.api | post_migrate_state = executor.migrate(
karrio.api | ^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/migrations/executor.py", line 135, in migrate
karrio.api | state = self._migrate_all_forwards(
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
karrio.api | state = self.apply_migration(
karrio.api | ^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/migrations/executor.py", line 252, in apply_migration
karrio.api | state = migration.apply(state, schema_editor)
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/migrations/migration.py", line 132, in apply
karrio.api | operation.database_forwards(
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/migrations/operations/models.py", line 894, in database_forwards
karrio.api | schema_editor.add_index(model, self.index)
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/backends/base/schema.py", line 509, in add_index
karrio.api | self.execute(index.create_sql(model, self), params=None)
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/backends/base/schema.py", line 201, in execute
karrio.api | cursor.execute(sql, params)
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 102, in execute
karrio.api | return super().execute(sql, params)
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 67, in execute
karrio.api | return self._execute_with_wrappers(
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
karrio.api | return executor(sql, params, many, context)
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute
karrio.api | with self.db.wrap_database_errors:
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
karrio.api | raise dj_exc_value.with_traceback(traceback) from exc_value
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 87, in _execute
karrio.api | return self.cursor.execute(sql)
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/backends/mysql/base.py", line 75, in execute
karrio.api | return self.cursor.execute(query, args)
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/MySQLdb/cursors.py", line 179, in execute
karrio.api | res = self._query(mogrified_query)
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/MySQLdb/cursors.py", line 330, in _query
karrio.api | db.query(q)
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/MySQLdb/connections.py", line 265, in query
karrio.api | _mysql.connection.query(self, query)
karrio.api | django.db.utils.OperationalError: (3757, 'Cannot create a functional index on an expression that returns a BLOB or TEXT. Please consider using CAST.')
karrio.api | Applying events.0005_event_event_object_idx...
karrio.api | INFO signals.py 19 Updated config constance:core:EMAIL_USE_TLS to False
The errors appear to go on
karrio.api | INFO signals.py 26 karrio.order signals registered...
karrio.api | System check identified some issues:
karrio.api |
karrio.api |
karrio.api | WARNINGS:
karrio.api | events.Event: (models.W037) MySQL does not support indexes with conditions.
karrio.api | HINT: Conditions will be ignored. Silence this warning if you don't care about it.
karrio.api | manager.Shipment: (models.W037) MySQL does not support indexes with conditions.
karrio.api | HINT: Conditions will be ignored. Silence this warning if you don't care about it.
karrio.api | tracing.TracingRecord: (models.W037) MySQL does not support indexes with conditions.
karrio.api | HINT: Conditions will be ignored. Silence this warning if you don't care about it.
karrio.api | Redis connection initialized at: redis://redis:6379/1
karrio.api | Operations to perform:
karrio.api | Apply all migrations: admin, auth, constance, contenttypes, core, data, db, documents, events, graph, iam, manager, oauth2_provider, orders, otp_email, otp_static, otp_totp, pricing, providers, rest_framework_tracking, sessions, tracing, two_factor, user
karrio.api | Running migrations:
karrio.api | Traceback (most recent call last):
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 87, in _execute
karrio.api | return self.cursor.execute(sql)
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/backends/mysql/base.py", line 75, in execute
karrio.api | return self.cursor.execute(query, args)
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/MySQLdb/cursors.py", line 179, in execute
karrio.api | res = self._query(mogrified_query)
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/MySQLdb/cursors.py", line 330, in _query
karrio.api | db.query(q)
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/MySQLdb/connections.py", line 265, in query
karrio.api | _mysql.connection.query(self, query)
karrio.api | MySQLdb.OperationalError: (3757, 'Cannot create a functional index on an expression that returns a BLOB or TEXT. Please consider using CAST.')
karrio.api |
karrio.api |
karrio.api | The above exception was the direct cause of the following exception:
karrio.api |
karrio.api |
karrio.api | Traceback (most recent call last):
karrio.api | File "/karrio/venv/bin/karrio", line 8, in <module>
karrio.api | sys.exit(main())
karrio.api | ^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/karrio/server/__main__.py", line 17, in main
karrio.api | execute_from_command_line(sys.argv)
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
karrio.api | utility.execute()
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute
karrio.api | self.fetch_command(subcommand).run_from_argv(self.argv)
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/core/management/base.py", line 412, in run_from_argv
karrio.api | self.execute(*args, **cmd_options)
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/core/management/base.py", line 458, in execute
karrio.api | output = self.handle(*args, **options)
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/core/management/base.py", line 106, in wrapper
karrio.api | res = handle_func(*args, **kwargs)
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/core/management/commands/migrate.py", line 356, in handle
karrio.api | post_migrate_state = executor.migrate(
karrio.api | ^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/migrations/executor.py", line 135, in migrate
karrio.api | state = self._migrate_all_forwards(
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
karrio.api | state = self.apply_migration(
karrio.api | ^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/migrations/executor.py", line 252, in apply_migration
karrio.api | state = migration.apply(state, schema_editor)
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/migrations/migration.py", line 132, in apply
karrio.api | operation.database_forwards(
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/migrations/operations/models.py", line 894, in database_forwards
karrio.api | schema_editor.add_index(model, self.index)
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/backends/base/schema.py", line 509, in add_index
karrio.api | self.execute(index.create_sql(model, self), params=None)
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/backends/base/schema.py", line 201, in execute
karrio.api | cursor.execute(sql, params)
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 102, in execute
karrio.api | return super().execute(sql, params)
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 67, in execute
karrio.api | return self._execute_with_wrappers(
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
karrio.api | return executor(sql, params, many, context)
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute
karrio.api | with self.db.wrap_database_errors:
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
karrio.api | raise dj_exc_value.with_traceback(traceback) from exc_value
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 87, in _execute
karrio.api | return self.cursor.execute(sql)
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/django/db/backends/mysql/base.py", line 75, in execute
karrio.api | return self.cursor.execute(query, args)
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/MySQLdb/cursors.py", line 179, in execute
karrio.api | res = self._query(mogrified_query)
karrio.api | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/MySQLdb/cursors.py", line 330, in _query
karrio.api | db.query(q)
karrio.api | File "/karrio/venv/lib/python3.11/site-packages/MySQLdb/connections.py", line 265, in query
karrio.api | _mysql.connection.query(self, query)
karrio.api | django.db.utils.OperationalError: (3757, 'Cannot create a functional index on an expression that returns a BLOB or TEXT. Please consider using CAST.')
karrio.api | Applying events.0005_event_event_object_idx...
karrio.api | INFO signals.py 14 karrio.core signals registered...
and
karrio.api | INFO signals.py 15 karrio.pricing signals registered...
karrio.api | INFO signals.py 26 karrio.order signals registered...
karrio.api | System check identified some issues:
karrio.api |
karrio.api |
karrio.api | WARNINGS:
karrio.api | events.Event: (models.W037) MySQL does not support indexes with conditions.
karrio.api | HINT: Conditions will be ignored. Silence this warning if you don't care about it.
karrio.api | manager.Shipment: (models.W037) MySQL does not support indexes with conditions.
karrio.api | HINT: Conditions will be ignored. Silence this warning if you don't care about it.
karrio.api | tracing.TracingRecord: (models.W037) MySQL does not support indexes with conditions.
karrio.api | HINT: Conditions will be ignored. Silence this warning if you don't care about it.
karrio.api | Redis connection initialized at: redis://redis:6379/1
karrio.api | Operations to perform:
etc
Expected behavior
I would expect installation to succeed.
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too