ivanpaulovich / clean-architecture-manga

:cyclone: Clean Architecture with .NET6, C#10 and React+Redux. Use cases as central organizing structure, completely testable, decoupled from frameworks
http://paulovich.net/
Apache License 2.0
4.01k stars 689 forks source link

Environment Setup: docker_nginx doesn't not start - [emerg] 1#1: host not found in upstream #249

Open maxiar opened 3 years ago

maxiar commented 3 years ago

Hi! I'm trying to startup the projects using the latest version of vscode, dockers over windows 10...
I following the next steps successfully withouts errors but the

1) Change the sql sa password 2) Compile all projects successfully 3) Then I edit my system32/drivers/etc/hosts file and add the 127.0.0.1 wallet.local 4) Run the truscert-windows.ps1 to add the localhost certificate 5) Run docker-compose build & docker-compose -f docker-compose.yml -f docker-compose.override.yml up -d

Do I forgot any steps?

All was fine but the the next containers don't start: image

docker_nginx logs:

/docker-entrypoint.sh: Configuration complete; ready for start up 2020/11/19 02:28:54 [emerg] 1#1: host not found in upstream "accounts-api" in /etc/nginx/nginx.conf:41 nginx: [emerg] host not found in upstream "accounts-api" in /etc/nginx/nginx.conf:41

Obviously I can't browser any https://wallet.local:8081/ website.... I attached the nginx_config.json configuration file docker_nginx.log

accounts logs: standard_init_linux.go:211: exec user process caused "no such file or directory"

docker_accounts-api-seeds logs

Build started... Build succeeded. Server=sql1;User Id=sa;Password=XXXX;Database=Accounts; Applying migration '20200821064304_InitialCreate'. Done.

NOTE: I verified the SQL connections and tables, all works fine.

I supossed that the main issue is the nginx but I don't know how to fix it!

PD: I install and uninstall some times the dockers images and delete all containers and start again, without success.

Thanks

ivanpaulovich commented 3 years ago

Hey @maxiar,

Thank you reaching us!

I suspect the issue is on accounts-api. It did not find the required /https/localhost.crt file.

https://github.com/ivanpaulovich/clean-architecture-manga/blob/20973ff83d88ef8b39085d1c7f8bf767a0a113e3/accounts-api/src/WebApi/entrypoint.sh#L2

Please check the "shared drivers" in Docker desktop or run docker inspect accounts-api and look for

"Mounts": [
            {
                "Type": "bind",
                "Source": "C:\\repos\\clean-architecture-manga\\.docker\\https",
                "Destination": "/https",
                "Mode": "ro",
                "RW": false,
                "Propagation": "rprivate"
            }
        ]

To narrow your findings try docker-compose -f docker-compose.yml -f docker-compose.override.yml up -d accounts-api

maxiar commented 3 years ago

Hi! I don't have the "shared drivers" in Docker desktop, this option is only enabled for Windows Containers (https://github.com/docker/for-win/issues/7199#issuecomment-643390851). I'm running in a Linux Containers with WSL2 activated: https://docs.docker.com/docker-for-windows/wsl/ image

I verified the "docker inspect accounts-api" I found this:

    "Mounts": [
        {
            "Type": "bind",
            "Source": **"C:\\Projects\\Personal\\clean-architecture-manga\\.docker\\https",**
            "Destination": "/https",
            "Mode": "ro",
            "RW": false,
            "Propagation": "rprivate"
        }
    ],

And the files are located correctly: image

Note that: In the previous post I tell you that only run the "Run the truscert-windows.ps1 to add the localhost certificate", may be I missing something...

How to test or execute this command into accounts-api? cp /https/localhost.crt /usr/local/share/ca-certificates/localhost.crt