Skip to content

Commit

Permalink
MDBF-426: Feedback-plugin-backend: Docker compose example using the p…
Browse files Browse the repository at this point in the history
…lugin 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)
  • Loading branch information
an3l committed Jun 8, 2022
1 parent 7118c68 commit 6058801
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
11 changes: 6 additions & 5 deletions docker/.env
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ PYTHON_VERSION=3.9
NGINX_VERSION=latest
MARIADB_VERSION=10.6
MARIADB_ROOT_PASSWORD=1234
MARIADB_MYSQL_LOCALHOST_USER=1

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

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

# Control logging level for Django.
DJANGO_LOG_LEVEL='ERROR'
DJANGO_LOG_LEVEL=ERROR
12 changes: 9 additions & 3 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3'
version: '2.1'
services:
db:
build:
Expand All @@ -13,6 +13,12 @@ services:
- DJANGO_DB_NAME
- DJANGO_DB_USER_NAME
- DJANGO_DB_USER_PASSWORD
- MARIADB_MYSQL_LOCALHOST_USER
healthcheck:
test: /usr/local/bin/healthcheck.sh --su=mysql --connect --innodb_initialized
interval: 3s
timeout: 2s
retries: 3
volumes:
- ${MARIADB_DATADIR}:/var/lib/mysql
- ${MARIADB_CONFDIR}:/etc/mysql/mariadb.conf.d
Expand Down Expand Up @@ -40,8 +46,8 @@ services:
- static_volume:/app/src/staticfiles
- ../src/:/app/src/
depends_on:
- db

db:
condition: service_healthy
nginx:
build:
context: ./nginx
Expand Down

0 comments on commit 6058801

Please sign in to comment.