Skip to content

Commit 054ce97

Browse files
diegocastrumauvipy
andauthoredApr 11, 2022
Added support for compose env vars (celery#532) (celery#533)
* Added support for compose env vars (celery#532) Added `.env` to `.gitignore`. Added a `.env.sample` that will be used by anyone he need it. Just copy it as `.env` in your local devel env and use the (supported) variables you need. `docker-compose.yml` updated in order to support string interpolation when using variables defined in a `.env` file. Fixed a typo in `issue_template.md`. * newline * newline Co-authored-by: Asif Saif Uddin <auvipy@gmail.com>
1 parent 7861626 commit 054ce97

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed
 

‎.env.sample

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# CELERY
2+
# -----------------------------------------------------------------------------
3+
# CELERY_BROKER_URL=amqp://guest:guest@rabbitmq:5672/
4+
5+
# DJANGO
6+
# -----------------------------------------------------------------------------
7+
DJANGO_PORT=58000
8+
DJANGO_HOST=127.0.0.1
9+
10+
# RABBITMQ
11+
# -----------------------------------------------------------------------------
12+
# RABBITMQ_HOST=
13+
# RABBITMQ_PASSWORD=
14+
RABBITMQ_PORT=5672
15+
# RABBITMQ_USER=

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ coverage.xml
3333
.eggs/
3434
.python-version
3535
venv
36+
.env

‎docker-compose.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ services:
1919
context: .
2020
dockerfile: docker/django/Dockerfile
2121
ports:
22-
- "127.0.0.1:58000:8000"
22+
- "${DJANGO_HOST:-127.0.0.1}:${DJANGO_PORT:-58000}:8000"
2323
entrypoint: ["/app/docker/django/entrypoint.sh"]
24-
command: ["python3", "manage.py", "runserver", "0.0.0.0:8000"]
24+
command: ["python3", "manage.py", "runserver", "0.0.0.0:${DJANGO_PORT:-8000}"]
2525
tty: true
2626
volumes:
2727
- './django_celery_beat/:/app/django_celery_beat/'
@@ -36,7 +36,7 @@ services:
3636
dockerfile: docker/celery-beat/Dockerfile
3737
entrypoint: ["/app/docker/celery-beat/entrypoint.sh"]
3838
environment:
39-
CELERY_BROKER_URL: 'amqp://guest:guest@rabbit:5672'
39+
CELERY_BROKER_URL: 'amqp://${RABBITMQ_USER:-guest}:${RABBITMQ_PASSWORD:-guest}@${RABBITMQ_HOST:-rabbit}:${RABBITMQ_PORT:-5672}'
4040
command: ["python3", '-m', "celery", "-A", "mysite", "beat", "-l", "info", "--scheduler", "django_celery_beat.schedulers:DatabaseScheduler"]
4141
tty: true
4242
volumes:
@@ -45,7 +45,7 @@ services:
4545
rabbit:
4646
image: rabbitmq
4747
ports:
48-
- "5672:5672"
48+
- "${RABBITMQ_PORT:-5672}:5672"
4949
postgres:
5050
image: postgres
5151
environment:

‎issue_template.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
### Summary:
22

3-
Include a *brief* descrioption of the problem here, and fill out the version info below.
3+
Include a *brief* description of the problem here, and fill out the version info below.
44

55
* Celery Version:
66
* Celery-Beat Version:

0 commit comments

Comments
 (0)
Please sign in to comment.