Closed legenddaniel closed 2 years ago
@legenddaniel looks like it's a docker issue. You provided not enough information about your environments and settings.
Be sure that your python backend has access to mjml in the docker (they use common network or the port of mjml is mapped from the container to the host).
If you run python on your local machine and run mjml in the docker, just use ports
"28101:28101"
(set exact port that you set in PORT env var) and use host localhost
instead of mjml
in MJML_TCPSERVERS
.
@legenddaniel looks like it's a docker issue. You provided not enough information about your environments and settings. Be sure that your python backend has access to mjml in the docker (they use common network or the port of mjml is mapped from the container to the host). If you run python on your local machine and run mjml in the docker, just use
ports
"28101:28101"
(set exact port that you set in PORT env var) and use hostlocalhost
instead ofmjml
inMJML_TCPSERVERS
.
Hi Igor I am running the backend in docker too, which is 127.0.0.1:8000 or say 0.0.0.0:8000. Do I need extra settings inside docker-compose.yml?
@legenddaniel show your docker-compose configuration file
version: '1.0'
services:
nginx:
image: nginx:latest
ports:
- "8001:8001"
volumes:
- ./backend:/app
- ./backend/webapp/static:/static
- ./config/nginx:/etc/nginx/conf.d
depends_on:
- backend
networks:
- boilerplate
db:
image: postgres:latest
volumes:
- ./postgres-data:/var/lib/postgresql/data
- ./db-dumps:/db-dumps
ports:
- "5432:5432"
env_file:
- ./backend/.env
networks:
- boilerplate
backend:
image: backend
build:
context: .
dockerfile: backend.Dockerfile
volumes:
- ./backend:/app
- ./backend/webapp/static:/static
ports:
- "8000:8000"
depends_on:
- db
expose:
- "8000"
networks:
- boilerplate
command: ["/wait-for-it.sh", "db:5432", "--", "../entrypoint-django-runserver.sh"]
env_file:
- ./backend/.env
mjml:
image: liminspace/mjml-tcpserver:0.11.0
networks:
- boilerplate
depends_on:
- backend
ports:
- "28101:28101"
expose:
- "28101"
networks:
boilerplate:
driver: bridge
@legenddaniel remove backend
from services.mjml.depends_on
and put mjml
into services.backend.depends_on
. backend makes requests into mjml, so it depends on mjml, not vice versa.
Also try to use newer version of docker-compose, for example '3'
or '3.9'
instead of '1.0'
.
Remove services.mjml.ports
, it doesn't make sense.
After these changes it must works. If not, check output of mjml. Be sure it open port and listening.
Also sometimes restarting docker daemon on your OS can help (there can be stuck processes that uses ports you try to open).
Yes you are right. This is my fault. Thank you and your awesome project!
Python: 3.9 django-mjml: 0.11.0 mjml: 4.10.1
I saw a similar one #119 but that is not solving my issue.
docker-compose.yml:
settings.py:
I also tried different settings mentioned in the README none of them works. I can see the image is running on 28101 in docker.