Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nats stream output #49

Merged
merged 5 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Argon.Server.sln
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig
.gitignore = .gitignore
.gitmodules = .gitmodules
docker-compose.yaml = docker-compose.yaml
GitVersion.yml = GitVersion.yml
src\AppHost\aspirate-output\docker-compose.yaml = src\AppHost\aspirate-output\docker-compose.yaml
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Argon.Contracts", "src\Argon.Contracts\Argon.Contracts.csproj", "{151002BD-57E5-440B-9CA7-C681A69CA02C}"
Expand Down
67 changes: 0 additions & 67 deletions docker-compose.yaml

This file was deleted.

9 changes: 5 additions & 4 deletions src/AppHost/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@
var smtpPort = builder.AddParameter("smtp-port", true);
var smtpUser = builder.AddParameter("smtp-user", true);
var smtpPassword = builder.AddParameter("smtp-password", true);
var cache = builder.AddRedis("cache", 6379).WithImage("eqalpha/keydb").WithDataVolume();
var nats = builder.AddNats("nats", 4222).WithDataVolume().WithJetStream();
var db = builder.AddPostgres("pg", port: 5432, userName: username, password: password).WithDataVolume();

var cache = builder.AddRedis("cache", 6379).WithImage("eqalpha/keydb").WithDataVolume().WithLifetime(ContainerLifetime.Persistent);
var nats = builder.AddNats("nats", 4222).WithDataVolume().WithJetStream().WithLifetime(ContainerLifetime.Persistent);
var db = builder.AddPostgres("pg", port: 5432, userName: username, password: password).WithDataVolume().WithLifetime(ContainerLifetime.Persistent);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Optimize PostgreSQL configuration for production use

Consider adding important PostgreSQL parameters for better performance and stability:

-var db = builder.AddPostgres("pg", port: 5432, userName: username, password: password).WithDataVolume().WithLifetime(ContainerLifetime.Persistent);
+var db = builder.AddPostgres("pg", port: 5432, userName: username, password: password)
+    .WithDataVolume()
+    .WithLifetime(ContainerLifetime.Persistent)
+    .WithEnvironment("POSTGRES_MAX_CONNECTIONS", "100")
+    .WithEnvironment("POSTGRES_SHARED_BUFFERS", "1GB")
+    .WithEnvironment("POSTGRES_EFFECTIVE_CACHE_SIZE", "3GB")
+    .WithEnvironment("POSTGRES_WORK_MEM", "16MB")
+    .WithEnvironment("POSTGRES_MAINTENANCE_WORK_MEM", "256MB");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
var db = builder.AddPostgres("pg", port: 5432, userName: username, password: password).WithDataVolume().WithLifetime(ContainerLifetime.Persistent);
var db = builder.AddPostgres("pg", port: 5432, userName: username, password: password)
.WithDataVolume()
.WithLifetime(ContainerLifetime.Persistent)
.WithEnvironment("POSTGRES_MAX_CONNECTIONS", "100")
.WithEnvironment("POSTGRES_SHARED_BUFFERS", "1GB")
.WithEnvironment("POSTGRES_EFFECTIVE_CACHE_SIZE", "3GB")
.WithEnvironment("POSTGRES_WORK_MEM", "16MB")
.WithEnvironment("POSTGRES_MAINTENANCE_WORK_MEM", "256MB");


var clickhouseResource = new ClickhouseBuilderExtension("clickhouse", username, password);
var clickhouse = builder.AddResource(clickhouseResource).WithImage("clickhouse/clickhouse-server")
.WithVolume("clickhouse-data", "/var/lib/clickhouse").WithVolume("logs", "/var/log/clickhouse-server")
.WithEnvironment("CLICKHOUSE_USER", username).WithEnvironment("CLICKHOUSE_PASSWORD", password).WithEnvironment("CLICKHOUSE_DB", username)
.WithEnvironment("CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT", "1").WithHttpEndpoint(8123, 8123) // http endpoint
.WithEndpoint(9000, 9000); // native client endpoint
.WithEndpoint(9000, 9000).WithLifetime(ContainerLifetime.Persistent); // native client endpoint

builder.AddContainer("smtpdev", "rnwood/smtp4dev").WithEndpoint(3080, 80, "http").WithEndpoint(2525, 25, "tcp");

Expand Down
Loading