Skip to content

Commit

Permalink
Merge pull request #222 from meysamhadeli/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
meysamhadeli authored Feb 27, 2023
2 parents 8b9f926 + 1553085 commit 09a6852
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 99 deletions.
13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,28 +163,23 @@ docker-compose -f ./deployments/docker-compose/docker-compose.yaml up -d
```

> ### Kubernetes
1- Run the following command for applying TLS in Kubernetes cluster
For Configure TLS in kubernetes cluster we need install `cert-manager` base on [docs](https://cert-manager.io/docs/installation) and run the following commands for apply TLS in our application

```bash
kubectl apply -f ./deployments/kubernetes/booking-secret.yml
kubectl apply -f ./deployments/kubernetes/booking-cert-manager.yml
```
> Note: Also, we can run this commands for creating new `tls.key` and `tls.crt` and replace them with old one in `booking-secret.yml`
> Note: Also, we can run this commands for creating new `tls.key` and `tls.crt` and replace them with old one in `booking-cert-manager.yml` section `secret`
```bash
openssl req -x509 -newkey rsa:4096 -sha256 -nodes -keyout tls.key -out tls.crt -subj "/CN=booking-microservices.com" -days 365

kubectl create secret tls booking-tls --key tls.key --cert tls.crt
```

2- Run the following command to apply all deployments and services and configmaps that we need
Run the following command to apply all deployments, pods, services, ingress, configmaps that we need
```bash
kubectl apply -f ./deployments/kubernetes/booking-microservices.yml
```

3- Run the following command for apply ingress-controller for revers proxy
```bash
kubectl apply -f ./deployments/kubernetes/ingress.yml
```

### Documentation Apis

Each microservice uses swagger open api, navigate to /swagger for a list of every endpoint.
Expand Down
8 changes: 4 additions & 4 deletions deployments/docker-compose/infrastracture.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ services:
- 16686:16686


#######################################################
# EventStoreDB
#######################################################
#https://stackoverflow.com/questions/65272764/ports-are-not-available-listen-tcp-0-0-0-0-50070-bind-an-attempt-was-made-to
# #######################################################
# # EventStoreDB
# #######################################################
# #https://stackoverflow.com/questions/65272764/ports-are-not-available-listen-tcp-0-0-0-0-50070-bind-an-attempt-was-made-to

eventstore:
container_name: eventstore
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# #######################################################
# Secret
# #######################################################
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -7,3 +10,31 @@ type: kubernetes.io/tls
data:
tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tDQpNSUlGS1RDQ0F4R2dBd0lCQWdJVUZhOWxoMTc2enQxK3pSb013TEpoVWI5YUVHc3dEUVlKS29aSWh2Y05BUUVMDQpCUUF3SkRFaU1DQUdBMVVFQXd3WlltOXZhMmx1WnkxdGFXTnliM05sY25acFkyVnpMbU52YlRBZUZ3MHlNekF5DQpNakV4TVRRM01UQmFGdzB5TkRBeU1qRXhNVFEzTVRCYU1DUXhJakFnQmdOVkJBTU1HV0p2YjJ0cGJtY3RiV2xqDQpjbTl6WlhKMmFXTmxjeTVqYjIwd2dnSWlNQTBHQ1NxR1NJYjNEUUVCQVFVQUE0SUNEd0F3Z2dJS0FvSUNBUURVDQpqZ01vWHh0YXZzTVhVb0h2YTBXVWZSeWJKTVVnR1NQbml3ZWF3eW41RmlnVVR4Nmd2NlZ2T3pxU21HWjE4NVA0DQpVSWJXQ3VkOVdqRUNFU0pVSkI0cVpiUmlEWUlNQWQyMzM2Y2k1d0RzbkRGVXpuWHRNOWc1VUZmS3dPd2VPVmN2DQpqc1N0WWY2Szl3ZC8xaXRMb3JIeDV0eEVQblBkVGRGR0ZqOVlVT2t1MmM1VllIMk9LaUk3ampDaDAwc3RaZHo4DQp0NWkvL0t2MjdQRHQ2REc3L3VuMHlnVEcxa21NVU1QcnBSQmVIbFFNWWZ0N09xTTNHSHJEZml1SDdjNVpGNWM2DQphRGdQeWt5dzJSM2dMYkJqeUhiamE5VkZKcytkTUViUE1sa0RLeklWK2dndWdWR3d1UWRvRDUvSnZrem8zcVhUDQpjWkp3R0U3Mk9FRmlKbi9Wd1dPSDBXamxYS2pIQkF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kNXSmRySGxJR3UvNmFwDQp4aHhkcjhjMVE2cGlLQ1NLdWxuaFR0UU1Hd1FJYWVWZFZCWHZybFIzL1J0aGs0ejdmNTh5NkRocUh6SE1CVU4wDQpHdEJONks2YnBTWVNwdE5WSVF3emlZYWJ6ZDZ6SlRaWUFoUW5saXg2VjNEdXBTak51RVFPZkZndmJzQ09HZGVqDQpucUZ6NGtBVXgvajMrRUpJMjhjM2xkSklRb3F0d2JhNUxwQy9ZeFNza3NPYkVhZEpsVnhTYjdUUDNtaWpDWmwwDQpCc2puRVFLQ0FRQTZDSG5LZTNWNEF5WkRJV1N5UE0xZ2Q4VWVyQWY3V2paLzJ1RU0yWC9Nc1JvN2pHeHh4U0JMDQpUOE5vemtuZ05GbXV2SENnOURpdXRxZ0N0eHV5TXZ6MmJ2MnhXdWxPMm9ZL0NVdUQvVzV6aU44NzlnenBPSStPDQo5T0d4NklUV2xqZ0FKQmt4U1RaYXpYd0NVK05qNDlkY2ZicWhEZGtTQWZ6RW1COGpCRzEzaXprcVZEQTdYU0lBDQoxWDNUdEpkSGwzUmYwNFpoUUN1aCthWEdlRjdHOHQ0QTFhZW1iWWIyUStjM1BPK0s2ZlZZU3doTC9PeEdFdmUzDQpEc2x1aUZ2ZnM1cFIwb3B0ZWR6Y1RQdHhQM29tK0JiSThvUnVHVUdMdkNKbS9GYlNOL0c1TGFZS1U4YlkydHlhDQo1L05QTjR1OTZCcStRYUFsS0hKc24xL01XRWRaTS9ocg0KLS0tLS1FTkQgUFJJVkFURSBLRVktLS0tLQ0K
---
# #######################################################
# Issuer Cert-Manager
# #######################################################
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: booking-microservices-issuer
namespace: default
spec:
ca:
secretName: booking-tls
---
# #######################################################
# Certificate Cert-Manager
# #######################################################
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: booking-microservices-cert
namespace: default
spec:
secretName: booking-tls-cert
issuerRef:
name: booking-microservices-issuer
kind: Issuer
dnsNames:
- booking-microservices.com
90 changes: 90 additions & 0 deletions deployments/kubernetes/booking-microservices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,9 @@ spec:
configMap:
name: appsettings
---
# #######################################################
# Ingress Controller
# #######################################################
apiVersion: v1
kind: Service
metadata:
Expand All @@ -752,3 +755,90 @@ spec:
port: 80
targetPort: 80
type: ClusterIP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: booking-microservies
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$1
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/proxy-buffer-size: "128k"
nginx.ingress.kubernetes.io/proxy-buffers: "4 256k"
nginx.ingress.kubernetes.io/proxy-busy-buffers-size: "256k"
nginx.ingress.kubernetes.io/client-header-buffer-size: "64k"
nginx.ingress.kubernetes.io/http2-max-field-size: "16k"
nginx.ingress.kubernetes.io/http2-max-header-size: "128k"
nginx.ingress.kubernetes.io/large-client-header-buffers: "8 64k"
spec:
ingressClassName: nginx
tls:
- hosts:
- booking-microservices.com
secretName: booking-tls-cert
rules:
- host: booking-microservices.com
http:
paths:
- path: /identity
pathType: Prefix
backend:
service:
name: flight
port:
number: 80
- path: /identity/(.*)
pathType: Prefix
backend:
service:
name: identity
port:
number: 80


- path: /flight
pathType: Prefix
backend:
service:
name: flight
port:
number: 80
- path: /flight/(.*)
pathType: Prefix
backend:
service:
name: flight
port:
number: 80


- path: /passenger
pathType: Prefix
backend:
service:
name: passenger
port:
number: 80
- path: /passenger/(.*)
pathType: Prefix
backend:
service:
name: passenger
port:
number: 80


- path: /booking
pathType: Prefix
backend:
service:
name: booking
port:
number: 80
- path: /booking/(.*)
pathType: Prefix
backend:
service:
name: booking
port:
number: 80
86 changes: 0 additions & 86 deletions deployments/kubernetes/ingress.yml

This file was deleted.

0 comments on commit 09a6852

Please sign in to comment.