Skip to content

Commit ca1ff2e

Browse files
authored
Merge pull request #14 from cowienduckie/dev
feat: update Communication service and minor fixes
2 parents 3ab15ce + 2adc773 commit ca1ff2e

File tree

38 files changed

+1084
-143
lines changed

38 files changed

+1084
-143
lines changed

.github/workflows/redis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212

1313
jobs:
1414
deploy:
15-
name: Deploy
15+
name: Deploy
1616
runs-on: ubuntu-latest
1717
env:
1818
# Google Cloud variables

.github/workflows/seq.yml

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,54 @@
11
name: Seq Pipeline
22

33
on:
4-
workflow_dispatch:
4+
workflow_dispatch:
55

6-
push:
7-
branches:
8-
- main
9-
paths:
10-
- k8s/charts/seq/**/*
11-
- .github/workflows/seq.yml
6+
push:
7+
branches:
8+
- main
9+
paths:
10+
- k8s/charts/seq/**/*
11+
- .github/workflows/seq.yml
1212

1313
jobs:
14-
deploy:
15-
name: Deploy Seq
16-
runs-on: ubuntu-latest
17-
env:
18-
# Google Cloud variables
19-
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
20-
GOOGLE_PROJECT: ${{ secrets.GOOGLE_PROJECT }}
21-
PROJECT_NAME: promag
22-
REGION: us-central1
23-
LOCATION: us-central1-a
24-
25-
# Kubernetes variables
26-
CLUSTER_NAME: sit-cluster
27-
NAMESPACE: prod
28-
CHART: seq
29-
CHART_REPO: datalust/seq
30-
DEPLOYMENT: seq
31-
VALUES_FILE: values.yaml
32-
33-
steps:
34-
- name: Checkout
35-
uses: actions/checkout@v4
36-
37-
- name: Install the GCloud CLI
38-
uses: google-github-actions/setup-gcloud@v0
39-
with:
40-
project_id: ${{ secrets.GOOGLE_PROJECT }}
41-
service_account_key: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
42-
install_components: 'gke-gcloud-auth-plugin'
43-
export_default_credentials: true
44-
45-
- name: Install Helm
46-
run: |
47-
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
48-
helm repo add datalust https://helm.datalust.co
49-
50-
- name: Deploy to GKE
51-
run: |-
52-
gcloud container clusters get-credentials $CLUSTER_NAME --location $LOCATION
53-
54-
helm upgrade --install --namespace $NAMESPACE -f k8s/charts/$CHART/$VALUES_FILE $CHART $CHART_REPO
14+
deploy:
15+
name: Deploy Seq
16+
runs-on: ubuntu-latest
17+
env:
18+
# Google Cloud variables
19+
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
20+
GOOGLE_PROJECT: ${{ secrets.GOOGLE_PROJECT }}
21+
PROJECT_NAME: promag
22+
REGION: us-central1
23+
LOCATION: us-central1-a
24+
25+
# Kubernetes variables
26+
CLUSTER_NAME: sit-cluster
27+
NAMESPACE: prod
28+
CHART: seq
29+
CHART_REPO: datalust/seq
30+
DEPLOYMENT: seq
31+
VALUES_FILE: values.yaml
32+
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
37+
- name: Install the GCloud CLI
38+
uses: google-github-actions/setup-gcloud@v0
39+
with:
40+
project_id: ${{ secrets.GOOGLE_PROJECT }}
41+
service_account_key: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
42+
install_components: 'gke-gcloud-auth-plugin'
43+
export_default_credentials: true
44+
45+
- name: Install Helm
46+
run: |
47+
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
48+
helm repo add datalust https://helm.datalust.co
49+
50+
- name: Deploy to GKE
51+
run: |-
52+
gcloud container clusters get-credentials $CLUSTER_NAME --location $LOCATION
53+
54+
helm upgrade --install --namespace $NAMESPACE -f k8s/charts/$CHART/$VALUES_FILE $CHART $CHART_REPO

k8s/charts/communication-api/values.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,15 @@ env:
6969
value: http://identity-api:15101
7070

7171
- name: MailKit__SmtpHost
72-
value: mailhog
72+
value: smtp.mailgun.org
73+
- name: MailKit__SmtpPort
74+
value: '587'
7375
- name: MailKit__Username
74-
value: promag
75-
- name: MailKit__Password
76-
value: P@ssw0rd
76+
value: 'postmaster@mg.minhtrandev.com'
77+
- name: MailKit__MailBoxAddress
78+
value: 'promag@minhtrandev.com'
79+
- name: MailKit__MailBoxName
80+
value: 'Promag'
7781

7882
- name: MessageBus__TransportType
7983
value: RabbitMQ
@@ -87,3 +91,5 @@ env:
8791
key: Seq.Apikey
8892
- name: MessageBus__RabbitMQ__password
8993
key: RabbitMQ.Password
94+
- name: MailKit__Password
95+
value: MailKit.Password

k8s/charts/secret/templates/secret.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ data:
2323

2424
redis-password: {{ .Values.info.redis.password }}
2525
Redis.Configuration: {{ .Values.info.redis.configuration }}
26+
27+
MailKit.Password: {{ .Values.info.mailKit.password }}

k8s/charts/secret/values.local.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ info:
1616
redis:
1717
password: "UEBzc3cwcmQ="
1818
configuration: "cmVkaXMtbWFzdGVyOjYzODAscGFzc3dvcmQ9UEBzc3cwcmQ="
19+
mailKit:
20+
password: "NWE2MGE0MzMwYzlmY2JlMzk5NWM0YWY3NzM2N2YxYmUtMzBiNTgxMzgtZGM2ZDViNmM="

k8s/charts/secret/values.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ info:
1515
password: "UEBzc3cwcmQ="
1616
redis:
1717
password: "UEBzc3cwcmQ="
18-
configuration: "cmVkaXMtbWFzdGVyOjYzODAscGFzc3dvcmQ9UEBzc3cwcmQ="
18+
configuration: "cmVkaXMtbWFzdGVyOjYzODAscGFzc3dvcmQ9UEBzc3cwcmQ="
19+
mailKit:
20+
password: "NWE2MGE0MzMwYzlmY2JlMzk5NWM0YWY3NzM2N2YxYmUtMzBiNTgxMzgtZGM2ZDViNmM="

src/BuildingBlocks/Configuration.OpenTelemetry/Configuration.OpenTelemetry.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
</ItemGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="HotChocolate" Version="13.5.1" />
16-
<PackageReference Include="HotChocolate.Diagnostics" Version="13.5.1" />
15+
<PackageReference Include="HotChocolate" Version="13.5.1"/>
16+
<PackageReference Include="HotChocolate.Diagnostics" Version="13.5.1"/>
1717
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0"/>
1818
<PackageReference Include="OpenTelemetry" Version="1.6.0"/>
1919
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.6.0"/>

src/BuildingBlocks/Email.MailKit.Tests/MailKitSenderTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ public class MailKitSenderTests
1616
Port = 1025,
1717
Username = "fakeUser",
1818
Password = "fakePwd",
19-
Email = "fake@email.com"
19+
MailBoxAddress = "fake@email.com",
20+
MailBoxName = "fakeName"
2021
};
2122

2223
[Fact]

src/BuildingBlocks/Email.MailKit/MailKitOptions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ public class MailKitOptions
66
public int Port { get; set; } = 587;
77
public string Username { get; set; } = default!;
88
public string Password { get; set; } = default!;
9-
public string Email { get; set; } = default!;
9+
public string MailBoxAddress { get; set; } = default!;
10+
public string MailBoxName { get; set; } = default!;
1011
}

src/BuildingBlocks/Email.MailKit/MailKitSender.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,10 @@ private MimeMessage CreateMailMessage(EmailData email)
4141
Subject = email.Subject
4242
};
4343

44-
message.From.Add(new MailboxAddress(_mailkitOptions.Email, _mailkitOptions.Email));
44+
message.From.Add(new MailboxAddress(_mailkitOptions.MailBoxName, _mailkitOptions.MailBoxAddress));
4545

4646
email.ToAddress.ForEach(x => { message.To.Add(new MailboxAddress(x, x)); });
47-
4847
email.CcAddress.ForEach(x => { message.Cc.Add(new MailboxAddress(x, x)); });
49-
5048
email.BccAddress.ForEach(x => { message.Bcc.Add(new MailboxAddress(x, x)); });
5149

5250
message.Body = new TextPart(email.IsHtml ? TextFormat.Html : TextFormat.Plain) { Text = email.Body };

src/Communication/Communication.Api/Extensions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public static WebApplication ConfigureServices(this WebApplicationBuilder builde
4141

4242
builder.Services.AddSingleton<IHandlebarsRender, HandlebarsRender>();
4343

44+
builder.Services.AddControllers().AddApplicationPart(typeof(Anchor).Assembly);
45+
4446
return builder.Build();
4547
}
4648

@@ -51,6 +53,7 @@ public static WebApplication ConfigurePipeline(this WebApplication app)
5153
.UseRouting()
5254
.UseEndpoints(endpoints =>
5355
{
56+
endpoints.MapControllers();
5457
endpoints.MapGrpcService<CommunicationService>();
5558

5659
var appOptions = app.Configuration.GetOptions<AppOptions>("App");

src/Communication/Communication/Communication.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<PackageReference Include="Handlebars.Net" Version="2.1.4"/>
1616
<PackageReference Include="LazyCache" Version="2.4.0"/>
1717
<PackageReference Include="LazyCache.AspNetCore" Version="2.4.0"/>
18+
<PackageReference Include="PreMailer.Net" Version="2.5.0"/>
1819
</ItemGroup>
1920

2021
<ItemGroup>
@@ -32,6 +33,13 @@
3233
</Content>
3334
</ItemGroup>
3435

36+
<ItemGroup>
37+
<None Remove="EmailTemplates\Handlebars\Layouts\Basic.html.hbs"/>
38+
<None Remove="EmailTemplates\Handlebars\AccountUnlockedEmail.html.hbs"/>
39+
<None Remove="EmailTemplates\Handlebars\ActivationEmail.html.hbs"/>
40+
<None Remove="EmailTemplates\Handlebars\ResetPasswordEmail.html.hbs"/>
41+
</ItemGroup>
42+
3543
<ItemGroup>
3644
<Protobuf Include="..\..\_schema\proto\promag\common\v1\common.proto" Link="protobuf\common.proto" AdditionalImportDirs="..\..\_schema\proto\"/>
3745
<Protobuf Include="..\..\_schema\proto\promag\communication\v1\communication_api.proto" Link="protobuf\communication_api.proto" AdditionalImportDirs="..\..\_schema\proto\"/>

src/Communication/Communication/EmailTemplates/HandleBars/Layouts/Basics.html.hbs renamed to src/Communication/Communication/EmailTemplates/HandleBars/Layouts/Basic.html.hbs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,29 @@
22
<html lang="en">
33

44
<head>
5-
<meta name="viewport" content="width=device-width, initial-scale=1">
5+
<meta charset="utf-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1">
68
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
7-
<title></title>
9+
<title>ProMag Email</title>
810
<style>
11+
* {
12+
margin: 0;
13+
padding: 0;
14+
box-sizing: border-box;
15+
}
16+
17+
html, body {
18+
min-height: 100%;
19+
}
20+
21+
body {
22+
-webkit-font-smoothing: antialiased;
23+
-webkit-text-size-adjust: none;
24+
width: 100% !important;
25+
height: 100vh !important;
26+
}
27+
928
.entry-page-title {
1029
color: #576BE3;
1130
font-size: 36px;
Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,58 @@
1-
admin:
2-
address:
3-
socket_address:
4-
address: 0.0.0.0
5-
port_value: 8001
6-
static_resources:
7-
listeners:
1+
admin:
2+
address:
3+
socket_address:
4+
address: 0.0.0.0
5+
port_value: 8001
6+
static_resources:
7+
listeners:
88
- address:
99
socket_address:
1010
address: 0.0.0.0
1111
port_value: 80
1212
filter_chains:
13-
- filters:
14-
- name: envoy.filters.network.http_connection_manager
15-
typed_config:
16-
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
17-
codec_type: AUTO
18-
stat_prefix: ingress_http
19-
route_config:
20-
name: promag_backend_route
21-
virtual_hosts:
22-
- name: promag_backend
23-
domains:
24-
- "*"
25-
routes:
26-
- name: "p-short"
27-
match:
28-
prefix: "/p/"
29-
route:
30-
auto_host_rewrite: true
31-
prefix_rewrite: "/"
32-
cluster: personaldata
33-
http_filters:
34-
- name: envoy.filters.http.router
13+
- filters:
14+
- name: envoy.filters.network.http_connection_manager
3515
typed_config:
36-
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
37-
access_log:
38-
- name: envoy.access_loggers.file
39-
typed_config:
40-
"@type": type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog
41-
path: /tmp/access.log
42-
filter:
43-
not_health_check_filter: {}
16+
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
17+
codec_type: AUTO
18+
stat_prefix: ingress_http
19+
route_config:
20+
name: promag_backend_route
21+
virtual_hosts:
22+
- name: promag_backend
23+
domains:
24+
- "*"
25+
routes:
26+
- name: "p-short"
27+
match:
28+
prefix: "/p/"
29+
route:
30+
auto_host_rewrite: true
31+
prefix_rewrite: "/"
32+
cluster: personaldata
33+
http_filters:
34+
- name: envoy.filters.http.router
35+
typed_config:
36+
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
37+
access_log:
38+
- name: envoy.access_loggers.file
39+
typed_config:
40+
"@type": type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog
41+
path: /tmp/access.log
42+
filter:
43+
not_health_check_filter: { }
4444

45-
clusters:
45+
clusters:
4646
- name: personaldata
4747
connect_timeout: 0.25s
4848
type: strict_dns
4949
lb_policy: round_robin
5050
load_assignment:
5151
cluster_name: personaldata
5252
endpoints:
53-
- lb_endpoints:
54-
- endpoint:
55-
address:
56-
socket_address:
57-
address: personal-data-api
58-
port_value: 5003
53+
- lb_endpoints:
54+
- endpoint:
55+
address:
56+
socket_address:
57+
address: personal-data-api
58+
port_value: 5003

src/Gateways/GraphQl.Gateway/Extensions.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,18 @@ private static IServiceCollection AddGraphQl(this IServiceCollection services, I
123123
.AddHttpClient(WellKnownSchemaNames.Portal,
124124
(_, client) => { client.BaseAddress = new Uri($"{serviceOptions.PortalService.Url}/graphql"); })
125125
.AddHeaderPropagation();
126+
services
127+
.AddHttpClient(WellKnownSchemaNames.Communication,
128+
(_, client) => { client.BaseAddress = new Uri($"{serviceOptions.CommunicationService.Url}/graphql"); })
129+
.AddHeaderPropagation();
126130

127131
services
128132
.AddGraphQLServer()
129133
.AddErrorFilter<ValidationErrorFilter>()
130134
.AddRemoteSchema(WellKnownSchemaNames.PersonalData)
131135
.AddRemoteSchema(WellKnownSchemaNames.MasterData)
132-
.AddRemoteSchema(WellKnownSchemaNames.Portal);
136+
.AddRemoteSchema(WellKnownSchemaNames.Portal)
137+
.AddRemoteSchema(WellKnownSchemaNames.Communication);
133138

134139
return services;
135140
}

0 commit comments

Comments
 (0)