Hello there,
to improve the workflow of my team I want to make it easier for them to connect to a remote system (aka our stage environment and our production environment).
Currently the workflow looks as following
./start-iex me 127.0.0.1 #script that set cookies and stuff
iex(me@127.0.0.1)1> Node.connect :"app@IP.OF.STAGE.ENV"
true
iex(me@127.0.0.1)3> #CTRL+G
User switch command
--> r 'app@IP.OF.STAGE.ENV'
--> c 2
Eshell V10.5 (abort with ^G)
(app@IP.OF.STAGE.ENV)1> #CTRL+G again
User switch command
--> r 'app@IP.OF.STAGE.ENV' 'Elixir.IEx'
--> c 3
iex(app@IP.OF.STAGE.ENV)1> #iex shell on remote system
As you can see this is rather tedious and error prone (how often I used the wrong quotes here…).
So my question is:
Does anybody know a way to enter the User Switch Command in a way that is scriptable. My overall goal would be a script that allows people to simply connect to one of our deployed stages.
Note that on line 14, send " " sends the ctrl+g IIRC. It may not be copied correctly if you copy it with a browser so you may want to download the file directly. (And indeed if I copy it to this forum, it’s rendered as send "a"!)
EDIT: Note that there is also a --remsh option for IEx. Maybe that already does what you need, at least partly?
I have implemented it as expect-script now and will try to improve it. For others with a similar problem, here is my current solution that seems to do the trick: