Cheap VPS Hosting Promos
VPS Coupon Codes, Reviews, Tutorials

Connect Github Actions VPS via SSH and run Benchmark Testing

Github Actions is a task automation system integrated with GitHub allows you to automate all the tasks involved with software delivery. There are many articles on how to deploy taks on Github Actions via remote SSH command. In this article I will teach you a new way to connect Github Actions VPS via SSH with Ngrok. First of all, you need a Github account and creat a repository, we name it with SSHVPS as example!

Let's follow the step below"

Step 1:

Create account on Ngrok, it's free! And then get the Auth Token via dashbord.

Step 2:

Now let's back to your Github repo SSHVPS, and create Secrets for the new workflow.
There are 2 secrets needed: NGROK_TOKEN and USER_PASS.

The NGROK_TOKEN is the Auth Token we get from Ngrok above, and the USER_PASS is your personal password will be assigned to the SSH account.

Step 3:

Create a new ssh-server.sh file to the repo, copy the code below and directly to the master branch.

#!/bin/bash

if [[ -z "$NGROK_TOKEN" ]]; then
  echo "Please set 'NGROK_TOKEN'"
  exit 2
fi

if [[ -z "$USER_PASS" ]]; then
  echo "Please set 'USER_PASS' for user: $USER"
  exit 3
fi

wget -q https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-386.zip
unzip ngrok-stable-linux-386.zip
chmod +x ./ngrok

echo -e "$USER_PASS\n$SSH_PASSWORD" | sudo passwd "$USER"

rm -f .ngrok.log
./ngrok authtoken "$NGROK_TOKEN"
./ngrok tcp 22 --log ".ngrok.log" &

sleep 10

HAS_ERRORS=$(grep "command failed" < .ngrok.log)

if [[ -z "$HAS_ERRORS" ]]; then
  echo ""
  echo "To connect: $(grep -o -E "tcp://(.+)" < .ngrok.log | sed "s/tcp:\/\//ssh $USER@/" | sed "s/:/ -p /")"
  echo ""
else
  echo "$HAS_ERRORS"
  exit 4
fi

Step 4:

Create a new workflow via Github Actions, copy the code below and Commit directly to the master branch.

name: SSH Server
on: push
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
     - uses: actions/checkout@v1

     - name: Try Build
       run: ./not-exist-file.sh it bloke build

     - name: Start SSH via Ngrok
       if: ${{ failure() }}
       run: curl -sL https://gist.githubusercontent.com/retyui/7115bb6acf151351a143ec8f96a7c561/raw/7099b9db76729dc5761da72aa8525f632d8875c9/debug-github-actions.sh | bash
       env:
        # After sign up on the https://ngrok.com/
        # You can find this token here: https://dashboard.ngrok.com/get-started/setup
        NGROK_TOKEN: ${{ secrets.NGROK_TOKEN }}

        # This password you will use when authorizing via SSH 
        USER_PASS: ${{ secrets.USER_PASS }}

     - name: Don't kill instace
       if: ${{ failure() }}
       run: sleep 1h 
       # Prevent to killing instance after failure

It will sleep in 1 hour, but you can change the time in the code above! Now let's check the workflow!

Here we got the server address and port, now we can login it with SSH client!

ssh [email protected] -p 16659

Step 5:

Open your SSH client, putty or something else, login with info

  • Address: 0.tcp.ngrok.io
  • Port 16659
  • User: runner
  • Password: you created in Step 2

Lets run a Benchmark testing on this Github VPS with command:

curl -sL yabs.sh | bash

Here you got the details of the dock service:

runner@fv-az20:~$ curl -sL yabs.sh | bash
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
#              Yet-Another-Bench-Script              #
#                     v2020-06-20                    #
# https://github.com/masonr/yet-another-bench-script #
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #

Tue Sep  1 17:26:12 UTC 2020

Basic System Information:
---------------------------------
Processor  : Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz
CPU cores  : 2 @ 2294.685 MHz
AES-NI     : ✔ Enabled
VM-x/AMD-V : ❌ Disabled
RAM        : 6.8G
Swap       : 4.0G
Disk       : 97G

fio Disk Speed Tests (Mixed R/W 50/50):
---------------------------------
Block Size | 4k            (IOPS) | 64k           (IOPS)
  ------   | ---            ----  | ----           ----
Read       | 16.75 MB/s    (4.1k) | 34.95 MB/s     (546)
Write      | 16.74 MB/s    (4.1k) | 35.34 MB/s     (552)
Total      | 33.50 MB/s    (8.3k) | 70.30 MB/s    (1.0k)
           |                      |
Block Size | 512k          (IOPS) | 1m            (IOPS)
  ------   | ---            ----  | ----           ----
Read       | 34.02 MB/s      (66) | 33.59 MB/s      (32)
Write      | 36.22 MB/s      (70) | 36.64 MB/s      (35)
Total      | 70.24 MB/s     (136) | 70.24 MB/s      (67)

iperf3 Network Speed Tests (IPv4):
---------------------------------
Provider                  | Location (Link)           | Send Speed      | Recv Speed
                          |                           |                 |
Bouygues Telecom          | Paris, FR (10G)           | 1.24 Gbits/sec  | 1.71 Gbits/sec
Online.net                | Paris, FR (10G)           | busy            | busy
WorldStream               | The Netherlands (10G)     | 1.19 Gbits/sec  | 1.56 Gbits/sec
wilhelm.tel               | Hamburg, DE (10G)         | 1.12 Gbits/sec  | 1.48 Gbits/sec
Biznet                    | Bogor, Indonesia (1G)     | 695 Mbits/sec   | 21.0 Mbits/sec
Hostkey                   | Moscow, RU (1G)           | 837 Mbits/sec   | 840 Mbits/sec
Velocity Online           | Tallahassee, FL, US (10G) | 1.35 Gbits/sec  | 2.82 Gbits/sec
Airstream Comms           | Eau Claire, WI, US (10G)  | 1.36 Gbits/sec  | 6.20 Gbits/sec
Hurricane Electric        | Fremont, CA, US (10G)     | 1.34 Gbits/sec  | 4.03 Gbits/sec

Geekbench 5 Benchmark Test:
---------------------------------
Test            | Value
                |
Single Core     | 742
Multi Core      | 1403
Full Test       | https://browser.geekbench.com/v5/cpu/3515440

Not bad, it's a 2 CPU cores and 7GB RAM VPS...Let's check if we can build a temporary website with it!

Step 6: Install AApanel

wget -O install.sh http://www.aapanel.com/script/install-ubuntu_6.0_en.sh && sudo bash install.sh

we got the result:

==================================================================
Congratulations! Installed successfully!
==================================================================
aaPanel Internet Address: http://20.187.33.164:8888/1d961f52
aaPanel Internal Address: http://10.1.0.4:8888/1d961f52
username: 0v8o8wza
password: 6073f1d3
Warning:
If you cannot access the panel,
release the following port (8888|888|80|443|20|21) in the security group
==================================================================

Both address can't be acessed, seems the web port is limited, let's chech the open ports:

runner@fv-az39:~$ netstat -ap
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 localhost:4040          0.0.0.0:*               LISTEN      2892/./ngrok
tcp        0      0 localhost:40721         0.0.0.0:*               LISTEN      -
tcp        0      0 localhost:domain        0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:ssh             0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:8888            0.0.0.0:*               LISTEN      -

No 80 or 443 port, only SSH access, and the 8888 is created by AApanel? em... maybe you can do something with this! But I don't know how to....

Don't forget to cheak the Ngrok dashboard, there is a Tunnel created!

Comments 1

  • Nickname
  • Email
  • Website
  1. #1

    To run AApanel on github action

    ON ssh-server.sh change:
    - './ngrok tcp 22 --log ".ngrok.log" &' change to './ngrok http 8888 --log ".ngrok.log" &'
    - This will disable te ssh connection but will allow the port 8888 to by exposed.
    - 'echo "To connect: $(grep -o -E "tcp://(.+)" < .ngrok.log | sed "s/tcp:\/\//ssh $USER@/" | sed "s/:/ -p /")"' change to 'echo "To connect: $(grep -o -E "http://(.+)&quot; < .ngrok.log | sed "s/http:\/\//ssh $USER@/" | sed "s/:/ -p /")"'
    - To get the http url, example: f89da09704df.ngrok.io

    On Github Actions file add the step:
    - name: Install AApanel
    run: |
    wget -O install.sh http://www.aapanel.com/script/install-ubuntu_6.0_en.sh && sudo bash install.sh << EOF
    y
    yes
    EOF

    The part of
    << EOF
    y
    yes
    EOF

    will accept all actions to continue the install.

GET BEST CHEAP VPS DEALS HERE!

Counpon CodesReviews