mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-04-28 08:50:23 +08:00
refactor: Refactor kubernetes configs
This commit is contained in:
parent
af4b9866a8
commit
4a31ffbb0b
@ -43,11 +43,11 @@ runs:
|
|||||||
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
docker build -t ${{ inputs.registry-username }}/${{ inputs.image-name }}:v1.6.5 -f "${{ github.workspace }}/${{ inputs.dockerfile-path }}" .
|
docker build -t ${{ inputs.registry-username }}/${{ inputs.image-name }}:v1.6.6 -f "${{ github.workspace }}/${{ inputs.dockerfile-path }}" .
|
||||||
|
|
||||||
- name: Publish Docker Image
|
- name: Publish Docker Image
|
||||||
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
docker push ${{ inputs.registry-username }}/${{ inputs.image-name }}:v1.6.5
|
docker push ${{ inputs.registry-username }}/${{ inputs.image-name }}:v1.6.6
|
||||||
|
|
||||||
|
|||||||
@ -15,27 +15,15 @@ spec:
|
|||||||
app: booking
|
app: booking
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- image: meysamh66/booking-microservices-booking:v1.5.7
|
- image: meysamh66/booking-microservices-booking:v1.6.5
|
||||||
name: booking
|
name: booking
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
env:
|
env:
|
||||||
- name: "ASPNETCORE_ENVIRONMENT"
|
- name: ASPNETCORE_ENVIRONMENT
|
||||||
value: "docker"
|
value: docker
|
||||||
- name: ASPNETCORE_URLS
|
- name: ASPNETCORE_URLS
|
||||||
value: "http://+"
|
value: http://+
|
||||||
# - name: "RabbitMqOptions__HostName"
|
|
||||||
# value: "localhost"
|
|
||||||
# - name: "RabbitMqOptions__ExchangeName"
|
|
||||||
# value: "booking"
|
|
||||||
# - name: "RabbitMqOptions__UserName"
|
|
||||||
# value: "guest"
|
|
||||||
# - name: "RabbitMqOptions__Password"
|
|
||||||
# value: "guest"
|
|
||||||
# - name: "RabbitMqOptions__Port"
|
|
||||||
# value: "5672"
|
|
||||||
- name: "EventStore__ConnectionString"
|
|
||||||
value: "esdb://eventstore:2113?tls=false"
|
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: appsettings-volume
|
- name: appsettings-volume
|
||||||
mountPath: /app/Settings
|
mountPath: /app/Settings
|
||||||
@ -47,7 +35,7 @@ spec:
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: booking-service
|
name: booking
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: booking
|
app: booking
|
||||||
|
|||||||
@ -15,39 +15,15 @@ spec:
|
|||||||
app: flight
|
app: flight
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- image: meysamh66/booking-microservices-flight:v1.6.3
|
- image: meysamh66/booking-microservices-flight:v1.6.5
|
||||||
name: flight
|
name: flight
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
env:
|
env:
|
||||||
- name: "ASPNETCORE_ENVIRONMENT"
|
- name: ASPNETCORE_ENVIRONMENT
|
||||||
value: "docker"
|
value: docker
|
||||||
- name: ASPNETCORE_URLS
|
- name: ASPNETCORE_URLS
|
||||||
value: "http://+"
|
value: http://+
|
||||||
- name: "RabbitMqOptions__HostName"
|
|
||||||
value: "rabbitmq"
|
|
||||||
- name: "RabbitMqOptions__ExchangeName"
|
|
||||||
value: "flight"
|
|
||||||
- name: "RabbitMqOptions__UserName"
|
|
||||||
value: "guest"
|
|
||||||
- name: "RabbitMqOptions__Password"
|
|
||||||
value: "guest"
|
|
||||||
- name: "RabbitMqOptions__Port"
|
|
||||||
value: "5672"
|
|
||||||
- name: "MongoOptions__ConnectionString"
|
|
||||||
value: "mongodb://mongo:27017"
|
|
||||||
- name: "MongoOptions__DatabaseName"
|
|
||||||
value: "flight-db"
|
|
||||||
- name: "Jwt__Authority"
|
|
||||||
value: "http://127.0.0.1:7914"
|
|
||||||
- name: "Jwt__Audience"
|
|
||||||
value: "flight-api"
|
|
||||||
- name: "Jwt__RequireHttpsMetadata"
|
|
||||||
value: "false"
|
|
||||||
- name: "Jwt__MetadataAddress"
|
|
||||||
value: "flight/.well-known/openid-configuration"
|
|
||||||
# - name: "HealthOptions__Enabled"
|
|
||||||
# value: "true"
|
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: appsettings-volume
|
- name: appsettings-volume
|
||||||
mountPath: /app/Settings
|
mountPath: /app/Settings
|
||||||
@ -59,7 +35,7 @@ spec:
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: flight-service
|
name: flight
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: flight
|
app: flight
|
||||||
@ -67,6 +43,5 @@ spec:
|
|||||||
- name: http
|
- name: http
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
port: 80
|
port: 80
|
||||||
# targetPort: 80
|
targetPort: 80
|
||||||
nodePort: 30444
|
type: ClusterIP
|
||||||
type: NodePort
|
|
||||||
|
|||||||
@ -15,15 +15,15 @@ spec:
|
|||||||
app: identity
|
app: identity
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- image: meysamh66/booking-microservices-identity:v1.6.3
|
- image: meysamh66/booking-microservices-identity:v1.6.5
|
||||||
name: identity
|
name: identity
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
env:
|
env:
|
||||||
- name: "ASPNETCORE_ENVIRONMENT"
|
- name: ASPNETCORE_ENVIRONMENT
|
||||||
value: "docker"
|
value: docker
|
||||||
- name: ASPNETCORE_URLS
|
- name: ASPNETCORE_URLS
|
||||||
value: http://+:80
|
value: http://+
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: appsettings-volume
|
- name: appsettings-volume
|
||||||
mountPath: /app/Settings
|
mountPath: /app/Settings
|
||||||
@ -35,7 +35,7 @@ spec:
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: identity-service
|
name: identity
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: identity
|
app: identity
|
||||||
@ -44,5 +44,4 @@ spec:
|
|||||||
protocol: TCP
|
protocol: TCP
|
||||||
port: 80
|
port: 80
|
||||||
targetPort: 80
|
targetPort: 80
|
||||||
nodePort: 30443
|
type: ClusterIP
|
||||||
type: NodePort
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ kind: Ingress
|
|||||||
metadata:
|
metadata:
|
||||||
name: booking-microservies
|
name: booking-microservies
|
||||||
annotations:
|
annotations:
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
nginx.ingress.kubernetes.io/rewrite-target: /$1
|
||||||
nginx.ingress.kubernetes.io/proxy-buffer-size: "128k"
|
nginx.ingress.kubernetes.io/proxy-buffer-size: "128k"
|
||||||
nginx.ingress.kubernetes.io/proxy-buffers: "4 256k"
|
nginx.ingress.kubernetes.io/proxy-buffers: "4 256k"
|
||||||
nginx.ingress.kubernetes.io/proxy-busy-buffers-size: "256k"
|
nginx.ingress.kubernetes.io/proxy-busy-buffers-size: "256k"
|
||||||
@ -13,24 +13,33 @@ metadata:
|
|||||||
nginx.ingress.kubernetes.io/large-client-header-buffers: "8 64k"
|
nginx.ingress.kubernetes.io/large-client-header-buffers: "8 64k"
|
||||||
spec:
|
spec:
|
||||||
ingressClassName: nginx
|
ingressClassName: nginx
|
||||||
# tls:
|
tls:
|
||||||
# - hosts:
|
- hosts:
|
||||||
# - myidentityserver.com
|
- myidentityserver.com
|
||||||
# secretName: identity-tls
|
secretName: identity-tls
|
||||||
# - hosts:
|
- hosts:
|
||||||
# - booking-microservices.com
|
- booking-microservices.com
|
||||||
# secretName: booking-tls
|
secretName: booking-tls
|
||||||
rules:
|
rules:
|
||||||
# - host: myidentityserver.com
|
- host: myidentityserver.com
|
||||||
# http:
|
http:
|
||||||
# paths:
|
paths:
|
||||||
# - path: /
|
- path: /
|
||||||
# pathType: Prefix
|
pathType: Prefix
|
||||||
# backend:
|
backend:
|
||||||
# service:
|
service:
|
||||||
# name: identity-service
|
name: identity
|
||||||
# port:
|
port:
|
||||||
# number: 80
|
number: 80
|
||||||
|
- path: /(.+)
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: identity
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
|
|
||||||
|
|
||||||
- host: booking-microservices.com
|
- host: booking-microservices.com
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
@ -38,20 +47,45 @@ spec:
|
|||||||
pathType: Prefix
|
pathType: Prefix
|
||||||
backend:
|
backend:
|
||||||
service:
|
service:
|
||||||
name: flight-service
|
name: flight
|
||||||
port:
|
port:
|
||||||
number: 80
|
number: 80
|
||||||
|
- path: /flight/(.+)
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: flight
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
|
|
||||||
|
|
||||||
- path: /passenger
|
- path: /passenger
|
||||||
pathType: Prefix
|
pathType: Prefix
|
||||||
backend:
|
backend:
|
||||||
service:
|
service:
|
||||||
name: passenger-service
|
name: passenger
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
|
- path: /passenger/(.+)
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: passenger
|
||||||
port:
|
port:
|
||||||
number: 80
|
number: 80
|
||||||
|
|
||||||
|
|
||||||
- path: /booking
|
- path: /booking
|
||||||
pathType: Prefix
|
pathType: Prefix
|
||||||
backend:
|
backend:
|
||||||
service:
|
service:
|
||||||
name: booking-service
|
name: booking
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
|
- path: /booking/(.+)
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: booking
|
||||||
port:
|
port:
|
||||||
number: 80
|
number: 80
|
||||||
@ -15,15 +15,15 @@ spec:
|
|||||||
app: passenger
|
app: passenger
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- image: meysamh66/booking-microservices-passenger:v1.5.7
|
- image: meysamh66/booking-microservices-passenger:v1.6.5
|
||||||
name: passenger
|
name: passenger
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
env:
|
env:
|
||||||
- name: "ASPNETCORE_ENVIRONMENT"
|
- name: ASPNETCORE_ENVIRONMENT
|
||||||
value: "docker"
|
value: docker
|
||||||
- name: ASPNETCORE_URLS
|
- name: ASPNETCORE_URLS
|
||||||
value: "http://+"
|
value: http://+
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: appsettings-volume
|
- name: appsettings-volume
|
||||||
mountPath: /app/Settings
|
mountPath: /app/Settings
|
||||||
@ -35,7 +35,7 @@ spec:
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: passenger-service
|
name: passenger
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: passenger
|
app: passenger
|
||||||
|
|||||||
@ -89,8 +89,6 @@ public static class InfrastructureExtensions
|
|||||||
|
|
||||||
builder.Services.AddEasyCaching(options => { options.UseInMemory(configuration, "mem"); });
|
builder.Services.AddEasyCaching(options => { options.UseInMemory(configuration, "mem"); });
|
||||||
|
|
||||||
Microsoft.IdentityModel.Logging.IdentityModelEventSource.ShowPII = true;
|
|
||||||
|
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -79,7 +79,11 @@ public static class InfrastructureExtensions
|
|||||||
|
|
||||||
builder.AddCustomIdentityServer();
|
builder.AddCustomIdentityServer();
|
||||||
|
|
||||||
Microsoft.IdentityModel.Logging.IdentityModelEventSource.ShowPII = true;
|
builder.Services.Configure<ForwardedHeadersOptions>(options =>
|
||||||
|
{
|
||||||
|
options.ForwardedHeaders =
|
||||||
|
ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
|
||||||
|
});
|
||||||
|
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
@ -90,14 +94,13 @@ public static class InfrastructureExtensions
|
|||||||
var env = app.Environment;
|
var env = app.Environment;
|
||||||
var appOptions = app.GetOptions<AppOptions>(nameof(AppOptions));
|
var appOptions = app.GetOptions<AppOptions>(nameof(AppOptions));
|
||||||
|
|
||||||
var forwardHeaderOptions = new ForwardedHeadersOptions
|
app.UseForwardedHeaders();
|
||||||
{
|
|
||||||
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
|
|
||||||
};
|
|
||||||
forwardHeaderOptions.KnownNetworks.Clear();
|
|
||||||
forwardHeaderOptions.KnownProxies.Clear();
|
|
||||||
|
|
||||||
app.UseForwardedHeaders(forwardHeaderOptions);
|
app.Use((context, next) =>
|
||||||
|
{
|
||||||
|
context.Request.Scheme = "https";
|
||||||
|
return next();
|
||||||
|
});
|
||||||
|
|
||||||
app.UseProblemDetails();
|
app.UseProblemDetails();
|
||||||
app.UseSerilogRequestLogging(options =>
|
app.UseSerilogRequestLogging(options =>
|
||||||
@ -112,6 +115,7 @@ public static class InfrastructureExtensions
|
|||||||
app.UseIdentityServer();
|
app.UseIdentityServer();
|
||||||
app.MapMetrics();
|
app.MapMetrics();
|
||||||
|
|
||||||
|
|
||||||
app.MapGet("/", x => x.Response.WriteAsync(appOptions.Name));
|
app.MapGet("/", x => x.Response.WriteAsync(appOptions.Name));
|
||||||
|
|
||||||
if (env.IsDevelopment())
|
if (env.IsDevelopment())
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user