Browse Source

updated docker configuration

pull/106/head
Galip Tolga Erdem 4 years ago
parent
commit
a5e3b3ed8b
  1. 14
      etc/docker/README.md
  2. 19
      etc/docker/certs/eshop-dk.crt
  3. 28
      etc/docker/certs/eshop-dk.key
  4. 40
      etc/docker/certs/eshop-ssl.conf
  5. 42
      etc/docker/docker-compose.yml

14
etc/docker/README.md

@ -0,0 +1,14 @@
### Generate Self-Signed Certificate Using OpenSSL
```
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout eshop-dk.key -out eshop-dk.crt -subj `"/CN=$certSubj`" -addext `"subjectAltName=DNS:localhost,DNS:host.docker.internal,DNS:app-authserver`"
openssl pkcs12 -export -in eshop-dk.crt -inkey eshop-dk.key -out eshop-dk.pfx -passout pass:8b6039b6-c67a-448b-977b-0ce6d3fcfd49
```
### How to run?
* Add entries to the hosts file (in Windows: `C:\Windows\System32\drivers\etc\hosts`):
````powershell
127.0.0.1 app-authserver
````

19
etc/docker/certs/eshop-dk.crt

@ -0,0 +1,19 @@
-----BEGIN CERTIFICATE-----
MIIDHzCCAgegAwIBAgIUX5WvovRMAkZTaoZGsFNyyjLU7F8wDQYJKoZIhvcNAQEL
BQAwADAeFw0yMjA0MDkxNjU3NDlaFw0yMzA0MDkxNjU3NDlaMAAwggEiMA0GCSqG
SIb3DQEBAQUAA4IBDwAwggEKAoIBAQD0KAzKq9bop31wIPo06eq4AYhdB0zZA+Eh
4mEOvCZ7MtAWUjkP1LudFF4IBlpIaAG0g6o5IhFRHQOIRfVXYA2NSGK8QpVSfmtk
it+Wc9bVvVJ9kqPhVakQIqhkOH4gPJ5MK/fhB6qSiN0TsbXZSHri6Q47Jd46X2DX
LK8c5/KRyrsFY/IVoSHC5kxyxLSzWK7T7JzqEXNtaVCOVf6difuCzPwiqqCk7WtC
LZcCj7n9m5UjpyOLo4iF8wIUk+IpaGKBxYBJ0MuMa8eG3Oz73JZBTaXAAJszNTgG
TVNYuUmi8z4s+U0p+sPW37hpv83atpPaV2rkyaYm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qNubeVoB2EX
BMFj55RDkWH9GU631deMDgfPvymZJ5HI1Dz+jdX7PbOfPbc+5AUN4lZqZw5/2yxN
ps0BUMz1Hr4goeoC0akFsnA5GXoFkhWh6xR45ZRfmPEDYxvk8tqeZvtZns+3AjfR
+C6C4YZdYsgLfWRFtxW3OlA=
-----END PRIVATE KEY-----

40
etc/docker/certs/eshop-ssl.conf

@ -0,0 +1,40 @@
[req]
default_bits = 2048
default_keyfile = eshop-dk.key
distinguished_name = req_distinguished_name
req_extensions = req_ext
x509_extensions = v3_ca
[req_distinguished_name]
commonName = Common Name (e.g. server FQDN or YOUR name)
commonName_default = eshoponabp
commonName_max = 64
[req_ext]
subjectAltName = @alt_names
[v3_ca]
subjectAltName = @alt_names
basicConstraints = critical, CA:false
keyUsage = keyCertSign, cRLSign, digitalSignature,keyEncipherment
[alt_names]
DNS.1 = localhost
DNS.2 = 127.0.0.1
DNS.3 = host.docker.internal
DNS.4 = app-authserver
DNS.5 = app-web
DNS.6 = app-publicweb
DNS.7 = gateway-web
DNS.8 = gateway-web-public
DNS.9 = administration-service
DNS.10 = identity-service
DNS.11 = catalog-service
DNS.12 = basket-service
DNS.13 = ordering-service
DNS.14 = payment-service
# Generate certificate from config
# Use the command:
# 'openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout eshop-dk.key -out eshop-dk-cert.pem -config eshop-ssl.conf'

42
etc/docker/docker-compose.yml

@ -10,7 +10,7 @@ services:
environment:
- ASPNETCORE_ENVIRONMENT=Docker
- ASPNETCORE_URLS=https://+:443;http://+:80;
- Kestrel__Certificates__Default__Path=/root/certificate/localhost.pfx
- Kestrel__Certificates__Default__Path=/root/certificate/eshop-dk.pfx
- Kestrel__Certificates__Default__Password=8b6039b6-c67a-448b-977b-0ce6d3fcfd49
# - Redis__Configuration=redis
# - RabbitMQ__Connections__Default__HostName=rabbitmq
@ -28,7 +28,7 @@ services:
networks:
- eshoponabp-network
volumes:
- ../dev-cert:/root/certificate
- ./certs:/root/certificate
identity-service:
image: eshoponabp/service-identity:latest
container_name: identity-service-container
@ -38,7 +38,7 @@ services:
environment:
- ASPNETCORE_ENVIRONMENT=Docker
- ASPNETCORE_URLS=https://+:443;http://+:80
- Kestrel__Certificates__Default__Path=/root/certificate/localhost.pfx
- Kestrel__Certificates__Default__Path=/root/certificate/eshop-dk.pfx
- Kestrel__Certificates__Default__Password=8b6039b6-c67a-448b-977b-0ce6d3fcfd49
- Redis__Configuration=redis
- RabbitMQ__Connections__Default__HostName=rabbitmq
@ -57,7 +57,7 @@ services:
networks:
- eshoponabp-network
volumes:
- ../dev-cert:/root/certificate
- ./certs:/root/certificate
catalog-service:
image: eshoponabp/service-catalog:latest
container_name: catalog-service-container
@ -67,7 +67,7 @@ services:
environment:
- ASPNETCORE_ENVIRONMENT=Docker
- ASPNETCORE_URLS=https://+:443;http://+:80;http://+:81;
- Kestrel__Certificates__Default__Path=/root/certificate/localhost.pfx
- Kestrel__Certificates__Default__Path=/root/certificate/eshop-dk.pfx
- Kestrel__Certificates__Default__Password=8b6039b6-c67a-448b-977b-0ce6d3fcfd49
- Kestrel__EndPoints__Http__Url=http://docker.host.internal:80
- Kestrel__EndPoints__Https__Url=https://docker.host.internal:443
@ -91,7 +91,7 @@ services:
networks:
- eshoponabp-network
volumes:
- ../dev-cert:/root/certificate
- ./certs:/root/certificate
basket-service:
image: eshoponabp/service-basket:latest
container_name: basket-service-container
@ -101,7 +101,7 @@ services:
environment:
- ASPNETCORE_ENVIRONMENT=Docker
- ASPNETCORE_URLS=https://+:443;http://+:80;
- Kestrel__Certificates__Default__Path=/root/certificate/localhost.pfx
- Kestrel__Certificates__Default__Path=/root/certificate/eshop-dk.pfx
- Kestrel__Certificates__Default__Password=8b6039b6-c67a-448b-977b-0ce6d3fcfd49
# - Redis__Configuration=redis
# - RabbitMQ__Connections__Default__HostName=rabbitmq
@ -121,7 +121,7 @@ services:
networks:
- eshoponabp-network
volumes:
- ../dev-cert:/root/certificate
- ./certs:/root/certificate
ordering-service:
image: eshoponabp/service-ordering:latest
container_name: ordering-service-container
@ -131,7 +131,7 @@ services:
environment:
- ASPNETCORE_ENVIRONMENT=Docker
- ASPNETCORE_URLS=https://+:443;http://+:80;
- Kestrel__Certificates__Default__Path=/root/certificate/localhost.pfx
- Kestrel__Certificates__Default__Path=/root/certificate/eshop-dk.pfx
- Kestrel__Certificates__Default__Password=8b6039b6-c67a-448b-977b-0ce6d3fcfd49
- Redis__Configuration=redis
- RabbitMQ__Connections__Default__HostName=rabbitmq
@ -150,7 +150,7 @@ services:
networks:
- eshoponabp-network
volumes:
- ../dev-cert:/root/certificate
- ./certs:/root/certificate
payment-service:
image: eshoponabp/service-payment:latest
container_name: payment-service-container
@ -160,7 +160,7 @@ services:
environment:
- ASPNETCORE_ENVIRONMENT=Docker
- ASPNETCORE_URLS=https://+:443;http://+:80;
- Kestrel__Certificates__Default__Path=/root/certificate/localhost.pfx
- Kestrel__Certificates__Default__Path=/root/certificate/eshop-dk.pfx
- Kestrel__Certificates__Default__Password=8b6039b6-c67a-448b-977b-0ce6d3fcfd49
- Redis__Configuration=redis
- RabbitMQ__Connections__Default__HostName=rabbitmq
@ -182,7 +182,7 @@ services:
networks:
- eshoponabp-network
volumes:
- ../dev-cert:/root/certificate
- ./certs:/root/certificate
app-web:
image: eshoponabp/app-web:latest
container_name: app-web-container
@ -203,7 +203,7 @@ services:
networks:
- eshoponabp-network
volumes:
- ../dev-cert:/root/certificate
- ./certs:/root/certificate
app-authserver:
image: eshoponabp/app-authserver:latest
container_name: app-authserver-container
@ -214,7 +214,7 @@ services:
- ASPNETCORE_ENVIRONMENT=Docker
- ASPNETCORE_URLS=https://+:443;http://+:80;
- ASPNETCORE_HTTPS_PORT=44330
- Kestrel__Certificates__Default__Path=/root/certificate/localhost.pfx
- Kestrel__Certificates__Default__Path=/root/certificate/eshop-dk.pfx
- Kestrel__Certificates__Default__Password=8b6039b6-c67a-448b-977b-0ce6d3fcfd49
# - Redis__Configuration=redis
# - RabbitMQ__Connections__Default__HostName=rabbitmq
@ -238,7 +238,7 @@ services:
networks:
- eshoponabp-network
volumes:
- ../dev-cert:/root/certificate
- ./certs:/root/certificate
app-publicweb:
image: eshoponabp/app-publicweb:latest
container_name: app-publicweb-container
@ -248,7 +248,7 @@ services:
environment:
- ASPNETCORE_ENVIRONMENT=Docker
- ASPNETCORE_URLS=https://+:443;http://+:80;
- Kestrel__Certificates__Default__Path=/root/certificate/localhost.pfx
- Kestrel__Certificates__Default__Path=/root/certificate/eshop-dk.pfx
- Kestrel__Certificates__Default__Password=8b6039b6-c67a-448b-977b-0ce6d3fcfd49
# - Redis__Configuration=redis
# - RabbitMQ__Connections__Default__HostName=rabbitmq
@ -268,7 +268,7 @@ services:
networks:
- eshoponabp-network
volumes:
- ../dev-cert:/root/certificate
- ./certs:/root/certificate
gateway-web:
image: eshoponabp/gateway-web:latest
container_name: gateway-web-container
@ -278,7 +278,7 @@ services:
environment:
- ASPNETCORE_ENVIRONMENT=Docker # Yarp can't resolve dns, needs to be overridden
- ASPNETCORE_URLS=https://+:443;http://+:80;
- Kestrel__Certificates__Default__Path=/root/certificate/localhost.pfx
- Kestrel__Certificates__Default__Path=/root/certificate/eshop-dk.pfx
- Kestrel__Certificates__Default__Password=8b6039b6-c67a-448b-977b-0ce6d3fcfd49
- Redis__Configuration=redis
- ReverseProxy__Clusters__accountCluster__Destinations__destination1__Address=http://app-authserver
@ -300,7 +300,7 @@ services:
networks:
- eshoponabp-network
volumes:
- ../dev-cert:/root/certificate
- ./certs:/root/certificate
gateway-web-public:
image: eshoponabp/gateway-web-public:latest
container_name: gateway-web-public-container
@ -310,7 +310,7 @@ services:
environment:
- ASPNETCORE_ENVIRONMENT=Docker # Yarp can't resolve dns, needs to be overridden
- ASPNETCORE_URLS=https://+:443;http://+:80;
- Kestrel__Certificates__Default__Path=/root/certificate/localhost.pfx
- Kestrel__Certificates__Default__Path=/root/certificate/eshop-dk.pfx
- Kestrel__Certificates__Default__Password=8b6039b6-c67a-448b-977b-0ce6d3fcfd49
- Redis__Configuration=redis
- ReverseProxy__Clusters__accountCluster__Destinations__destination1__Address=http://app-authserver
@ -331,7 +331,7 @@ services:
networks:
- eshoponabp-network
volumes:
- ../dev-cert:/root/certificate
- ./certs:/root/certificate
networks:
eshoponabp-network:

Loading…
Cancel
Save