0
0
mirror of https://github.com/alex289/CleanArchitecture.git synced 2025-06-30 02:31:08 +00:00

fix: Rabbitmq deployment

This commit is contained in:
Alexander Konietzko 2023-09-02 17:52:05 +02:00
parent 9f9707ddf1
commit 269ffc7587
No known key found for this signature in database
GPG Key ID: BA6905F37AEC2B5B
5 changed files with 24 additions and 12 deletions

View File

@ -17,8 +17,8 @@
"RedisHostName": "redis",
"RabbitMQ": {
"Host": "rabbitmq",
"Username": "guest",
"Password": "guest",
"Username": "admin",
"Password": "DOIA9234JF",
"Enabled": "True"
}
}

View File

@ -13,6 +13,7 @@ public sealed class FanoutEventHandler : IFanoutEventHandler
RabbitMqHandler rabbitMqHandler)
{
_rabbitMqHandler = rabbitMqHandler;
_rabbitMqHandler.InitializeExchange(Messaging.ExchangeNameNotifications);
}
public Task<DomainEvent> HandleDomainEventAsync(DomainEvent @event)

View File

@ -65,7 +65,8 @@ Running the container
1. Change the ConnectionString in the appsettings.json to `Server=clean-architecture-db-service;Database=clean-architecture;Trusted_Connection=False;MultipleActiveResultSets=true;TrustServerCertificate=True;User Id=SA;Password=Password123!#`
2. Change the RedisHostName in the appsettings.json to `redis-service`
3. Build the docker image and push it to the docker hub (Change the image name in the `k8s-deployment.yml` to your own)
3. Change the RabbitMQ Host in the appsettings.json to `rabbitmq-service`
4. Build the docker image and push it to the docker hub (Change the image name in the `k8s-deployment.yml` to your own)
Apply the deployment file: `kubectl apply -f k8s-deployment.yml` (Delete: `kubectl delete -f k8s-deployment.yml`)

View File

@ -7,7 +7,10 @@ services:
ports:
- 80:80
depends_on:
- db
db:
condition: service_started
rabbitmq:
condition: service_healthy
links:
- db
healthcheck:
@ -38,13 +41,18 @@ services:
rabbitmq:
image: "rabbitmq:3-management"
ports:
- "5672:5672"
- "15672:15672"
- 5672:5672
- 15672:15672
environment:
- RABBITMQ_DEFAULT_USER=guest
- RABBITMQ_DEFAULT_PASS=guest
- RABBITMQ_DEFAULT_USER=admin
- RABBITMQ_DEFAULT_PASS=DOIA9234JF
volumes:
- rabbitmq_data:/var/lib/rabbitmq
healthcheck:
test: rabbitmq-diagnostics -q ping
interval: 10s
timeout: 3s
retries: 3
volumes:
rabbitmq_data:

View File

@ -142,9 +142,9 @@ spec:
- containerPort: 15672
env:
- name: RABBITMQ_DEFAULT_USER
value: guest
value: admin
- name: RABBITMQ_DEFAULT_PASS
value: guest
value: DOIA9234JF
volumeMounts:
- name: rabbitmq-data
mountPath: /var/lib/rabbitmq
@ -161,9 +161,11 @@ spec:
selector:
app: rabbitmq
ports:
- protocol: TCP
- name: rabbitmq-port
protocol: TCP
port: 5672
targetPort: 5672
- protocol: TCP
- name: rabbitmq-management-port
protocol: TCP
port: 15672
targetPort: 15672