desenvolvedor-io / dev-store

A microservices e-commerce reference application built with ASP.NET 6
https://devstore.academy
MIT License
1.05k stars 196 forks source link

[BUG] Error while trying to run the project with Docker #29

Open hnmendes opened 1 year ago

hnmendes commented 1 year ago

Describe the bug I used to run this project without any issues for a while, to understand and learn some things. However, lately it has started to throw this error related to the encryption part. It seems like the project is not recognizing the location of the certificate, is there a way to bypass this or completely mitigate this error?

To Reproduce Steps to reproduce the behavior:

  1. Update project to latest version in main branch
  2. Go to docker path
  3. With cmd/terminal execute docker-compose up
  4. Wait until all containers are up and running.
  5. See error Interop+Crypto+OpenSslCryptographicException: error:2006D080:BIO routines:BIO_new_file:no such file

Stacktrace devstore-web-mvc-ecommerce | Unhandled exception. Interop+Crypto+OpenSslCryptographicException: error:2006D080:BIO routines:BIO_new_file:no such file devstore-web-mvc-ecommerce | at Interop.Crypto.CheckValidOpenSslHandle(SafeHandle handle) devstore-web-mvc-ecommerce | at Internal.Cryptography.Pal.OpenSslX509CertificateReader.FromFile(String fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags) devstore-web-mvc-ecommerce | at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(String fileName, String password, X509KeyStorageFlags keyStorageFlags) devstore-web-mvc-ecommerce | at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName, String password) devstore-web-mvc-ecommerce | at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Certificates.CertificateConfigLoader.LoadCertificate(CertificateConfig certInfo, String endpointName) devstore-web-mvc-ecommerce | at Microsoft.AspNetCore.Server.Kestrel.KestrelConfigurationLoader.LoadDefaultCert() devstore-web-mvc-ecommerce | at Microsoft.AspNetCore.Server.Kestrel.KestrelConfigurationLoader.Reload() devstore-web-mvc-ecommerce | at Microsoft.AspNetCore.Server.Kestrel.KestrelConfigurationLoader.Load() devstore-web-mvc-ecommerce | at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken) devstore-web-mvc-ecommerce | at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication1 application, CancellationToken cancellationToken) devstore-web-mvc-ecommerce | at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken) devstore-web-mvc-ecommerce | at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken) devstore-web-mvc-ecommerce | at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) devstore-web-mvc-ecommerce | at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) devstore-web-mvc-ecommerce | at Program.<Main>$(String[] args) in /src/web/DevStore.WebApp.MVC/Program.cs:line 22 devstore-web-mvc-ecommerce | at Program.<Main>(String[] args) devstore-web-mvc-ecommerce exited with code 139

Expected behavior Run all services correctly and have no issues with openssl.

Screenshots print1 print2

Desktop (please complete the following information):

MatheusVSMPimentel commented 5 days ago

Hi @hnmendes I fix it adding the certs volume into web-mvc service

- ./certs:/https:ro

image

To run the docker-compose.yml I also have to comment in file devstore.conf all the configurations of web-status upstream server (this web-status service doesn't exist in docker-compose.yml)

image

Beside all this changes I had to make a last change on docker-compose.yml file :

` environment:

... all others configurations

        ASPNETCORE_FORWARDEDHEADERS_ENABLED: true
        ASPNETCORE_HTTPS_PORT:
        `

image

Obs.: These changes apply to run all compose files in this project and guarantee a access to front end application I did test any feature just navigation