Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDBF-426: Feedback-plugin-backend: Docker compose example using the p…
…lugin doesn't work - The problem here is that enviornment variable don't need to be treated as a strings - Other than that, for docker-compose we need to specify which user we are going to connect to MariaDB container - Proof ``` $ docker-compose up --build Building db Step 1/6 : ARG mariadb_version=10.6 Step 2/6 : FROM "mariadb:$mariadb_version" ---> 927bab32c7ff Step 3/6 : RUN apt-get update && apt-get install -y python3 python3-pip libmariadb-dev ---> Using cache ---> ae6b691bf507 Step 4/6 : RUN pip install --upgrade pip && pip install mariadb ---> Using cache ---> c4297020ef71 Step 5/6 : COPY ./docker/mariadb/create_database_user.py /docker-entrypoint-initdb.d/create_database_user.sh ---> Using cache ---> 39b1f0bd4ed7 Step 6/6 : RUN chmod +x /docker-entrypoint-initdb.d/create_database_user.sh ---> Using cache ---> 957e6b21c321 Successfully built 957e6b21c321 Successfully tagged docker_db:latest Building web Step 1/13 : ARG python_version=3.9 Step 2/13 : FROM "python:$python_version" ---> 9fa3494cf8c7 Step 3/13 : WORKDIR /app/ ---> Using cache ---> 942a79722eae Step 4/13 : ENV PYTHONDONTWRITEBYTECODE 1 ---> Using cache ---> 19217572fe0e Step 5/13 : ENV PYTHONUNBUFFERED 1 ---> Using cache ---> 91d8ee7656a7 Step 6/13 : RUN apt-get update && apt-get install libgdal-dev -y ---> Using cache ---> de7884ca51ba Step 7/13 : RUN pip install --upgrade pip && pip install mariadb gunicorn ---> Using cache ---> ebbacf91325c Step 8/13 : COPY ./docker/app/requirements.txt ./requirements.txt ---> Using cache ---> cb12d075f03b Step 9/13 : RUN pip install -r requirements.txt ---> Using cache ---> 1726dc55ba72 Step 10/13 : COPY ./docker/app/entrypoint.sh ./ ---> Using cache ---> 5fb8b73fbf08 Step 11/13 : RUN mkdir -p ./logs/ ---> Using cache ---> f4dee45501e8 Step 12/13 : WORKDIR /app/src/ ---> Using cache ---> 01b441a783bb Step 13/13 : ENTRYPOINT ["/app/entrypoint.sh"] ---> Using cache ---> f47374120d94 Successfully built f47374120d94 Successfully tagged docker_web:latest Building nginx Step 1/4 : ARG nginx_version=latest Step 2/4 : FROM "nginx:$nginx_version" ---> 0e901e68141f Step 3/4 : RUN rm /etc/nginx/conf.d/default.conf ---> Using cache ---> 59f2acbde15e Step 4/4 : COPY nginx.conf /etc/nginx/conf.d ---> Using cache ---> f633d2f7fbf6 Successfully built f633d2f7fbf6 Successfully tagged docker_nginx:latest Recreating docker_db_1 ... done Recreating docker_web_1 ... done Recreating docker_nginx_1 ... done Attaching to docker_db_1, docker_web_1, docker_nginx_1 db_1 | 2022-05-31 14:57:12+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.6.8+maria~focal started. db_1 | 2022-05-31 14:57:12+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' db_1 | 2022-05-31 14:57:12+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.6.8+maria~focal started. db_1 | 2022-05-31 14:57:12+00:00 [Note] [Entrypoint]: Initializing database files nginx_1 | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration nginx_1 | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh nginx_1 | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh web_1 | Booting up web-app nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh nginx_1 | /docker-entrypoint.sh: Configuration complete; ready for start up nginx_1 | 2022/05/31 14:57:13 [notice] 1#1: using the "epoll" event method nginx_1 | 2022/05/31 14:57:13 [notice] 1#1: nginx/1.21.6 nginx_1 | 2022/05/31 14:57:13 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6) nginx_1 | 2022/05/31 14:57:13 [notice] 1#1: OS: Linux 5.13.0-44-generic nginx_1 | 2022/05/31 14:57:13 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576 nginx_1 | 2022/05/31 14:57:13 [notice] 1#1: start worker processes nginx_1 | 2022/05/31 14:57:13 [notice] 1#1: start worker process 22 nginx_1 | 2022/05/31 14:57:13 [notice] 1#1: start worker process 23 nginx_1 | 2022/05/31 14:57:13 [notice] 1#1: start worker process 24 nginx_1 | 2022/05/31 14:57:13 [notice] 1#1: start worker process 25 nginx_1 | 2022/05/31 14:57:13 [notice] 1#1: start worker process 26 nginx_1 | 2022/05/31 14:57:13 [notice] 1#1: start worker process 27 nginx_1 | 2022/05/31 14:57:13 [notice] 1#1: start worker process 28 nginx_1 | 2022/05/31 14:57:13 [notice] 1#1: start worker process 29 db_1 | db_1 | db_1 | PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER ! db_1 | To do so, start the server, then issue the following command: db_1 | db_1 | '/usr/bin/mysql_secure_installation' db_1 | db_1 | which will also give you the option of removing the test db_1 | databases and anonymous user created by default. This is db_1 | strongly recommended for production servers. db_1 | db_1 | See the MariaDB Knowledgebase at https://mariadb.com/kb db_1 | db_1 | Please report any problems at https://mariadb.org/jira db_1 | db_1 | The latest information about MariaDB is available at https://mariadb.org/. db_1 | db_1 | Consider joining MariaDB's strong and vibrant community: db_1 | https://mariadb.org/get-involved/ db_1 | db_1 | 2022-05-31 14:57:13+00:00 [Note] [Entrypoint]: Database files initialized db_1 | 2022-05-31 14:57:13+00:00 [Note] [Entrypoint]: Starting temporary server db_1 | 2022-05-31 14:57:13+00:00 [Note] [Entrypoint]: Waiting for server startup db_1 | 2022-05-31 14:57:13 0 [Note] mariadbd (server 10.6.8-MariaDB-1:10.6.8+maria~focal) starting as process 101 ... db_1 | 2022-05-31 14:57:13 0 [Note] InnoDB: Compressed tables use zlib 1.2.11 db_1 | 2022-05-31 14:57:13 0 [Note] InnoDB: Number of pools: 1 db_1 | 2022-05-31 14:57:13 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions db_1 | 2022-05-31 14:57:13 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts) db_1 | 2022-05-31 14:57:13 0 [Note] InnoDB: Using Linux native AIO db_1 | 2022-05-31 14:57:13 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728 db_1 | 2022-05-31 14:57:13 0 [Note] InnoDB: Completed initialization of buffer pool db_1 | 2022-05-31 14:57:13 0 [Note] InnoDB: 128 rollback segments are active. db_1 | 2022-05-31 14:57:13 0 [Note] InnoDB: Creating shared tablespace for temporary tables db_1 | 2022-05-31 14:57:13 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... db_1 | 2022-05-31 14:57:13 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB. db_1 | 2022-05-31 14:57:13 0 [Note] InnoDB: 10.6.8 started; log sequence number 41361; transaction id 14 db_1 | 2022-05-31 14:57:13 0 [Note] Plugin 'FEEDBACK' is disabled. db_1 | 2022-05-31 14:57:13 0 [Warning] 'user' entry 'root@306f4bc10ade' ignored in --skip-name-resolve mode. db_1 | 2022-05-31 14:57:13 0 [Warning] 'proxies_priv' entry '@% root@306f4bc10ade' ignored in --skip-name-resolve mode. db_1 | 2022-05-31 14:57:13 0 [Note] mariadbd: ready for connections. db_1 | Version: '10.6.8-MariaDB-1:10.6.8+maria~focal' socket: '/run/mysqld/mysqld.sock' port: 0 mariadb.org binary distribution web_1 | Traceback (most recent call last): web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection web_1 | self.connect() web_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 33, in inner web_1 | return func(*args, **kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 200, in connect web_1 | self.connection = self.get_new_connection(conn_params) web_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 33, in inner web_1 | return func(*args, **kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/mysql/base.py", line 234, in get_new_connection web_1 | connection = Database.connect(**conn_params) web_1 | File "/usr/local/lib/python3.9/site-packages/MySQLdb/__init__.py", line 123, in Connect web_1 | return Connection(*args, **kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/MySQLdb/connections.py", line 185, in __init__ web_1 | super().__init__(*args, **kwargs2) web_1 | MySQLdb._exceptions.OperationalError: (2002, "Can't connect to MySQL server on 'db' (115)") web_1 | web_1 | The above exception was the direct cause of the following exception: web_1 | web_1 | Traceback (most recent call last): web_1 | File "/app/src/manage.py", line 22, in <module> web_1 | main() web_1 | File "/app/src/manage.py", line 18, in main web_1 | execute_from_command_line(sys.argv) web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line web_1 | utility.execute() web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute web_1 | self.fetch_command(subcommand).run_from_argv(self.argv) web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv web_1 | self.execute(*args, **cmd_options) web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute web_1 | output = self.handle(*args, **options) web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/management/commands/check.py", line 63, in handle web_1 | self.check( web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 419, in check web_1 | all_issues = checks.run_checks( web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/checks/registry.py", line 76, in run_checks web_1 | new_errors = check(app_configs=app_configs, databases=databases) web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/checks/database.py", line 13, in check_database_backends web_1 | issues.extend(conn.validation.check(**kwargs)) web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/mysql/validation.py", line 9, in check web_1 | issues.extend(self._check_sql_mode(**kwargs)) web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/mysql/validation.py", line 13, in _check_sql_mode web_1 | if not (self.connection.sql_mode & {'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES'}): web_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/functional.py", line 48, in __get__ web_1 | res = instance.__dict__[self.name] = self.func(instance) web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/mysql/base.py", line 405, in sql_mode web_1 | sql_mode = self.mysql_server_data['sql_mode'] web_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/functional.py", line 48, in __get__ web_1 | res = instance.__dict__[self.name] = self.func(instance) web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/mysql/base.py", line 366, in mysql_server_data web_1 | with self.temporary_connection() as cursor: web_1 | File "/usr/local/lib/python3.9/contextlib.py", line 119, in __enter__ web_1 | return next(self.gen) web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 603, in temporary_connection web_1 | with self.cursor() as cursor: web_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 33, in inner web_1 | return func(*args, **kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 259, in cursor web_1 | return self._cursor() web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 235, in _cursor web_1 | self.ensure_connection() web_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 33, in inner web_1 | return func(*args, **kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection web_1 | self.connect() web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/utils.py", line 90, in __exit__ web_1 | raise dj_exc_value.with_traceback(traceback) from exc_value web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection web_1 | self.connect() web_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 33, in inner web_1 | return func(*args, **kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 200, in connect web_1 | self.connection = self.get_new_connection(conn_params) web_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 33, in inner web_1 | return func(*args, **kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/mysql/base.py", line 234, in get_new_connection web_1 | connection = Database.connect(**conn_params) web_1 | File "/usr/local/lib/python3.9/site-packages/MySQLdb/__init__.py", line 123, in Connect web_1 | return Connection(*args, **kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/MySQLdb/connections.py", line 185, in __init__ web_1 | super().__init__(*args, **kwargs2) web_1 | django.db.utils.OperationalError: (2002, "Can't connect to MySQL server on 'db' (115)") db_1 | 2022-05-31 14:57:14+00:00 [Note] [Entrypoint]: Temporary server started. db_1 | Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it. db_1 | Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it. db_1 | Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it. web_1 | Database not available, exiting. db_1 | 2022-05-31 14:57:16+00:00 [Note] [Entrypoint]: Securing system users (equivalent to running mysql_secure_installation) db_1 | db_1 | 2022-05-31 14:57:16+00:00 [Note] [Entrypoint]: /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/create_database_user.sh db_1 | Succesfully connected to MariaDB db_1 | Creating database... db_1 | Creating Django user... db_1 | Granting user rights on Django database... db_1 | Granting rights for running Django tests... db_1 | db_1 | 2022-05-31 14:57:16+00:00 [Note] [Entrypoint]: Stopping temporary server db_1 | 2022-05-31 14:57:16 0 [Note] mariadbd (initiated by: root[root] @ localhost []): Normal shutdown db_1 | 2022-05-31 14:57:16 0 [Note] InnoDB: FTS optimize thread exiting. db_1 | 2022-05-31 14:57:16 0 [Note] InnoDB: Starting shutdown... db_1 | 2022-05-31 14:57:16 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool db_1 | 2022-05-31 14:57:16 0 [Note] InnoDB: Buffer pool(s) dump completed at 220531 14:57:16 db_1 | 2022-05-31 14:57:16 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1" db_1 | 2022-05-31 14:57:16 0 [Note] InnoDB: Shutdown completed; log sequence number 42335; transaction id 15 db_1 | 2022-05-31 14:57:16 0 [Note] mariadbd: Shutdown complete db_1 | db_1 | 2022-05-31 14:57:17+00:00 [Note] [Entrypoint]: Temporary server stopped db_1 | db_1 | 2022-05-31 14:57:17+00:00 [Note] [Entrypoint]: MariaDB init process done. Ready for start up. db_1 | db_1 | 2022-05-31 14:57:17 0 [Note] mariadbd (server 10.6.8-MariaDB-1:10.6.8+maria~focal) starting as process 1 ... db_1 | 2022-05-31 14:57:17 0 [Note] InnoDB: Compressed tables use zlib 1.2.11 db_1 | 2022-05-31 14:57:17 0 [Note] InnoDB: Number of pools: 1 db_1 | 2022-05-31 14:57:17 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions db_1 | 2022-05-31 14:57:17 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts) web_1 | Traceback (most recent call last): web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection web_1 | self.connect() web_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 33, in inner web_1 | return func(*args, **kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 200, in connect web_1 | self.connection = self.get_new_connection(conn_params) web_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 33, in inner web_1 | return func(*args, **kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/mysql/base.py", line 234, in get_new_connection web_1 | connection = Database.connect(**conn_params) web_1 | File "/usr/local/lib/python3.9/site-packages/MySQLdb/__init__.py", line 123, in Connect web_1 | return Connection(*args, **kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/MySQLdb/connections.py", line 185, in __init__ web_1 | super().__init__(*args, **kwargs2) web_1 | MySQLdb._exceptions.OperationalError: (2002, "Can't connect to MySQL server on 'db' (115)") web_1 | web_1 | The above exception was the direct cause of the following exception: web_1 | web_1 | Traceback (most recent call last): web_1 | File "/app/src/manage.py", line 22, in <module> web_1 | main() web_1 | File "/app/src/manage.py", line 18, in main web_1 | execute_from_command_line(sys.argv) web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line web_1 | utility.execute() web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute web_1 | self.fetch_command(subcommand).run_from_argv(self.argv) web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv web_1 | self.execute(*args, **cmd_options) web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute web_1 | output = self.handle(*args, **options) web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/management/commands/check.py", line 63, in handle db_1 | 2022-05-31 14:57:17 0 [Note] InnoDB: Using Linux native AIO db_1 | 2022-05-31 14:57:17 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728 web_1 | self.check( web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 419, in check web_1 | all_issues = checks.run_checks( web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/checks/registry.py", line 76, in run_checks web_1 | new_errors = check(app_configs=app_configs, databases=databases) db_1 | 2022-05-31 14:57:17 0 [Note] InnoDB: Completed initialization of buffer pool web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/checks/database.py", line 13, in check_database_backends web_1 | issues.extend(conn.validation.check(**kwargs)) web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/mysql/validation.py", line 9, in check web_1 | issues.extend(self._check_sql_mode(**kwargs)) web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/mysql/validation.py", line 13, in _check_sql_mode web_1 | if not (self.connection.sql_mode & {'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES'}): web_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/functional.py", line 48, in __get__ web_1 | res = instance.__dict__[self.name] = self.func(instance) web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/mysql/base.py", line 405, in sql_mode web_1 | sql_mode = self.mysql_server_data['sql_mode'] web_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/functional.py", line 48, in __get__ web_1 | res = instance.__dict__[self.name] = self.func(instance) web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/mysql/base.py", line 366, in mysql_server_data web_1 | with self.temporary_connection() as cursor: web_1 | File "/usr/local/lib/python3.9/contextlib.py", line 119, in __enter__ web_1 | return next(self.gen) web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 603, in temporary_connection web_1 | with self.cursor() as cursor: web_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 33, in inner web_1 | return func(*args, **kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 259, in cursor web_1 | return self._cursor() web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 235, in _cursor web_1 | self.ensure_connection() web_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 33, in inner web_1 | return func(*args, **kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection web_1 | self.connect() web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/utils.py", line 90, in __exit__ web_1 | raise dj_exc_value.with_traceback(traceback) from exc_value web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection web_1 | self.connect() web_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 33, in inner web_1 | return func(*args, **kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 200, in connect web_1 | self.connection = self.get_new_connection(conn_params) web_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 33, in inner web_1 | return func(*args, **kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/mysql/base.py", line 234, in get_new_connection web_1 | connection = Database.connect(**conn_params) web_1 | File "/usr/local/lib/python3.9/site-packages/MySQLdb/__init__.py", line 123, in Connect web_1 | return Connection(*args, **kwargs) web_1 | File "/usr/local/lib/python3.9/site-packages/MySQLdb/connections.py", line 185, in __init__ web_1 | super().__init__(*args, **kwargs2) web_1 | django.db.utils.OperationalError: (2002, "Can't connect to MySQL server on 'db' (115)") db_1 | 2022-05-31 14:57:17 0 [Note] InnoDB: 128 rollback segments are active. db_1 | 2022-05-31 14:57:17 0 [Note] InnoDB: Creating shared tablespace for temporary tables db_1 | 2022-05-31 14:57:17 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... db_1 | 2022-05-31 14:57:17 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB. db_1 | 2022-05-31 14:57:17 0 [Note] InnoDB: 10.6.8 started; log sequence number 42335; transaction id 14 db_1 | 2022-05-31 14:57:17 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool db_1 | 2022-05-31 14:57:17 0 [Note] Plugin 'FEEDBACK' is disabled. db_1 | 2022-05-31 14:57:17 0 [Note] InnoDB: Buffer pool(s) load completed at 220531 14:57:17 db_1 | 2022-05-31 14:57:17 0 [Note] Server socket created on IP: '0.0.0.0'. db_1 | 2022-05-31 14:57:17 0 [Note] Server socket created on IP: '::'. db_1 | 2022-05-31 14:57:17 0 [Note] mariadbd: ready for connections. db_1 | Version: '10.6.8-MariaDB-1:10.6.8+maria~focal' socket: '/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution web_1 | Database not available, exiting. docker_web_1 exited with code 1 web_1 | System check identified no issues (0 silenced). web_1 | Operations to perform: web_1 | Apply all migrations: admin, auth, contenttypes, feedback_plugin, sessions web_1 | Running migrations: web_1 | Applying contenttypes.0001_initial... OK web_1 | Applying auth.0001_initial... OK web_1 | Applying admin.0001_initial... OK web_1 | Applying admin.0002_logentry_remove_auto_add... OK web_1 | Applying admin.0003_logentry_add_action_flag_choices... OK web_1 | Applying contenttypes.0002_remove_content_type_name... OK web_1 | Applying auth.0002_alter_permission_name_max_length... OK web_1 | Applying auth.0003_alter_user_email_max_length... OK web_1 | Applying auth.0004_alter_user_username_opts... OK web_1 | Applying auth.0005_alter_user_last_login_null... OK web_1 | Applying auth.0006_require_contenttypes_0002... OK web_1 | Applying auth.0007_alter_validators_add_error_messages... OK web_1 | Applying auth.0008_alter_user_username_max_length... OK web_1 | Applying auth.0009_alter_user_last_name_max_length... OK web_1 | Applying auth.0010_alter_group_name_max_length... OK web_1 | Applying auth.0011_update_proxy_permissions... OK web_1 | Applying auth.0012_alter_user_first_name_max_length... OK web_1 | Applying feedback_plugin.0001_initial... OK web_1 | Applying sessions.0001_initial... OK web_1 | web_1 | 136 static files copied to '/app/src/staticfiles'. web_1 | [2022-05-31 14:57:23 +0000] [1] [INFO] Starting gunicorn 20.1.0 web_1 | [2022-05-31 14:57:23 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1) web_1 | [2022-05-31 14:57:23 +0000] [1] [INFO] Using worker: sync web_1 | [2022-05-31 14:57:23 +0000] [16] [INFO] Booting worker with pid: 16 web_1 | [2022-05-31 14:57:23 +0000] [17] [INFO] Booting worker with pid: 17 web_1 | [2022-05-31 14:57:23 +0000] [18] [INFO] Booting worker with pid: 18 web_1 | [2022-05-31 14:57:23 +0000] [19] [INFO] Booting worker with pid: 19 web_1 | [2022-05-31 14:57:23 +0000] [20] [INFO] Booting worker with pid: 20 web_1 | [2022-05-31 14:57:24 +0000] [21] [INFO] Booting worker with pid: 21 ``` - All containers running ``` $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 29e78469c2b0 docker_nginx "/docker-entrypoint.…" 21 seconds ago Up 21 seconds 0.0.0.0:8000->80/tcp, :::8000->80/tcp docker_nginx_1 8473bd87be0b docker_web "/app/entrypoint.sh …" 22 seconds ago Up 14 seconds docker_web_1 306f4bc10ade docker_db "docker-entrypoint.s…" 22 seconds ago Up 21 seconds 3306/tcp docker_db_1 ``` - Run the test ``` $ docker exec -it docker_web_1 python manage.py test Creating test database for alias 'default'... System check identified no issues (0 silenced). ....... ---------------------------------------------------------------------- Ran 7 tests in 0.545s OK Destroying test database for alias 'default'... ```
- Loading branch information