-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathProgram.cs
66 lines (51 loc) · 2.23 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using ShadowShop.AppHost.Resources;
var builder = DistributedApplication.CreateBuilder(args);
// Service Dependencies
var vault = builder.AddVaultDevServer("vault");
var vaultScript = builder.AddExecutable("vault-setup-script", "bash", "./.config/vault", "setup.sh")
.WithReference(vault);
var grafanaStack = builder.AddGrafanaStack("grafana", grafanaPort: 3000, otelPort: 4317);
var temporalDev = builder.AddTemporalDevServer(nameSpace: "ShadowShop");
var postgresPwd = builder.AddParameter("postgresPassword", true);
var catalogDb = builder.AddPostgres("catalog", port: 5432, password: postgresPwd)
.WithDataVolume()
.AddDatabase("catalogDb");
var rabbitPwd = builder.AddParameter("rabbitmqPassword", true);
var rmq = builder.AddRabbitMQ("rmq", password: rabbitPwd)
.WithManagementPlugin(15672);
var redisPwd = builder.AddParameter("redisPassword", true);
var redisCache = builder.AddRedisStack("basketCache")
.WithPassword(redisPwd)
.WithRedisInsight()
.WithConfiguration("./.config/redis/redis.conf");
// Application Projects
builder.AddProject<Projects.ShadowShop_CatalogInitializer>("catalogInitializer")
.WithReference(vault)
.WithReference(catalogDb)
.WaitForCompletion(vaultScript);
var catalogService = builder.AddProject<Projects.ShadowShop_CatalogService>("catalogService")
.WithReference(grafanaStack)
.WithReference(catalogDb);
var basketService = builder.AddProject<Projects.ShadowShop_BasketService>("basketService")
.WithReference(grafanaStack)
.WithReference(redisCache);
builder.AddProject<Projects.ShadowShop_WorkflowProcessor>("workflowProcessor")
.WithReference(grafanaStack)
.WithReference(vault)
.WithReference(temporalDev)
.WithReference(rmq)
.WaitFor(temporalDev)
.WaitFor(rmq);
var frontend = builder.AddProject<Projects.ShadowShop_Frontend>("frontend")
.WithReference(basketService)
.WithReference(catalogService)
.WithReference(rmq)
.WithReference(grafanaStack)
.WithReference(vault)
.WaitFor(rmq);
// Stripe Events Proxy
var stripeSecretKey = builder.AddParameter("stripeSecretKey", true);
builder.AddStripeDevProxy("stripe-events-proxy", stripeSecretKey, frontend, "/webhooks/stripe");
// Run host
var app = builder.Build();
app.Run();