Skip to content

Commit

Permalink
Merge pull request #4 from TogetherCrew/rabbitmq
Browse files Browse the repository at this point in the history
RabbitMQ
  • Loading branch information
cyri113 authored May 23, 2023
2 parents 2ea5a39 + f379cd4 commit 8724a58
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,22 @@ docker compose -f docker-compose.dev.yml up

- MongoDB ([mongoose](https://mongoosejs.com/))
- Redis ([BullMQ](https://bullmq.io/) and [bull-board](https://github.com/felixmosh/bull-board))
- RabbitMQ ([RabbitMQ](https://www.rabbitmq.com/) and [RabbitMQ Management](https://www.rabbitmq.com/managment))

#### Local Resources

- [Bull Board](http://localhost:3000/admin/queues)
- [RabbitMQ Management](http://localhost:15672)

## Commands

The following commands are also available. Note that while these are made available, the `docker compose` commands are the ones called throughout the CI/CD Pipeline.

```bash
npm run prettier
npm run lint
npm run test
npm run dev
npm run build
npm run start
```
8 changes: 8 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,11 @@ services:
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=pass
rabbitmq:
image: "rabbitmq:3-management-alpine"
ports:
- 5672:5672
- 15672:15672
environment:
- RABBITMQ_DEFAULT_USER=root
- RABBITMQ_DEFAULT_PASS=pass
9 changes: 9 additions & 0 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ services:
- MONGODB_PASS=pass
- REDIS_QUEUE_HOST=redis
- REDIS_QUEUE_PORT=6379
- RABBITMQ_HOST=localhost
- RABBITMQ_PORT=5672
- RABBITMQ_USER=root
- RABBITMQ_PASS=pass
volumes:
- ./coverage:/project/coverage
depends_on:
Expand All @@ -26,3 +30,8 @@ services:
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=pass
rabbitmq:
image: "rabbitmq:3-management-alpine"
environment:
- RABBITMQ_DEFAULT_USER=root
- RABBITMQ_DEFAULT_PASS=pass
7 changes: 7 additions & 0 deletions src/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ const schema = Joi.object()
MONGODB_NAME: Joi.string().optional().example("db"),
REDIS_QUEUE_HOST: Joi.string().optional().example("localhost"),
REDIS_QUEUE_PORT: Joi.number().optional().example(6379),
RABBITMQ_HOST: Joi.string().required().example("localhost"),
RABBITMQ_PORT: Joi.number().required().example(5672),
RABBITMQ_USER: Joi.string().required().example("root"),
RABBITMQ_PASS: Joi.string().required().example("pass"),
})
.unknown();

Expand All @@ -28,7 +32,10 @@ const MONGODB_URL = `mongodb://${value.MONGODB_USER}:${value.MONGODB_PASS}@${
value.MONGODB_NAME !== undefined ? value.MONGODB_NAME : ""
}`;

const RABBITMQ_URL = `amqp://${value.RABBITMQ_USER}:${value.RABBITMQ_PASS}@${value.RABBITMQ_HOST}:${value.RABBITMQ_PORT}`;

export const env = {
...value,
MONGODB_URL,
RABBITMQ_URL,
};

0 comments on commit 8724a58

Please sign in to comment.