added mysql config in

This commit is contained in:
Abdullah Adeel 2022-01-10 19:45:14 +05:00
parent decbcf38fc
commit 0f3d5abb4e
2 changed files with 32 additions and 1 deletions

View File

@ -7,7 +7,7 @@ volumes:
{%- endif %} {%- endif %}
{%- if cookiecutter.database_engine == 'mysql' %} {%- if cookiecutter.database_engine == 'mysql' %}
local_mysql_data: {} local_mysql_data: {}
local_my_sql_backup: {} local_mysql_data_backups: {}
{%- endif %} {%- endif %}
services: services:

View File

@ -1,8 +1,14 @@
version: '3' version: '3'
volumes: volumes:
{%- if cookiecutter.database_engine == 'postgresql' %}
production_postgres_data: {} production_postgres_data: {}
production_postgres_data_backups: {} production_postgres_data_backups: {}
{%- endif %}
{%- if cookiecutter.database_engine == 'mysql' %}
production_mysql_data: {}
production_mysql_data_backups: {}
{%- endif %}
production_traefik: {} production_traefik: {}
services: services:
@ -12,13 +18,24 @@ services:
dockerfile: ./compose/production/django/Dockerfile dockerfile: ./compose/production/django/Dockerfile
image: {{ cookiecutter.project_slug }}_production_django image: {{ cookiecutter.project_slug }}_production_django
depends_on: depends_on:
{%- if cookiecutter.database_engine == 'postgresql' %}
- postgres - postgres
{%- endif %}
{%- if cookiecutter.database_engine == 'mysql' %}
- mysql
{%- endif %}
- redis - redis
env_file: env_file:
- ./.envs/.production/.django - ./.envs/.production/.django
{%- if cookiecutter.database_engine == 'postgresql' %}
- ./.envs/.production/.postgres - ./.envs/.production/.postgres
{%- endif %}
{%- if cookiecutter.database_engine == 'mysql' %}
- ./.envs/.production/.mysql
{%- endif %}
command: /start command: /start
{%- if cookiecutter.database_engine == 'postgresql' %}
postgres: postgres:
build: build:
context: . context: .
@ -29,6 +46,20 @@ services:
- production_postgres_data_backups:/backups:z - production_postgres_data_backups:/backups:z
env_file: env_file:
- ./.envs/.production/.postgres - ./.envs/.production/.postgres
{%- endif %}
{%- if cookiecutter.database_engine == 'mysql' %}
mysql:
build:
context: .
dockerfile: ./compose/production/mysql/Dockerfile
image: {{ cookiecutter.project_slug }}_production_mysql
container_name: mysql
volumes:
- production_mysql_data:/var/lib/mysql/data:Z
- production_mysql_data_backups:/backups:z
env_file:
- ./.envs/.production/.mysql
{%- endif %}
traefik: traefik:
build: build: