ElixirTalk / elixirtalk

ElixirTalk Podcast
https://soundcloud.com/elixirtalk
40 stars 2 forks source link

Re: Episode 126 - local iex -> remote console #43

Open ryanwinchester opened 6 years ago

ryanwinchester commented 6 years ago

@desmondmonster RE: Episode 126 - your bash scripts and needing 2 windows.

I do it in one 👍

I use this to run :observer locally for a remote node.

https://gist.github.com/ryanwinchester/0b46edc99b3e2b2f71cd36428dc493cf

#!/bin/sh

set -e

BEAM_PORT=32815
EPMD_PORT=4369
COOKIE='cookiestring'

ssh -f -o ExitOnForwardFailure=yes \
    -L "$EPMD_PORT:localhost:$EPMD_PORT" \
    -L "$BEAM_PORT:localhost:$BEAM_PORT" \
    myapp@myhost.com \
    sleep 10

iex --name debug@127.0.0.1 --cookie $COOKIE \
    -S mix run -e 'Node.connect(:"my_app@127.0.0.1")'