microservice-email
microservice-email copied to clipboard
run make docker_run failed.
there maybe someting wrong with docker-compose, I'm a newbie in Docker compose, when I run make docker_run, it produce some error message
~/go/src/github.com/savsgio/microservice-email(master*) » make docker_run
cd docker && \
docker-compose run microservice-email -config-file /code/./config//microservice-email.dev.conf.yml
Creating docker_microservice-email_run ... done
panic: dial tcp 127.0.0.1:5672: connect: connection refused
goroutine 1 [running]:
github.com/savsgio/microservice-email/internal/lib.NewRabbitMQ(0xc000019174, 0x9, 0xc000019190, 0x5, 0xc0000191a8, 0x5, 0xc0000191b8, 0x6, 0xc0000191f0, 0x9, ...)
/usr/src/microservice-email/internal/lib/rabbitmq.go:29 +0x3e5
main.main()
/usr/src/microservice-email/cmd/microservice-email/main.go:40 +0x11f
make: *** [Makefile:58: docker_run] Error 2
I try yo add depends_on like this:
version: '3.7'
services:
microservice-email:
image: savsgio/microservice-email
build:
context: ../
dockerfile: docker/Dockerfile
container_name: microservice_email
hostname: microservice_email
ports:
- "8080:8080"
volumes:
- ../:/code
environment:
- PORT=8080
depends_on:
- rabbitmq
links:
- rabbitmq:rabbitmq_server
rabbitmq:
image: rabbitmq:management
container_name: rabbitmq_server
it doesn't work either
the microservice-email.dev.conf.yml is here:
smtp:
host: localhost
port: 8080
user: test
password: test
rabbitmq:
host: localhost # With or without port
user: guest
password: guest
queue_name: queue0
exchange_name: exchange0
exchange_kind: exchange_kind0
declare: false # Create queue and exchange in RabbitMQ automatically (true/false)
Hi @brownchow,
Sorry for delayed answer.
I pushed a fix for the docker-compose. So try again (in master branch) with the following changes in your config:
...
rabbitmq:
...
host: rabbitmq # With or without port
exchange_kind: direct
...
If everything is ok, let me know to release a fix version.