Skip to content

Commit

Permalink
Finishing touch with postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
oveldman committed Aug 23, 2024
1 parent 445e1e3 commit d4c3d3a
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace: "manta-ray-plan-production"

image:
tag: "v0.4.6"
tag: "v0.4.7"

clusterIssuer:
enabled: true
Expand Down Expand Up @@ -30,6 +30,7 @@ logging:
firstTimePassword: "QFCKH3NTSBQ5zmsH9DpXTB2YefIavEGJKa4SshKb11AXX8b4o4KPjuo9bd6WBfqDkpxKqzNjaOrCsE49ph369Wx84mIrksnJx5OtRcxAOjff"

database:
enabled: true
size:
single: 10Gi
combined: 35Gi
Expand Down
16 changes: 16 additions & 0 deletions deployment/MantaRayPlanCloud/templates/api-grpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,22 @@ spec:
timeoutSeconds: 1
failureThreshold: 3
env:
- name: Database__Host
value: "postgres-ro"
- name: Database__Port
value: "5432"
- name: Database__DbName
value: "MantaRayPlan"
- name: Database__User
valueFrom:
secretKeyRef:
name: {{ .Values.database.secret.name }}
key: username
- name: Database__Password
valueFrom:
secretKeyRef:
name: {{ .Values.database.secret.name }}
key: password
- name: OpenTelemetry__LoggerEndpoint
value: "{{ .Values.logging.seq.host.internal }}"
- name: OpenTelemetry__LoggerApiKey
Expand Down
16 changes: 16 additions & 0 deletions deployment/MantaRayPlanCloud/templates/api-message-bus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,22 @@ spec:
timeoutSeconds: 1
failureThreshold: 3
env:
- name: Database__Host
value: "postgres-rw"
- name: Database__Port
value: "5432"
- name: Database__DbName
value: "MantaRayPlan"
- name: Database__User
valueFrom:
secretKeyRef:
name: {{ .Values.database.secret.name }}
key: username
- name: Database__Password
valueFrom:
secretKeyRef:
name: {{ .Values.database.secret.name }}
key: password
- name: OpenTelemetry__LoggerEndpoint
value: "{{ .Values.logging.seq.host.internal }}"
- name: OpenTelemetry__LoggerApiKey
Expand Down
2 changes: 1 addition & 1 deletion deployment/MantaRayPlanCloud/templates/postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: Secret
metadata:
name: postgres-secret
name: {{ .Values.database.secret.name }}
namespace: {{ .Values.namespace }}
type: kubernetes.io/basic-auth
data:
Expand Down
2 changes: 2 additions & 0 deletions deployment/MantaRayPlanCloud/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ database:
size:
single: 1Gi
combined: 4Gi
secret:
name: postgres-secret

pgadmin:
outsideAccess:
Expand Down
2 changes: 1 addition & 1 deletion docs/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ helm install -f environments/values-development.yaml manta-ray-plan-cloud .

Upgrade the cluster when you have a new version:
```shell
helm upgrade -f environments/values-development.yaml manta-ray-plan-cloud .
helm upgrade -f environments/values-development.yaml manta-ray-plan-cloud .
```

Remove the cluster from Kubernetes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,28 @@

namespace MadWorldNL.MantaRayPlan.MessageBuses;

public class MessageBusRepository : IMessageBusRepository
public class MessageBusRepository(MantaRayPlanDbContext dbContext) : IMessageBusRepository
{
private readonly MantaRayPlanDbContext _dbContext;

public MessageBusRepository(MantaRayPlanDbContext dbContext)
{
_dbContext = dbContext;
}

public async Task CreateAsync(MessageBusStatus status)
{
await _dbContext.MessageBusStatus
await dbContext.MessageBusStatus
.AddAsync(status);

await _dbContext.SaveChangesAsync();
await dbContext.SaveChangesAsync();
}

public async Task<MessageBusStatus?> FindStatusAsync()
{
return await _dbContext.MessageBusStatus
return await dbContext.MessageBusStatus
.OrderBy(s => s.Id)
.LastOrDefaultAsync();
}

public async Task UpdateAsync(MessageBusStatus status)
{
_dbContext.MessageBusStatus
dbContext.MessageBusStatus
.Update(status);

await _dbContext.SaveChangesAsync();
await dbContext.SaveChangesAsync();
}
}

0 comments on commit d4c3d3a

Please sign in to comment.