-
-
Notifications
You must be signed in to change notification settings - Fork 506
Expand file tree
/
Copy pathProgram.cs
More file actions
167 lines (149 loc) · 6.13 KB
/
Copy pathProgram.cs
File metadata and controls
167 lines (149 loc) · 6.13 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
using System.Reflection;
using Aspire.Hosting.JavaScript;
using Microsoft.Extensions.Hosting;
var builder = DistributedApplication.CreateBuilder(args);
var servicesOnly = HasArgument("--services-only");
var ciE2E = HasArgument("--ci-e2e");
var includeDevTools = !ciE2E;
var elastic = builder.AddElasticsearch("Elasticsearch", port: 9200)
.WithDataVolume(servicesOnly ? null : "exceptionless.data.v1");
var storage = builder.AddAzureStorage("Storage")
.RunAsEmulator(c =>
{
c.WithUrlForEndpoint("blob", u => { u.DisplayText = "Blobs"; u.DisplayLocation = UrlDisplayLocation.DetailsOnly; });
c.WithUrlForEndpoint("queue", u => { u.DisplayText = "Queues"; u.DisplayLocation = UrlDisplayLocation.DetailsOnly; });
c.WithUrlForEndpoint("table", u => { u.DisplayText = "Tables"; u.DisplayLocation = UrlDisplayLocation.DetailsOnly; });
if (!servicesOnly)
{
c.WithLifetime(ContainerLifetime.Persistent);
c.WithContainerName("Exceptionless-Storage");
c.WithDataVolume();
}
});
var storageBlobs = storage.AddBlobs("StorageBlobs");
var storageQueues = storage.AddQueues("StorageQueues");
var cache = builder.AddRedis("Redis", port: 6379)
.WithImageTag("8.6")
.WithClearCommand()
.WithUrls(c =>
{
foreach (var url in c.Urls)
{
url.DisplayLocation = UrlDisplayLocation.DetailsOnly;
}
});
var mail = builder.AddContainer("Mail", "axllent/mailpit")
.WithImageTag("v1.27.10")
.WithHttpEndpoint(8025, 8025, "http")
.WithUrlForEndpoint("http", u => { u.DisplayText = "Mail"; u.DisplayOrder = 100; })
.WithHttpHealthCheck("/readyz")
.WithEndpoint(1025, 1025)
.WithUrlForEndpoint("tcp", u => u.DisplayLocation = UrlDisplayLocation.DetailsOnly);
if (!servicesOnly)
{
elastic = elastic
.WithLifetime(ContainerLifetime.Persistent)
.WithContainerName("Exceptionless-Elasticsearch");
if (includeDevTools)
{
elastic = elastic.WithKibana(b => b
.WithLifetime(ContainerLifetime.Persistent)
.WithContainerName("Exceptionless-Kibana")
.WithParentRelationship(elastic));
}
cache = cache
.WithLifetime(ContainerLifetime.Persistent)
.WithContainerName("Exceptionless-Redis");
if (includeDevTools)
{
cache = cache.WithRedisInsight(b => b
.WithLifetime(ContainerLifetime.Persistent)
.WithContainerName("Exceptionless-RedisInsight")
.WithUrlForEndpoint("http", u => u.DisplayText = "Redis")
.WithParentRelationship(cache), containerName: "Redis-insight");
}
mail = mail
.WithLifetime(ContainerLifetime.Persistent)
.WithContainerName("Exceptionless-Mail");
var api = builder.AddProject<Projects.Exceptionless_Web>("Api")
.WithReference(cache)
.WithReference(elastic)
.WithReference(storageBlobs, "AzureStorage")
.WithReference(storageQueues, "AzureQueues")
.WithEnvironment("ConnectionStrings:Email", "smtp://localhost:1025")
.WithEnvironment("RunJobsInProcess", "false")
.WaitFor(elastic)
.WaitFor(cache)
.WaitFor(mail)
.WithExternalHttpEndpoints()
.WithUrlForEndpoint("https", u => { u.DisplayText = "Open API"; u.DisplayOrder = 100; })
.WithUrlForEndpoint("http", u => u.DisplayLocation = UrlDisplayLocation.DetailsOnly)
.WithHttpHealthCheck("/health");
builder.AddProject<Projects.Exceptionless_Job>("Jobs", "AllJobs")
.WithReference(cache)
.WithReference(elastic)
.WithReference(storageBlobs, "AzureStorage")
.WithReference(storageQueues, "AzureQueues")
.WithEnvironment("ConnectionStrings:Email", "smtp://localhost:1025")
.WaitFor(elastic)
.WaitFor(cache)
.WaitFor(mail)
.WithUrlForEndpoint("http", u =>
{
u.DisplayText = "Jobs";
u.DisplayLocation = UrlDisplayLocation.DetailsOnly;
})
.WithUrlForEndpoint("https", u =>
{
u.DisplayText = "Jobs";
u.DisplayLocation = UrlDisplayLocation.DetailsOnly;
})
.WithHttpHealthCheck("/health")
.WithParentRelationship(api);
#pragma warning disable ASPIREBROWSERLOGS001
var oldApp = builder.AddJavaScriptApp("OldApp", "../../src/Exceptionless.Web/ClientApp.angular", "serve")
.WithBrowserLogs()
.WithReference(api)
.RemoveJavaScriptDebuggingAnnotation()
.WithEnvironment("ASPNETCORE_URLS", "http://localhost:7120")
.WithEnvironment("USE_HTTPS", "true")
.WithHttpEndpoint(port: 7121, targetPort: 7121, name: "https", env: "PORT", isProxied: false)
.WithEndpoint("https", e =>
{
e.TargetHost = "angular-ex.dev.localhost";
e.UriScheme = "https";
})
.WithHttpsDeveloperCertificate()
.WithUrlForEndpoint("https", u =>
{
u.DisplayText = "Open App (Old)";
u.DisplayOrder = 100;
})
.WithParentRelationship(api);
#pragma warning restore ASPIREBROWSERLOGS001
#pragma warning disable ASPIREBROWSERLOGS001
builder.AddViteApp("App", "../Exceptionless.Web/ClientApp")
.WithBrowserLogs()
.WithReference(api)
.WithReference(oldApp)
.RemoveJavaScriptDebuggingAnnotation()
.WithEndpoint("http", e =>
{
// 7131 (HTTPS via Aspire dev cert) instead of Vite's default 5173 to avoid clashing with other local Vite projects.
e.Port = 7131;
e.TargetPort = 7131;
e.TargetHost = "web-ex.dev.localhost";
e.IsProxied = false;
})
.WithHttpsDeveloperCertificate()
.WithUrlForEndpoint("http", u =>
{
u.DisplayText = "Open App";
u.DisplayOrder = 100;
u.Url = $"{u.Url.TrimEnd('/')}/next/";
})
.WithParentRelationship(api);
#pragma warning restore ASPIREBROWSERLOGS001
}
await builder.Build().RunAsync();
bool HasArgument(string name) => args.Any(arg => StringComparer.OrdinalIgnoreCase.Equals(arg, name) || StringComparer.OrdinalIgnoreCase.Equals(arg, name.TrimStart('-')));