cli icon indicating copy to clipboard operation
cli copied to clipboard

Installing Dapr runtime via dapr init not working

Open BjoernAtBosch opened this issue 2 years ago • 11 comments

The same or similar issue was already reported here: https://github.com/dapr/docs/issues/2674 (Maybe wrong repo - therefore creating this new bug report here)

Expected Behavior

Due to Dapr documentation is should be possible to install the Dapr runtime with either dapr init or dapr init --runtime-version 1.8.1.

Actual Behavior

Trying this with Dapr cli v1.8.0 is resulting in an error message:

someuser@somehost > ~ > dapr --version
CLI version: 1.8.0
Runtime version: n/a
someuser@somehost > ~ > dapr init
⌛  Making the jump to hyperspace...
ℹ️  Container images will be pulled from Docker Hub
ℹ️  Installing runtime version 1.8.3
❌  Downloading binaries and setting up components...
❌  error downloading dashboard binary: Get "https://github.com/dapr/dashboard/releases/download/v0.10.0/dashboard_linux_amd64.tar.gz": dial tcp: lookup github.com on 127.0.0.53:53: no such host

Workaround

Download is working with dapr cli v1.7.1 in the same environment/setup (see below):

someuser@somehost > ~ > dapr --version
CLI version: 1.7.1 
Runtime version: n/a
someuser@somehost > ~ > dapr init
⌛  Making the jump to hyperspace...
ℹ️  Container images will be pulled from Docker Hub
ℹ️  Installing runtime version 1.8.3
↗  Downloading binaries and setting up components... 
Dapr runtime installed to /home/someuser/.dapr/bin, you may run the following to add it to your path if you want to run daprd directly:
    export PATH=$PATH:/home/someuser/.dapr/bin
✅  Downloading binaries and setting up components...
✅  Downloaded binaries and completed components set up.
ℹ️  daprd binary has been installed to /home/someuser/.dapr/bin.
ℹ️  dapr_placement container is running.
ℹ️  dapr_redis container is running.
ℹ️  dapr_zipkin container is running.
ℹ️  Use `docker ps` to check running containers.
✅  Success! Dapr is up and running. To get started, go here: https://aka.ms/dapr-getting-started

Steps to Reproduce the Problem

See above.

Environment/setup

Ubuntu 18.04.6 LTS running in Oracle VirtualBox 6.1, Version 6.1.34 r150636 (Qt5.6.2) running on Windows 10 Enterprise, Version 21H2

Corporate network with proxy Local authentication proxy is up and running Proxy-config in Ubuntu:

FTP_PROXY=http://10.0.2.2:3128
HTTPS_PROXY=http://10.0.2.2:3128
HTTP_PROXY=http://10.0.2.2:3128
NO_PROXY=localhost,127.0.0.1,.local,/var/run/docker.sock
ftp_proxy=http://10.0.2.2:3128
http_proxy=http://10.0.2.2:3128
https_proxy=http://10.0.2.2:3128
no_proxy=localhost,127.0.0.1,.local,/var/run/docker.sock

Release Note

RELEASE NOTE:

BjoernAtBosch avatar Aug 11 '22 10:08 BjoernAtBosch

same problem here with corporate proxy (proxy without authentication). it is working in dapr cli 1.7.1 but not in 1.8.0/1.8.1

TilmannBach avatar Aug 12 '22 08:08 TilmannBach

there is a similar closed issue from the past: https://github.com/dapr/cli/issues/454

TilmannBach avatar Aug 12 '22 12:08 TilmannBach

@BjoernAtBosch Could you please check if doing wget or direct download of binaries works for 1.8.1. for example wget of below url - ❌ error downloading dashboard binary: Get "https://github.com/dapr/dashboard/releases/download/v0.10.0/dashboard_linux_amd64.tar.gz": dial tcp: lookup github.com on 127.0.0.53:53: no such host

  1. If it does work then could you please set export DAPR_DEFAULT_IMAGE_REGISTRY=GHCR then do dapr init --runtime-version 1.8.1

pravinpushkar avatar Aug 12 '22 16:08 pravinpushkar

I have the same issue with my corporate proxy.

➜  ~ dapr version
CLI version: 1.8.1 
Runtime version: n/a
➜  ~ dapr init
⌛  Making the jump to hyperspace...
ℹ️  Container images will be pulled from Docker Hub
ℹ️  Installing runtime version 1.8.4
❌  Downloading binaries and setting up components...
❌  error downloading dashboard binary: Get "https://github.com/dapr/dashboard/releases/download/v0.10.0/dashboard_linux_amd64.tar.gz": read tcp 10.8.3.95:32946->20.205.243.166:443: read: connection reset by peer
➜  ~ env | grep https_proxy
https_proxy=http://10.8.3.67:8080
➜  ~ wget https://github.com/dapr/dashboard/releases/download/v0.10.0/dashboard_linux_amd64.tar.gz
--2022-08-15 10:30:52--  https://github.com/dapr/dashboard/releases/download/v0.10.0/dashboard_linux_amd64.tar.gz
Connecting to 10.8.3.67:8080... connected.
Proxy request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/226946009/cffc22ab-5b36-4358-ab3b-96a1ca9b8729?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220815%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220815T023049Z&X-Amz-Expires=300&X-Amz-Signature=a1464832126bd3d4af92af0cc016ffcb304ae19fe529c7f70042567b52f7318b&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=226946009&response-content-disposition=attachment%3B%20filename%3Ddashboard_linux_amd64.tar.gz&response-content-type=application%2Foctet-stream [following]
--2022-08-15 10:30:53--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/226946009/cffc22ab-5b36-4358-ab3b-96a1ca9b8729?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220815%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220815T023049Z&X-Amz-Expires=300&X-Amz-Signature=a1464832126bd3d4af92af0cc016ffcb304ae19fe529c7f70042567b52f7318b&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=226946009&response-content-disposition=attachment%3B%20filename%3Ddashboard_linux_amd64.tar.gz&response-content-type=application%2Foctet-stream
Connecting to 10.8.3.67:8080... connected.
Proxy request sent, awaiting response... 200 OK
Length: 15650596 (15M) [application/octet-stream]
Saving to: ‘dashboard_linux_amd64.tar.gz.1’

dashboard_linux_amd64.tar.gz.1                      10%[==========>                                                                                                      ]   1.54M   551KB/s               ^C
➜  ~ export DAPR_DEFAULT_IMAGE_REGISTRY=GHCR
➜  ~ dapr init --runtime-version 1.8.1
⌛  Making the jump to hyperspace...
ℹ️  Container images will be pulled from Dapr GitHub container registry
ℹ️  Installing runtime version 1.8.1
❌  Downloading binaries and setting up components...
❌  error downloading dashboard binary: Get "https://github.com/dapr/dashboard/releases/download/v0.10.0/dashboard_linux_amd64.tar.gz": read tcp 10.8.3.95:32950->20.205.243.166:443: read: connection reset by peer

Lichmaker avatar Aug 15 '22 02:08 Lichmaker

@pravinpushkar: Download with wget is working:

someuser@somehost > ~ > wget https://github.com/dapr/dashboard/releases/download/v0.10./dashboard_linux_amd64.tar.gz
--2022-08-15 13:26:03--  https://github.com/dapr/dashboard/releases/download/v0.10.0/dashboard_linux_amd64.tar.gz
Connecting to 10.0.2.2:3128... connected.
Proxy request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/226946009/cffc22ab-5b36-4358-ab3b-96a1ca9b8729?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220815%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220815T112603Z&X-Amz-Expires=300&X-Amz-Signature=a2042dc92a496ccefc96040b18ac96df5d1c79599e0dd4946bad9b24e58cbcbe&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=226946009&response-content-disposition=attachment%3B%20filename%3Ddashboard_linux_amd64.tar.gz&response-content-type=application%2Foctet-stream [following]
--2022-08-15 13:26:03--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/226946009/cffc22ab-5b36-4358-ab3b-96a1ca9b8729?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220815%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220815T112603Z&X-Amz-Expires=300&X-Amz-Signature=a2042dc92a496ccefc96040b18ac96df5d1c79599e0dd4946bad9b24e58cbcbe&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=226946009&response-content-disposition=attachment%3B%20filename%3Ddashboard_linux_amd64.tar.gz&response-content-type=application%2Foctet-stream
Connecting to 10.0.2.2:3128... connected.
Proxy request sent, awaiting response... 200 OK
Length: 15650596 (15M) [application/octet-stream]
Saving to: ‘dashboard_linux_amd64.tar.gz’

dashboard_linux_amd64.tar.gz                                 100%[=============================================================================================================================================>]  14.92M  3.88MB/s    in 3.9s    

2022-08-15 13:26:08 (3.86 MB/s) - ‘dashboard_linux_amd64.tar.gz’ saved [15650596/15650596]

Setting the env variable doesn't help:

someuser@somehost > ~ > export | grep DAPR
DAPR_DEFAULT_IMAGE_REGISTRY=GHCR
someuser@somehost > ~ > dapr --version
CLI version: 1.8.0 
Runtime version: n/a
someuser@somehost > ~ > dapr init --runtime-version 1.8.1
⌛  Making the jump to hyperspace...
ℹ️  Container images will be pulled from Dapr GitHub container registry
ℹ️  Installing runtime version 1.8.1
❌  Downloading binaries and setting up components...
❌  error downloading daprd binary: Get "https://github.com/dapr/dapr/releases/download/v1.8.1/daprd_linux_amd64.tar.gz": dial tcp: lookup github.com on 127.0.0.53:53: no such host

(same for latest CLI 1.8.1)

BjoernAtBosch avatar Aug 15 '22 11:08 BjoernAtBosch

I think this PR broke dapr init via proxy.

The above PR replaced the default net/http client with an explicit client, but the explicit client doesn't setup http.Transport.Proxy.

The default net/http client honors the typical proxy environment variables such as HTTP_PROXY.

sjwl avatar Aug 15 '22 21:08 sjwl

I think this PR broke dapr init via proxy.

The above PR replaced the default net/http client with an explicit client, but the explicit client doesn't setup http.Transport.Proxy.

The default net/http client honors the typical proxy environment variables such as HTTP_PROXY.

https://pkg.go.dev/net/http#Transport

type Transport struct {

	// Proxy specifies a function to return a proxy for a given
	// Request. If the function returns a non-nil error, the
	// request is aborted with the provided error.
	//
	// The proxy type is determined by the URL scheme. "http",
	// "https", and "socks5" are supported. If the scheme is empty,
	// "http" is assumed.
	//
	// If Proxy is nil or returns a nil *URL, no proxy is used.
	Proxy func(*Request) (*url.URL, error)

       ......
}

Transport.Proxy default value is nil. May the problem here?

Lichmaker avatar Aug 16 '22 01:08 Lichmaker

@BjoernAtBosch @Lichmaker Thanks for checking this out with GHCR and wget. I do not have any proxy setup in my machine. Would you be able to verify by reverting this PR locally and send a PR for the fix needed ?

FYI @hueifeng @mukundansundar

pravinpushkar avatar Aug 16 '22 04:08 pravinpushkar

https://pkg.go.dev/net/http#ProxyFromEnvironment

http.ProxyFromEnvironment can fix this issue. And it's worked successfully in my corporate network with proxy. So I send this PR. Please check it. 😄

Lichmaker avatar Aug 16 '22 06:08 Lichmaker

Thx @Lichmaker for providing this fix!

BjoernAtBosch avatar Aug 16 '22 09:08 BjoernAtBosch

I found it and maybe setting up Proxy is a better option. https://cs.opensource.google/go/go/+/refs/tags/go1.18.2:src/net/http/transport.go;l=43

hueifeng avatar Aug 16 '22 10:08 hueifeng

@BjoernAtBosch Could you please edit the issue description to add RELEASE NOTE section Something like - RELEASE NOTE: FIXED dapr init issue in an environment where proxy is needed.

Release Note

RELEASE NOTE:

pravinpushkar avatar Aug 17 '22 04:08 pravinpushkar

@pravinpushkar Done

BjoernAtBosch avatar Aug 17 '22 08:08 BjoernAtBosch

It seems 1.8.1 still have that issue, dapr init would fail with same error

HackToday avatar Aug 29 '22 03:08 HackToday

Try to build from source can work, so it means a new release for dapr cli is needed

HackToday avatar Aug 29 '22 03:08 HackToday

still found in dapr 1.10 image

xyfy avatar Mar 01 '23 12:03 xyfy

image

mashirali avatar Aug 09 '23 12:08 mashirali

image

What this means?

mashirali avatar Aug 09 '23 12:08 mashirali