Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Investigation] Allow tealdbg to listen to any address #1809

Closed
fabrice102 opened this issue Jan 2, 2021 · 4 comments · Fixed by #1977
Closed

[Investigation] Allow tealdbg to listen to any address #1809

fabrice102 opened this issue Jan 2, 2021 · 4 comments · Fixed by #1977
Assignees

Comments

@fabrice102
Copy link
Contributor

Is your feature request related to a problem? Please describe.

When using tealdbg from inside sandbox (https://github.com/algorand/sandbox), tealdbg needs to allow listening from any address and not just localhost. (This is true on macOS. It is possible that Docker on Ubuntu does not require that.)

Currently, the only solution I know how to use tealdbg inside sandbox is the following:

  1. Add - 9392:9392 inside the ports section of docker-compose.yml: https://github.com/algorand/sandbox/blob/0c15c8f5e0256770ef434333fee4ca55bb794ce0/docker-compose.yml#L21
  2. Enter sandbox: ./sandbox enter algod
  3. Install socat: apt install socat
  4. Create TEAL script, e.g., echo "int 1" > a.teal
  5. Run tealdbg in the background with new port (e.g., 1234): tealdbg debug --remote-debugging-port 1234 a.teal &
  6. Redirect port 1234 to 9392 because 1234 is only bound locally (see netstat below): socat tcp-listen:9392,reuseaddr,fork tcp:localhost:1234
  7. Open Chrome Developer tools and visit the address displayed by tealdbg where 1234 is replaced by 9392.

For information: netstat

root@b4a8696ccc6d:~/testnetwork/Node# netstat  -ltnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:9392            0.0.0.0:*               LISTEN      2794/socat
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      14/algod
tcp        0      0 127.0.0.1:1234          0.0.0.0:*               LISTEN      2739/tealdbg
tcp        0      0 127.0.0.1:44739         0.0.0.0:*               LISTEN      14/algod
tcp        0      0 127.0.0.11:42925        0.0.0.0:*               LISTEN      -
tcp6       0      0 :::4001                 :::*                    LISTEN      23/algod
tcp6       0      0 :::4002                 :::*                    LISTEN      32/kmd

Describe the solution you'd like

Add a flag to tealdbg to allow to listen to any address rather than just 127.0.0.1.
That is to change 127.0.0.1 in

appAddress := fmt.Sprintf("127.0.0.1:%d", port)
.

Additional context

This issue comes from a discussion on Discord.

@fabrice102 fabrice102 added the new-feature-request Feature request that needs triage label Jan 2, 2021
@pbennett
Copy link
Contributor

pbennett commented Jan 3, 2021

Makes sense - is there any reason for it to just not listen on all interfaces? Changing to :%d should suffice.

@ian-algorand ian-algorand added external contribution and removed new-feature-request Feature request that needs triage labels Jan 25, 2021
@ian-algorand
Copy link
Contributor

We need to investigate the feasibility of this request. Thanks for porting this into an issue (from discord @fabrice102 )

@ian-algorand ian-algorand changed the title Allow tealdbg to listen to any address [Investigation] Allow tealdbg to listen to any address Jan 25, 2021
@algorandskiy algorandskiy linked a pull request Mar 16, 2021 that will close this issue
@algorandskiy
Copy link
Contributor

@fabrice102 please review the PR I linked.

@atrefonas
Copy link

By the way I needed to run "docker-compose up -d" after changing the docker-compose.yml file. Restarting my docker container was not sufficient. Possibly should add it as a step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants