Localtunnel: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
 
(41 intermediate revisions by the same user not shown)
Line 1: Line 1:
source ~/.nvm/nvm.sh && nvm use node
{|class='wikitable mw-collapsible' style='width:100%'
npm install -g localtunnel
!scope='col' style='text-align:left'|
[https://theboroer.github.io/localtunnel-www/ Localtunnel]
|-
|valign='top'|
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'>
source ~/.nvm/nvm.sh && nvm use node
npm install -g localtunnel
</syntaxhighlight>
|}


==Linux Service==
==Systemd==
{|
{|class='wikitable mw-collapsible' style='width:100%'
| valign="top" |
!scope='col' style='text-align:left' colspan='2'|
<source lang="bash">
Systemd »  Service
cat << EOF | sudo tee /etc/systemd/system/academia-lt.service >>/dev/null
|-
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0 3px 0' lang='ini'>
cat << EOF | sudo tee /etc/systemd/system/chorke-academia-lt.service >/dev/null
[Unit]
[Unit]
Description=Academia Localtunnel Daemon
Description=Chorke Academia Localtunnel Daemon
After=syslog.target network.target
After=syslog.target network.target


Line 15: Line 26:
Type=simple
Type=simple
Restart=on-failure
Restart=on-failure
ExecStart=lt --host 127.0.0.1 --port 80 --subdomain academia-chorke
ExecStart=lt -p 80 -s chorke-academia
TimeoutStopSec=20
TimeoutStopSec=20
KillMode=process
KillMode=process
Line 23: Line 34:


EOF
EOF
</source>
</syntaxhighlight>


| valign="top" |
|valign='top' style='width:50%'|
<source lang="bash">
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'>
sudo systemctl daemon-reload
sudo systemctl daemon-reload




sudo systemctl enable  --now academia-lt
sudo systemctl enable  --now chorke-academia-lt
     systemctl status  academia-lt
     systemctl status  chorke-academia-lt
 
 
sudo systemctl disable --now chorke-academia-lt
    systemctl status  chorke-academia-lt
 
 
sudo systemctl restart chorke-academia-lt
    systemctl status  chorke-academia-lt
 
 
sudo systemctl stop    chorke-academia-lt
    systemctl status  chorke-academia-lt
</syntaxhighlight>
|-
|valign='top' colspan='2'|
<syntaxhighlight style='margin:3px 0 3px 0' lang='nginx'>
# nginx virtual host & reverse proxy config
cat << EOF | sudo tee /etc/nginx/sites-enabled/chorke-academia.loca.lt >/dev/null
server {
  listen 2015;
  listen [::]:2015;
 
  index index.html;
  server_name chorke-academia.loca.lt;
  root /var/www/chorke-academia.loca.lt;
 
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Forwarded-Proto $scheme;
  proxy_set_header Host $http_host;
  proxy_redirect off;
 
  location / {
    proxy_pass http://127.0.0.1:3002;
    try_files $uri $uri/ =404;
  }
 
  location /api {
    proxy_pass http://127.0.0.1:3001;
  }


  access_log /var/log/nginx/chorke-academia.loca.lt/access.log;
  error_log  /var/log/nginx/chorke-academia.loca.lt/error.log info;
  error_page 500 502 503 504 /500.html;
  client_max_body_size 25M;
  keepalive_timeout 10;
}
EOF
</syntaxhighlight>
|-
|valign='top' colspan='2'|
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'>
# haproxy frontend and backend config
: <<'EOC'
frontend chorke
  bind *:80
  mode http
  acl host-is-chorke-academia    hdr(host) -i chorke-academia.loca.lt
  use_backend chorke-academia    if host-is-chorke-academia
backend chorke-academia
  server nginx 127.0.0.1:2015
  mode http
EOC
</syntaxhighlight>
|-
|valign='top' colspan='2'|
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'>
# No need to update any '/etc/hosts' entries
setsid open https://chorke-academia.loca.lt  >/dev/null 2>&1 &
setsid open https://loca.lt/mytunnelpassword  >/dev/null 2>&1 &
setsid open https://ipv4.icanhazip.com        >/dev/null 2>&1 &
</syntaxhighlight>
|}


sudo systemctl disable --now academia-lt
==Playground==
    systemctl status  academia-lt
{|class='wikitable mw-collapsible' style='width:100%'
!scope='col' style='text-align:left' colspan='2'|
Playground
|-
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'>
lt --host 127.0.0.1 --port 80 --subdomain academia-chorke
lt --port 80 --subdomain academia-chorke
</syntaxhighlight>


| valign="top" |
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'>
lt -h 127.0.0.1 -p 80 -s academia-chorke
lt -p 80 -s academia-chorke
</syntaxhighlight>
|-
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'>
curl -k https://loca.lt/mytunnelpassword
curl -k https://ipv4.icanhazip.com
sudo nginx -t
</syntaxhighlight>


sudo systemctl restart academia-lt
|valign='top'|
    systemctl status academia-lt
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'>
sudo rm /etc/systemd/system/academia-lt.service
systemctl daemon-reload
systemctl reset-failed
</syntaxhighlight>
|-
|valign='top'|
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'>
sudo ufw allow 9000:9010/tcp
sudo systemctl status ufw
sudo ufw status numbered
</syntaxhighlight>


|valign='top'|
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'>
sudo ufw status verbose
sudo ufw enable
sudo ufw status
</syntaxhighlight>
|-
|valign='top'|
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'>
curl -k host.docker.internal:9000
curl -k host.docker.internal:9001
curl -k host.docker.internal:9002
</syntaxhighlight>


sudo systemctl stop    academia-lt
|valign='top'|
    systemctl status  academia-lt
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'>
</source>
curl -k host.docker.internal:9008
curl -k host.docker.internal:9009
curl -k host.docker.internal:9010
</syntaxhighlight>
|-
|valign='top'|
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'>
systemctl list-units --type=service --state=running
systemctl list-units --type=service --state=active
systemctl list-units --type=service
</syntaxhighlight>


|valign='top'|
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'>
systemctl --type=service --state=running
systemctl --type=service --state=active
systemctl --type=service
</syntaxhighlight>
|-
|-
| colspan="2" |
|valign='top'|
----
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'>
firewall-cmd --list-services
netstat -ltup
</syntaxhighlight>
 
|valign='top'|
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'>
firewall-cmd --list-ports
ss -ltup
</syntaxhighlight>
 
|-
|-
| valign="top" colspan="2" |
|valign='top' style='width:50%'|
  open https://academia-chorke.loca.lt &>/dev/null &
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'>
open https://loca.lt/mytunnelpassword &>/dev/null &
kubectl -n harbor run -i --tty --rm harbor-lt \
  --image=node:25.0-alpine --restart=Never --command -- ash
 
apk --update add curl bind-tools inetutils-telnet
curl -fsSL https://ipv4.icanhazip.com  && echo
 
npm install -g localtunnel && npm fund
lt -p 80 -s harbor-shahed -l harbor-core
lt -p 80 -s harbor-shahed -l 192.168.49.109
</syntaxhighlight>
|valign='top' style='width:50%'|
 
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'>
setsid open https://harbor-shahed.loca.lt >/dev/null 2>&1 &
 
 
curl -fsSL https://loca.lt/mytunnelpassword && echo
curl -fsSL https://ipv4.icanhazip.com  && echo


docker run --rm alpine ping harbor-shahed.loca.lt
docker run --rm alpine ping www.k8s.ops
docker run --rm alpine ping google.com
</syntaxhighlight>
|}
|}


==References==
==References==
{|
{|class='wikitable mw-collapsible' style='width:100%'
| valign="top" |
!scope='col' style='text-align:left' colspan='3'|
* [https://github.com/localtunnel/localtunnel Localtunnel » SCM » Github]
References
|-
|valign='top' style='width:34%'|
* [https://github.com/localtunnel/go-localtunnel Localtunnel » SCM » GO Localtunnel]
* [https://github.com/localtunnel/localtunnel Localtunnel » SCM » Localtunnel]
* [https://hub.docker.com/_/node Localtunnel » Docker » Node]
* [https://github.com/localtunnel/server Localtunnel » SCM » Server]
* [https://github.com/localtunnel/www Localtunnel » SCM » WWW]
* [https://github.com/localtunnel/nginx Localtunnel » SCM » Nginx]
* [https://theboroer.github.io/localtunnel-www/ Localtunnel » Quickstart]
* [https://theboroer.github.io/localtunnel-www/ Localtunnel » Quickstart]


| valign="top" |
|valign='top' style='width:33%'|


| valign="top" |
|valign='top' style='width:33%'|


|-
|-
| colspan="3" |
|valign='top'|
----
* [https://superuser.com/questions/513159/ Systemd » Safe Remove Services]
|-
* [[Apache/Proxy]]
| valign="top" |
* [[OpenVPN]]
* [[OpenVPN]]
* [[HAProxy]]
* [[Nashorn]]
* [[Nashorn]]
* [[Hadoop]]
* [[Nginx]]
* [[Spark]]
* [[Rhino]]
* [[Rhino]]
* [[ExtJS]]
* [[ExtJS]]


| valign="top" |
|valign='top'|
* [[Academia JavaEE Workspace in Ubuntu]]
* [[Linux Virtual Display for iPad Pro]]
* [https://askubuntu.com/questions/7099/ UFW » Allow a Range of Ports]
* [https://www.cloudflare.com/products/tunnel/ Tunnel » Cloudflare]
* [https://dashboard.ngrok.com/tunnels/agents Tunnel » Ngrok]
* [[Helm/Pi-Hole|Helm » Pi-Hole]]
* [[Helm/Harbor|Helm » Harbor]]
* [[Helm/Nexus|Helm » Nexus]]
* [[PostgreSQL]]
* [[ActiveMQ]]


| valign="top" |
|valign='top'|
* [[Minikube Ingress DNS|K8s » Minikube » Ingress » DNS]]
* [[K8s/Localtunnel|K8s » Localtunnel]]
* [[K8s/Storage|K8s » Storage]]
* [[K8s/Ingress|K8s » Ingress]]
* [[K8s/Service|K8s » Service]]
* [[K8s/Nexus|K8s » Nexus]]
* [[K8s/Run|K8s » Run]]
* [[NodeJS]]


|}
|}

Latest revision as of 03:06, 24 October 2025

Localtunnel

source ~/.nvm/nvm.sh && nvm use node
npm install -g localtunnel

Systemd

Systemd » Service

cat << EOF | sudo tee /etc/systemd/system/chorke-academia-lt.service >/dev/null
[Unit]
Description=Chorke Academia Localtunnel Daemon
After=syslog.target network.target

[Service]
User=${USER}
Type=simple
Restart=on-failure
ExecStart=lt -p 80 -s chorke-academia
TimeoutStopSec=20
KillMode=process

[Install]
WantedBy=multi-user.target

EOF
sudo systemctl daemon-reload


sudo systemctl enable  --now chorke-academia-lt
     systemctl status  chorke-academia-lt


sudo systemctl disable --now chorke-academia-lt
     systemctl status  chorke-academia-lt


sudo systemctl restart chorke-academia-lt
     systemctl status  chorke-academia-lt


sudo systemctl stop    chorke-academia-lt
     systemctl status  chorke-academia-lt
# nginx virtual host & reverse proxy config
cat << EOF | sudo tee /etc/nginx/sites-enabled/chorke-academia.loca.lt >/dev/null
server {
  listen 2015;
  listen [::]:2015;

  index index.html;
  server_name chorke-academia.loca.lt;
  root /var/www/chorke-academia.loca.lt;

  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Forwarded-Proto $scheme;
  proxy_set_header Host $http_host;
  proxy_redirect off;

  location / {
    proxy_pass http://127.0.0.1:3002;
    try_files $uri $uri/ =404;
  }
  
  location /api {
    proxy_pass http://127.0.0.1:3001;
  }

  access_log /var/log/nginx/chorke-academia.loca.lt/access.log;
  error_log  /var/log/nginx/chorke-academia.loca.lt/error.log info;

  error_page 500 502 503 504 /500.html;
  client_max_body_size 25M;
  keepalive_timeout 10;
}

EOF
# haproxy frontend and backend config
: <<'EOC'
frontend chorke
   bind *:80
   mode http
   acl host-is-chorke-academia    hdr(host) -i chorke-academia.loca.lt
   use_backend chorke-academia    if host-is-chorke-academia

backend chorke-academia
   server nginx 127.0.0.1:2015
   mode http

EOC
# No need to update any '/etc/hosts' entries 
setsid open https://chorke-academia.loca.lt   >/dev/null 2>&1 &
setsid open https://loca.lt/mytunnelpassword  >/dev/null 2>&1 &
setsid open https://ipv4.icanhazip.com        >/dev/null 2>&1 &

Playground

Playground

lt --host 127.0.0.1 --port 80 --subdomain academia-chorke
lt --port 80 --subdomain academia-chorke
lt -h 127.0.0.1 -p 80 -s academia-chorke
lt -p 80 -s academia-chorke
curl -k https://loca.lt/mytunnelpassword
curl -k https://ipv4.icanhazip.com
sudo nginx -t
sudo rm /etc/systemd/system/academia-lt.service
systemctl daemon-reload
systemctl reset-failed
sudo ufw allow 9000:9010/tcp
sudo systemctl status ufw
sudo ufw status numbered
sudo ufw status verbose
sudo ufw enable
sudo ufw status
curl -k host.docker.internal:9000
curl -k host.docker.internal:9001
curl -k host.docker.internal:9002
curl -k host.docker.internal:9008
curl -k host.docker.internal:9009
curl -k host.docker.internal:9010
systemctl list-units --type=service --state=running
systemctl list-units --type=service --state=active
systemctl list-units --type=service
systemctl --type=service --state=running
systemctl --type=service --state=active
systemctl --type=service
firewall-cmd --list-services
netstat -ltup
firewall-cmd --list-ports
ss -ltup
kubectl -n harbor run -i --tty --rm harbor-lt \
 --image=node:25.0-alpine --restart=Never --command -- ash

apk --update add curl bind-tools inetutils-telnet
curl -fsSL https://ipv4.icanhazip.com  && echo

npm install -g localtunnel && npm fund
lt -p 80 -s harbor-shahed -l harbor-core
lt -p 80 -s harbor-shahed -l 192.168.49.109
setsid open https://harbor-shahed.loca.lt >/dev/null 2>&1 &


curl -fsSL https://loca.lt/mytunnelpassword && echo
curl -fsSL https://ipv4.icanhazip.com  && echo

docker run --rm alpine ping harbor-shahed.loca.lt
docker run --rm alpine ping www.k8s.ops
docker run --rm alpine ping google.com

References

References