Skip to content

Commit 12d2127

Browse files
committed
MDBF-426: Feedback-plugin-backend: Docker compose example using the plugin doesn't work
- Update env file, no strings - Implement healtcheck by using `healthcheck` script from MariaDB, needed `mysql` user created by new env var - Implement condition for `depends_on` service using `condition` tag that is only available for 2.1 version (not yet for 3.0)
1 parent 7118c68 commit 12d2127

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

docker/.env

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ PYTHON_VERSION=3.9
88
NGINX_VERSION=latest
99
MARIADB_VERSION=10.6
1010
MARIADB_ROOT_PASSWORD=1234
11+
MARIADB_MYSQL_LOCALHOST_USER=1
1112

1213
# For development purposes, the database data directory and configuration file
1314
# are passed from the repository. In production these should be set to where you
@@ -19,7 +20,7 @@ MARIADB_CONFDIR=./mariadb/confdir
1920
# for your deployed server.
2021
DJANGO_ALLOWED_HOSTS=*
2122
# This key needs to be set to something proper one in a production deployment.
22-
DJANGO_SECRET_KEY='123'
23+
DJANGO_SECRET_KEY=123
2324
# Any non empty string enables Debug mode for Django
2425
DJANGO_DEBUG=True
2526

@@ -28,9 +29,9 @@ DJANGO_DEBUG=True
2829
# as well as the user name exists.
2930
#
3031
# There will also be a test_{DJANGO_DB_NAME} database used for running tests.
31-
DJANGO_DB_NAME='feedback_plugin'
32-
DJANGO_DB_USER_NAME='feedback'
33-
DJANGO_DB_USER_PASSWORD='A;p4rqgDt-Mf7L{z'
32+
DJANGO_DB_NAME=feedback_plugin
33+
DJANGO_DB_USER_NAME=feedback
34+
DJANGO_DB_USER_PASSWORD=A;p4rqgDt-Mf7L{z
3435

3536
# Control logging level for Django.
36-
DJANGO_LOG_LEVEL='ERROR'
37+
DJANGO_LOG_LEVEL=ERROR

docker/docker-compose.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '3'
1+
version: '2.1'
22
services:
33
db:
44
build:
@@ -13,6 +13,12 @@ services:
1313
- DJANGO_DB_NAME
1414
- DJANGO_DB_USER_NAME
1515
- DJANGO_DB_USER_PASSWORD
16+
- MARIADB_MYSQL_LOCALHOST_USER
17+
healthcheck:
18+
test: /usr/local/bin/healthcheck.sh --su=mysql --innodb_initialized
19+
interval: 3s
20+
timeout: 2s
21+
retries: 3
1622
volumes:
1723
- ${MARIADB_DATADIR}:/var/lib/mysql
1824
- ${MARIADB_CONFDIR}:/etc/mysql/mariadb.conf.d
@@ -40,8 +46,8 @@ services:
4046
- static_volume:/app/src/staticfiles
4147
- ../src/:/app/src/
4248
depends_on:
43-
- db
44-
49+
db:
50+
condition: service_healthy
4551
nginx:
4652
build:
4753
context: ./nginx

0 commit comments

Comments
 (0)