localhost connection problem while using StartMeshcat - drake

I am using Ubuntu 22.04 LTS via WSL and working on Python 3.10 on Visual Studio Code using the Remote - WSL extension.
When I import and run StartMeshcat() it successfully displays 'INFO:drake:Meshcat listening for connections at http://localhost:7000' but I can't reach my localhost, it gives the 'ERR_CONNECTION_REFUSED' error on any browser. I tried the generic solutions available on web regarding wsl localhost connection problems but none of them worked. What may be the cause? Thanks in advance!

Related

Closed ports on docker host (OSX) are staying/reporting open on the internal docker network

After upgrading Docker to 4.6.0 on OSX 12.3 I've had a bit of an odd issue when I stop the xdebug listening client in PHPStorm, it seems that subsequent requests always times out because docker is reporting that host.docker.internal has port 9003 open when it's actually closed so the app always waits for the xdebug client.
I installed nmap on my webapp php container and host to test. If I run "nmap -p 9003 localhost" with the debug client running on my host I can see it open, after turning it off in PHPstorm the same scan shows that it's closed however running "nmap -p 9003 host.docker.internal" inside the container reports that it's still open. If I open other services on my host too it seems that ports start showing as open on the docker internal network however never report as closed after shutting them down on the host.
I upgraded to Docker 4.6.1 but the problem still persists.
Any advice would be appreciated.
This has been fixed in Docker 4.8.1
https://docs.docker.com/desktop/mac/release-notes/
UPDATE: Downgrading to Docker 4.5.0 resolved the issue.
This doesn't solve the problem, just helps to avoid restarting Docker while we are waiting for the fix.
Make changes in xdebug.ini:
xdebug.start_with_request=trigger
xdebug.idekey=VSCODE
This tells XDebug to connect to debugger only if "trigger" is present in the HTTP request.
Now, install Chrome extension Xdebug helper, it's old but still works. Open extensions settings (chrome-extension://eadndfjplgieldjbigjakmdgkmoaaaoc/options.html) and set IDE key to "Other" "VSCODE".
Now, when you want to debug, you enable debugging in VSCode and also enable debugging in Chrome using that extension:
When you are done debugging - choose "Disable" in the extension, and PHP won't try to connect to your debugger, even if the port is still open. How it works - extension just sends cookie XDEBUG_SESSION=VSCODE with each request, and XDebug connects to the debugger only when this cookie is present.
P.S. You can replace VSCODE with IDE key that your IDE uses, or just any string.

ECONNREFUSED 127.0.0.1:80 when connecting to remote Docker with Visual Studio Code

I want to develop code inside a container on a remote Docker host with VS Code, but I cannot connect to Docker on the remote machine via SSH (ECONNREFUSED 127.0.0.1:80).
Following the VS Code instructions to use a SSH tunnel (https://code.visualstudio.com/docs/remote/containers-advanced#_option-2-connect-using-an-ssh-tunnel) I got this error:
"Unable to connect to Docker. Please make sure you have installed
Docker and that it is running. Details: connect ECONNREFUSED
127.0.0.1:80"
I started VS Code (Windows 10), updated the docker.host (File->Preferences) property to:
{
"docker.host":"tcp://localhost:23750"
}
and ran:
ssh -NL localhost:23750:/var/run/docker.sock user#hostname
It looked like established the tunnel successfully. I run Docker on a virtual machine (centOS).
When I opened the Docker view and expanded the Containers node in the explorer I got the above mentioned error. To me it looks like VS Code tries to connect to port 80 but I specified port 23750 in the settings. How can I successfully connect to the remote host?
I found a fix here: https://github.com/microsoft/vscode-docker/issues/580
Remove the prefix tcp:// from the docker.host settings, e.g.:
"docker.host": "localhost:23750"
I know that this question is old but for anyone still looking for options I solved a similar issue on my computer using IPv6.
So in your case:
{
"docker.host":"tcp://[::1]:23750"
}
I configured the host on the environment variable DOCKER_HOST.

Docker broke my brew?

I worked on my computer (mac os High Sierra 10.13.4) for a Rails application. I had Postgres, Redis and ElasticSearch installed via Homebrew.
I recently started to dockerize the app on a new branch.
When I went back to my main branch, none of the brew services were working:
PG::ConnectionBad - could not connect to server: Connection refused
which I fixed thanks to https://dba.stackexchange.com/questions/75214/postgresql-not-running-on-mac
couldn't connect to redis
which I fixed by running redis-cli
Errno::ECONNREFUSED - Failed to open TCP connection to localhost:9200 (Connection refused - connect(2) for "::1" port 9200)
I tried stopping/starting, desinstalling/reinstalling elasticsearch and even desinstalling/reinstalling Homebrew. I'm considerating doing a clean reinstall of my computer.
I don't understand how working on docker could break services on my computer, I thought it was supposed to fix exactly that kind of problems.
Any help on getting elasticsearch to work would be really appreciated!
This answer is only a speculation. A little more information might help us figure out what’s really going on here.
Are the Docker containers still running?
If yes, do they use the same ports that these services do on your Mac?
If the answer to both the above questions was yes, then you’ve found your problem.
What I mean to say is that if the containers are running and one of them is mapped to the port 9200, which also happens to be the port on which the required services on your Mac listen to by default, then these services cannot run on that port as it is already being used by one of your containers.
Solution: If this is the case, stop the containers and try running your services again

Rails application can't reach remote PostgreSQL server (proxy, VirtualBox)

I have a Windows 7 PC with Forefront TMG proxy. There is a VirtualBox virtual machine installed with Ubuntu 16.04 (64-bit) guest OS. I'm not a seasoned Unix-user, so I tried to configure Ubuntu's network through GUI window.
After several tries I wound up with these settings:
https://i.stack.imgur.com/in4yR.jpg
All works fine now. I can use browser and git and do various network stuff. But!
I have a Rails application, which uses a remote PostgreSQL database. When I start my Rails server, it throws this exception:
Puma caught this error: could not connect to server: Network is unreachable
Is the server running on host "this_is_the_host_url" and accepting
TCP/IP connections on port 5432?
(PG:ConnectionBad)
This applications works fine on the other PC with similar Windows 7 and VB Ubuntu, but without a proxy. Also I tried to reach the remote DB-server from my host Win7 with PGAdmin - all works fine, even with proxy. The issue is somewhere between my Ubuntu guest OS and my Windows host OS.
Should I configure proxy settings in Ubuntu in a different way?
Any other way to resolve this issue?
Traceroute shows this:
1 10.0.2.2 (10.0.2.2) 0.638 ms 0.577 ms 0.549 ms
2 10.0.2.2 (10.0.2.2) 29.369 ms !N 53.000 ms !N 75.644 !N
As I can get it, 10.0.2.2 is my host OS ip.
I searched through the web, but all I could get belongs to the opposite side: to reach to the proxied VB Ubuntu, not from it.

parallels 9 - mac 10.9 - windows 8.1 rails server running on mac, how to localhost:3000 from internet explorer?

Parallels 9 with windows 8.1 (and more), Mac 10.9.5
rails 4.2 ruby 2.0.0, development app running on localhost:3000
I want to access app from internet explorer running on windows 8.1 in parallels.
I have read every post on the net and submitted a ticket to parallels: no luck.
bridged network (default adapter), tried windows firewall inbound rules, opening port 3000 (parallels recommendation, no luck)
ifconfig on mac 192.168.0.1, ipconfig on windows depending on network
anybody able to tell me how to do this? Thanks!
Disable windows firewall (no body know how to configure it :)
Run rails application with binding to 0.0.0.0 (rails s -b 0.0.0.0)
Are you sure exactly that your IP is .1? Check it in Preferences/Network in IP Address label.
Check that windows ping your host (ping 192.168.0.1).
Try to open 192.168.0.1:3000 in IE.

Resources