This is a method of using ngrok to live-debug a Travis CI build.
(This is from some terse notes I took while working on staticx and hasn't been re-verified.)
Add to .travis.yml
:
env:
NGROK_TOKEN=...
addons:
apt:
packages:
- ssh
after_script:
- ./run_ngrok.sh
Here's run_ngrok.sh
:
#!/bin/bash
curl -o ngrok.zip https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip || exit $?
unzip ngrok.zip || exit $?
chmod +x ngrok
echo "ssh-rsa $YOUR_SSH_PUBLIC_KEY_GOES_HERE" > ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
echo "Starting sshd..."
sudo systemctl start sshd || exit $?
echo "Starting ngrok..."
./ngrok tcp 22 --authtoken=$NGROK_TOKEN --log=stdout --log-level=debug
echo "ngrok exited $?"
Then:
- Wait for it to say
Starting ngrok...
- Find URL at: https://dashboard.ngrok.com/status/tunnels
- Then
ssh travis@0.tcp.ngrok.io -p10798