Skip to content

Commit 928d785

Browse files
authored
Merge pull request #8 from Kettailor/codex/fix-rabbitmq-connection-issue
Fix RabbitMQ connection by configuring credentials
2 parents d18d6ab + 594af6e commit 928d785

File tree

5 files changed

+8
-3
lines changed

5 files changed

+8
-3
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ Each service reads its configuration from environment variables with sensible de
5555

5656
Copy the required variables into `.env` files under each service (e.g. `auth/.env`, `product/.env`, etc.) before running the stack.
5757

58+
> **RabbitMQ credentials:** Docker Compose now provisions RabbitMQ with the `app` / `app` user. The services default to `amqp://app:app@rabbitmq:5672`, so update any custom `.env` files to match.
59+
5860
### Run with Docker Compose
5961

6062
1. Ensure Docker is running.

docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ services:
1212
rabbitmq:
1313
image: rabbitmq:3-management
1414
restart: unless-stopped
15+
environment:
16+
- RABBITMQ_DEFAULT_USER=app
17+
- RABBITMQ_DEFAULT_PASS=app
1518
ports:
1619
- "5672:5672"
1720
- "15672:15672"

order/src/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ require("dotenv").config();
22

33
const DEFAULT_PORT = 3002;
44
const DEFAULT_MONGO_URI = "mongodb://localhost:27017/orders";
5-
const DEFAULT_RABBIT_URI = "amqp://rabbitmq";
5+
const DEFAULT_RABBIT_URI = "amqp://app:app@rabbitmq";
66
const DEFAULT_ORDER_QUEUE = "orders";
77
const DEFAULT_PRODUCT_QUEUE = "products";
88
const DEFAULT_JWT_SECRET = "secret";

product/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
MONGODB_AUTH_URI=mongodb://mongo:27017/authDB
22
JWT_SECRET=22694611
33
MONGODB_PRODUCT_URI=mongodb://mongo:27017/productDB
4-
RABBITMQ_URI=amqp://rabbitmq:5672
4+
RABBITMQ_URI=amqp://app:app@rabbitmq:5672

product/src/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ require("dotenv").config();
22

33
const DEFAULT_PORT = 3001;
44
const DEFAULT_MONGO_URI = "mongodb://localhost:27017/products";
5-
const DEFAULT_RABBIT_URI = "amqp://rabbitmq";
5+
const DEFAULT_RABBIT_URI = "amqp://app:app@rabbitmq";
66
const DEFAULT_ORDER_QUEUE = "orders";
77
const DEFAULT_PRODUCT_QUEUE = "products";
88
const DEFAULT_JWT_SECRET = "secret";

0 commit comments

Comments
 (0)