Setup
I have change the docker-compose.yml
as below, and it can start-up the two containers.
services:
db:
container_name: kiwi_db
image: mysql:latest
volumes:
- db_data:/var/lib/kiwi_mysql/data
# workaround for missing charset & collation support
# https://github.com/sclorg/mariadb-container/pull/125
- ./99-charset.sh:/usr/share/container-scripts/mysql/init/99-charset.sh:Z
- ./99-charset.cnf:/usr/share/container-scripts/mysql/cnf/99-charset.cnf:Z
restart: always
environment:
MYSQL_ROOT_PASSWORD: kiwi-1s-aw3s0m3
MYSQL_DATABASE: kiwi
MYSQL_USER: kiwi
MYSQL_PASSWORD: kiwi
MYSQL_CHARSET: utf8mb4
MYSQL_COLLATION: utf8mb4_unicode_ci
web:
container_name: kiwi_web
depends_on:
- db
restart: always
image: kiwitcms/kiwi:latest
ports:
- 9001:8080
- 9443:8443
volumes:
- uploads:/Kiwi/uploads:Z
environment:
KIWI_DB_HOST: db
KIWI_DB_PORT: 3306
KIWI_DB_NAME: kiwi
KIWI_DB_USER: kiwi
KIWI_DB_PASSWORD: kiwi
KIWI_DONT_ENFORCE_HTTPS: "true"
links:
- db
volumes:
db_data:
uploads:
When I execute docker exec -it kiwi_web /Kiwi/manage.py migrate
, it will get some error message.
I am trying to change the encryption method of user password from caching_ sha2_ Password
to mysql_native_password
, but it still pop up the same error message.
Traceback of the error:
Traceback (most recent call last):
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 220, in ensure_connection
self.connect()
File "/venv/lib/python3.6/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 197, in connect
self.connection = self.get_new_connection(conn_params)
File "/venv/lib/python3.6/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/venv/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 233, in get_new_connection
return Database.connect(**conn_params)
File "/venv/lib/python3.6/site-packages/MySQLdb/__init__.py", line 130, in Connect
return Connection(*args, **kwargs)
File "/venv/lib/python3.6/site-packages/MySQLdb/connections.py", line 185, in __init__
super().__init__(*args, **kwargs2)
MySQLdb._exceptions.OperationalError: (2059, 'Plugin caching_sha2_password could not be loaded: lib64/mariadb/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Kiwi/manage.py", line 12, in <module>
execute_from_command_line(sys.argv)
File "/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/venv/lib/python3.6/site-packages/django/core/management/base.py", line 328, in run_from_argv
self.execute(*args, **cmd_options)
File "/venv/lib/python3.6/site-packages/django/core/management/base.py", line 366, in execute
self.check()
File "/venv/lib/python3.6/site-packages/django/core/management/base.py", line 395, in check
include_deployment_checks=include_deployment_checks,
File "/venv/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 63, in _run_checks
issues = run_checks(tags=[Tags.database])
File "/venv/lib/python3.6/site-packages/django/core/checks/registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "/venv/lib/python3.6/site-packages/django/core/checks/database.py", line 10, in check_database_backends
issues.extend(conn.validation.check(**kwargs))
File "/venv/lib/python3.6/site-packages/django/db/backends/mysql/validation.py", line 9, in check
issues.extend(self._check_sql_mode(**kwargs))
File "/venv/lib/python3.6/site-packages/django/db/backends/mysql/validation.py", line 13, in _check_sql_mode
with self.connection.cursor() as cursor:
File "/venv/lib/python3.6/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 260, in cursor
return self._cursor()
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 236, in _cursor
self.ensure_connection()
File "/venv/lib/python3.6/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 220, in ensure_connection
self.connect()
File "/venv/lib/python3.6/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 220, in ensure_connection
self.connect()
File "/venv/lib/python3.6/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 197, in connect
self.connection = self.get_new_connection(conn_params)
File "/venv/lib/python3.6/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/venv/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 233, in get_new_connection
return Database.connect(**conn_params)
File "/venv/lib/python3.6/site-packages/MySQLdb/__init__.py", line 130, in Connect
return Connection(*args, **kwargs)
File "/venv/lib/python3.6/site-packages/MySQLdb/connections.py", line 185, in __init__
super().__init__(*args, **kwargs2)
django.db.utils.OperationalError: (2059, 'Plugin caching_sha2_password could not be loaded: lib64/mariadb/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory')
You are trying to use the official MySQL docker images with a docker-compose.yml configuration for the CentOS MariaDB image which Kiwi TCMS uses by default.
A quick look at MySQL's container image at https://hub.docker.com/_/mysql tells me it doesn't support some of the environment variables used in the MariaDB image.
The error which I see is caused by trying to use the mariadb client library (to make the connection) which seems incompatible with MySQL. And I think there are quite a few incompatibilities between MariaDB and MySQL latest versions these days.
So you need to do 2 things:
Figure out how to properly configure the MySQL container via environment variables as per their documentation
Figure out if the MariaDB client libraries will work with a MySQL server (or not).
Also see https://docs.djangoproject.com/en/3.0/ref/databases/#mariadb-notes for references.
For 2) you can open an issue on GitHub so we don't forget to add it to our test suite. IDK at the top of my head what is the state of mysql/mariadb libraries lately and if they can be installed and used side-by-side or if they will conflict with each other.