@@ -10,7 +10,8 @@ services:
1010 env_file :
1111 - .env
1212 {%- if ((cookiecutter.db_info.name != "none" and cookiecutter.db_info.name != "sqlite") or
13- (cookiecutter.enable_redis == "True")) %}
13+ (cookiecutter.enable_redis == "True") or
14+ (cookiecutter.enable_rmq == "True")) %}
1415 depends_on :
1516 {%- if cookiecutter.db_info.name != "none" %}
1617 {%- if cookiecutter.db_info.name != "sqlite" %}
@@ -22,6 +23,10 @@ services:
2223 redis :
2324 condition : service_healthy
2425 {%- endif %}
26+ {%- if cookiecutter.enable_rmq == "True" %}
27+ rmq :
28+ condition : service_healthy
29+ {%- endif %}
2530 {%- endif %}
2631 environment :
2732 {{cookiecutter.project_name | upper }}_HOST: 0.0.0.0
@@ -36,6 +41,9 @@ services:
3641 {{cookiecutter.project_name | upper}}_DB_BASE: {{cookiecutter.project_name}}
3742 {%- endif %}
3843 {%- endif %}
44+ {%- if cookiecutter.enable_rmq == 'True' %}
45+ {{cookiecutter.project_name | upper }}_RABBIT_HOST: {{cookiecutter.project_name}}-rmq
46+ {%- endif %}
3947 {%- if cookiecutter.db_info.name == "sqlite" %}
4048 volumes :
4149 - {{cookiecutter.project_name}}-db-data:/db_data/
@@ -59,7 +67,7 @@ services:
5967 retries : 40
6068 {%- endif %}
6169
62- {% if cookiecutter.db_info.name == "mysql" - %}
70+ {%- if cookiecutter.db_info.name == "mysql" %}
6371 db :
6472 image : {{cookiecutter.db_info.image}}
6573 hostname : {{cookiecutter.project_name}}-db
@@ -78,7 +86,7 @@ services:
7886 - {{cookiecutter.project_name}}-db-data:/bitnami/mysql/data
7987 {%- endif %}
8088
81- {% if cookiecutter.enable_migrations == 'True' - %}
89+ {%- if cookiecutter.enable_migrations == 'True' %}
8290 migrator :
8391 image : {{cookiecutter.project_name}}:{{"${" }}{{cookiecutter.project_name | upper }}_VERSION:-latest{{"}"}}
8492 restart : " no"
@@ -115,7 +123,7 @@ services:
115123 {%- endif %}
116124 {%- endif %}
117125
118- {% if cookiecutter.enable_redis == "True" - %}
126+ {%- if cookiecutter.enable_redis == "True" %}
119127 redis :
120128 image : bitnami/redis:6.2.5
121129 hostname : {{cookiecutter.project_name}}-redis
@@ -129,6 +137,23 @@ services:
129137 retries : 30
130138 {%- endif %}
131139
140+ {%- if cookiecutter.enable_rmq == "True" %}
141+ rmq :
142+ image : rabbitmq:3.9.16-alpine
143+ hostname : {{cookiecutter.project_name}}-rmq
144+ restart : always
145+ environment :
146+ RABBITMQ_DEFAULT_USER : " guest"
147+ RABBITMQ_DEFAULT_PASS : " guest"
148+ RABBITMQ_DEFAULT_VHOST : " /"
149+ healthcheck :
150+ test : rabbitmq-diagnostics check_running -q
151+ interval : 1s
152+ timeout : 3s
153+ retries : 30
154+ {%- endif %}
155+
156+
132157{% if cookiecutter.db_info.name != 'none' %}
133158volumes :
134159 {{cookiecutter.project_name}}-db-data:
0 commit comments