SlideShare a Scribd company logo
1 of 71
TUNNELING FOR FUN




  Jonathan Manuzak / @jonmanuzak
      #ATLRUG / Oct 10, 2012
WHO ARE YOU?
WHAT’S YOUR PROBLEM?
MOST OF MY DEVELOPMENT HAPPENS HERE
           Photo: http://www.flickr.com/photos/blueace/797823265
MOST OF MY DEVELOPMENT HAPPENS HERE
FIREWALL / NAT
FIREWALL / NAT
FIREWALL / NAT
 •Permissive with
 outgoing requests

 •Restrictive with
 incoming requests

 •Not accessible if
 behind NAT
OUTSIDE THE
                 FIREWALL

 BUT THE REST
OF THE WORLD
 IS OVER HERE
BUT, SURELY THIS IS A SOLVED
      PROBLEM. RIGHT?
BUT, SURELY THIS IS A SOLVED
      PROBLEM. RIGHT?

   DEPENDS ON YOUR
  DEFINITION OF SOLVED
BUT, SURELY THIS IS A SOLVED
        PROBLEM. RIGHT?

           DEPENDS ON YOUR
          DEFINITION OF SOLVED
 CODE, DEPLOY, TEST, FAIL, CODE, DEPLOY, TEST, FAIL, CODE, DEPLOY, TEST, FAIL, CODE, DEPLOY,
TEST, FAIL, CODE, DEPLOY, TEST, FAIL, CODE, DEPLOY, TEST, FAIL, CODE, DEPLOY, TEST, FAIL, CODE,
                               DEPLOY, TEST, FAIL, RINSE, REPEAT
JUST USE A SSH TUNNEL!
ANATOMY OF A SSH TUNNEL

http://localhost:8080
ANATOMY OF A SSH TUNNEL
                                                                                                                        U
                                                                                                                        s
                                                                                                                        e
                                                                                                                        r
http://localhost:8080




    Photos: http://eandt.theiet.org/magazine/2012/07/interview-andrew-blum.cfm, http://www.quickmeme.com/meme/35583x/
ANATOMY OF A SSH TUNNEL
                                                                                                                        U
                                                                                                                        s
                                                                                                                        e
                                                                                                                        r
http://localhost:8080




                                                                                                                        S
                                                                                                                        e
                                                                                                                        r
                                                                                                                        v
                                                                                                                        e
                                                                                                                        r
    Photos: http://eandt.theiet.org/magazine/2012/07/interview-andrew-blum.cfm, http://www.quickmeme.com/meme/35583x/
ANATOMY OF A SSH TUNNEL
                                                                                                                        U
                                                                                                                        s
                                                                                                                        e
                                                                                                                        r
http://localhost:8080
                                                                                                                        I
                                                                                                                        n
                                                                                                                        t
                                                                                                                        e
                                                                                                                        r
                                                                                                                        n
                                                                                                                        e
                                                                                                                        t
                                                                                                                        S
                                                                                                                        e
                                                                                                                        r
                                                                                                                        v
                                                                                                                        e
                                                                                                                        r
    Photos: http://eandt.theiet.org/magazine/2012/07/interview-andrew-blum.cfm, http://www.quickmeme.com/meme/35583x/
ANATOMY OF A SSH TUNNEL
                                                                                                                        U
                                                                                                                        s
                                                                                                                        e
                                                                                                                        r
http://localhost:8080
                                                                                                                        I
                                                                                                                        n
                                      Ports                                                                             t
                                       605                                                                              e
                                      8080                                                                              r
                                                                                                                        n
                                                                                                                        e
                                                                                                                        t

                                                                                              Ports
                                                                                                                        S
                                                                                                                        e
                                                                                                80                      r
                                                                                                22                      v
                                                                                                                        e
                                                                                                                        r
    Photos: http://eandt.theiet.org/magazine/2012/07/interview-andrew-blum.cfm, http://www.quickmeme.com/meme/35583x/
ANATOMY OF A SSH TUNNEL
                                                                                                                        U
                                                                                                                        s
                                                                                                                        e
                                                                                                                        r
http://localhost:8080
                                                                                                                        I
                                                                                                                        n
                                      Ports                                                                             t
                                       605                                                                              e
                                      8080                                                                              r
                                                                                                                        n
                                                                                                                        e
                                                                                                                        t

                                                                                              Ports
                                                                                                                        S
                                                                                                                        e
                                                                                                80                      r
                                                                                                22                      v
                                                                                                                        e
                                                                                                                        r
    Photos: http://eandt.theiet.org/magazine/2012/07/interview-andrew-blum.cfm, http://www.quickmeme.com/meme/35583x/
ANATOMY OF A SSH TUNNEL
                                                                                                                        U
                                                                                                                        s
                                                                                                                        e
                                                                                                                        r
http://localhost:8080
                                                                                                                        I
                                                                                                                        n
                                      Ports                                                                             t
                                       605                                                                              e
                                      8080                                                                              r
                                                                                                                        n
                                                                                                                        e
                                                                                                                        t

                                                                                              Ports
                                                                                                                        S
                                                                                                                        e
                                                                                                80                      r
                                                                                                22                      v
                                                                                                                        e
                                                                                                                        r
    Photos: http://eandt.theiet.org/magazine/2012/07/interview-andrew-blum.cfm, http://www.quickmeme.com/meme/35583x/
SSH TUNNELS HAVE BAGGAGE
           YOU STILL NEED...

•A   server that’s somewhere on the internet
• Running   some kind of *nix
• That   you control
I’M LAZY

   ssh -tR {remote_port}:
127.0.0.1:{local_port} {user}
@{remote_host} “sudo ssh -Nl
   $USER -L {host_alias}:
   {local_port}:127.0.0.1:
{remote_port} {remote_host}”


        Source: https://gist.github.com/945690
THERE MUST BE AN EASIER
        WAY
ENTER LOCALTUNNEL
NEAT! HOW DOES IT WORK?
 CLIENT        SERVICE
NEAT! HOW DOES IT WORK?
 CLIENT        SERVICE
NEAT! HOW DOES IT WORK?
      CLIENT          SERVICE
1. Makes HTTP
POST to localtunnel
NEAT! HOW DOES IT WORK?
      CLIENT                  SERVICE
1. Makes HTTP
POST to localtunnel
                      2. Responds with an open
                      hostname and port
NEAT! HOW DOES IT WORK?
      CLIENT                  SERVICE
1. Makes HTTP
POST to localtunnel
                      2. Responds with an open
                      hostname and port
3. Opens a tunnel
using specified port
NEAT! HOW DOES IT WORK?
      CLIENT                  SERVICE
1. Makes HTTP
POST to localtunnel
                      2. Responds with an open
                      hostname and port
3. Opens a tunnel
using specified port
                      4. Proxies traffic from
                      your assigned hostname
                      to your tunnel
TROUBLE IN PARADISE
TROUBLE IN PARADISE
• Random   hostname, changes every time.
TROUBLE IN PARADISE
• Random     hostname, changes every time.

• Idle   timeout
TROUBLE IN PARADISE
• Random     hostname, changes every time.

• Idle   timeout

• Change    network connections?
TROUBLE IN PARADISE
• Random      hostname, changes every time.

• Idle   timeout

• Change     network connections?

• Put    your laptop to sleep?
TROUBLE IN PARADISE
• Random      hostname, changes every time.

• Idle   timeout

• Change     network connections?

• Put    your laptop to sleep?

• Stop    and start your server?
WHAT I REALLY WANT IS...


  MACBOOK.MANUZAK.COM


     ALL. THE. TIME.
ALTERNATIVES

showoff.io
• Allows   custom CNAMEs!

• $5/mo

pagekite.net

• Allows   custom CNAMEs!

• ~$4/mo
CLOUDTUNNEL TO THE RESCUE!




     Photo: http://commons.wikimedia.org/wiki/File:Roll-cloud.JPG
WHAT IS CLOUDTUNNEL?
CLIENT       SERVICE
WHAT IS CLOUDTUNNEL?
        CLIENT             SERVICE
•Keeps the connection
alive

•Restarts the connection
if needed

•Runs localtunnel as a
daemon
WHAT IS CLOUDTUNNEL?
        CLIENT                      SERVICE
•Keeps the connection      •Allows you to specify your
alive                      hostname

•Restarts the connection   •Supports CNAMES!
if needed
                           •Redirects users to your
•Runs localtunnel as a     current tunnel address
daemon
CLIENT

➜ ps aux | grep cloud_tunnel
19036  1.2 0.1 2509496 12164 7:22AM   0:03.37 cloud_tunnel
19024  0.0 0.1 2490680 14504 7:22AM   0:00.29 cloud_tunnel_monitor
19023  0.0 0.1 2501304 18332 7:22AM   0:00.42 cloud_tunnel
CLIENT

➜ ps aux | grep cloud_tunnel
19036  1.2 0.1 2509496 12164 7:22AM   0:03.37 cloud_tunnel
19024  0.0 0.1 2490680 14504 7:22AM   0:00.29 cloud_tunnel_monitor
19023  0.0 0.1 2501304 18332 7:22AM   0:00.42 cloud_tunnel
CLIENT

➜ ps aux | grep cloud_tunnel
19036  1.2 0.1 2509496 12164 7:22AM   0:03.37 cloud_tunnel
19024  0.0 0.1 2490680 14504 7:22AM   0:00.29 cloud_tunnel_monitor
19023  0.0 0.1 2501304 18332 7:22AM   0:00.42 cloud_tunnel
CLIENT

➜ ps aux | grep cloud_tunnel
19036  1.2 0.1 2509496 12164 7:22AM   0:03.37 cloud_tunnel
19024  0.0 0.1 2490680 14504 7:22AM   0:00.29 cloud_tunnel_monitor
19023  0.0 0.1 2501304 18332 7:22AM   0:00.42 cloud_tunnel
CLIENT - TUNNEL
module CloudTunnel
  class Tunnel
    TUNNEL_SERVICE_HOST_DOMAIN = 'localtunnel.com'

    attr_reader :host, :pid

    def open_tunnel
     start_tunnel_in_background
    end

    def connected?
      return false unless @pid
      ping_tunnel && process_alive?(@pid)
    end

    def keep_alive
      ping_tunnel
    end
CLIENT - TUNNEL
CLIENT - TUNNEL
    def start_tunnel_in_background
      key = File.open(KEY_FILE).read

      t = LocalTunnel::Tunnel.new(PORT, key)
      t.register_tunnel

      pid = fork { t.start_tunnel }

      @host = t.host
      @pid = pid
      Process.detach(@pid)
    end
CLIENT - TUNNEL
    def start_tunnel_in_background
      key = File.open(KEY_FILE).read

      t = LocalTunnel::Tunnel.new(PORT, key)
      t.register_tunnel

      pid = fork { t.start_tunnel }

      @host = t.host
      @pid = pid
      Process.detach(@pid)
    end
FORKING AND PIDS
• PID   = Process ID

• Unique   ID for each running process

• Allows   direct access for management


• Why    Process (fork)?

• Process.detach   == Thread.new { Process.wait(pid) }
CLIENT - TUNNEL
    def process_alive?(pid)
      begin
        Process.getpgid(pid)
        true
      rescue Errno::ESRCH
        false
      end
    end

    def ping_tunnel
      url = "http://
#{@host}.#{TUNNEL_SERVICE_HOST_DOMAIN}"
      uri = URI(url)
      response = Net::HTTP.get_response(uri)

      case response
      when Net::HTTPSuccess
        true
      else
        false
      end
    end
  end
end
CLIENT - TUNNEL
    def process_alive?(pid)
      begin
        Process.getpgid(pid)
        true
      rescue Errno::ESRCH
        false
      end
    end

    def ping_tunnel
      url = "http://
#{@host}.#{TUNNEL_SERVICE_HOST_DOMAIN}"
      uri = URI(url)
      response = Net::HTTP.get_response(uri)

      case response
      when Net::HTTPSuccess
        true
      else
        false
      end
    end
  end
end
CLIENT - TUNNEL
    def process_alive?(pid)
      begin
        Process.getpgid(pid)
        true
      rescue Errno::ESRCH
        false
      end
    end

    def ping_tunnel
      url = "http://
#{@host}.#{TUNNEL_SERVICE_HOST_DOMAIN}"
      uri = URI(url)
      response = Net::HTTP.get_response(uri)

      case response
      when Net::HTTPSuccess
        true
      else
        false
      end
    end
  end
end
CLIENT - DAEMON
require 'cloud_tunnel'

SLEEP_INTERVAL = 180

loop do
  @tunnel ||=nil

  start_tunnel_and_register_pid unless @tunnel && @tunnel.connected?

  sleep(SLEEP_INTERVAL)
end

def start_tunnel_and_register_pid
  # Clean up if process was running previously
  kill_background_process(@pid) unless @pid.nil?

  # Open the tunnel
  @tunnel = CloudTunnel::start
  @pid = @tunnel.pid

  # Ensure the background processes get killed on exit
  at_exit do
    kill_background_process(@pid)
  end
end
CLIENT - DAEMON
require 'cloud_tunnel'

SLEEP_INTERVAL = 180

loop do
  @tunnel ||=nil

  start_tunnel_and_register_pid unless @tunnel && @tunnel.connected?

  sleep(SLEEP_INTERVAL)
end

def start_tunnel_and_register_pid
  # Clean up if process was running previously
  kill_background_process(@pid) unless @pid.nil?

  # Open the tunnel
  @tunnel = CloudTunnel::start
  @pid = @tunnel.pid

  # Ensure the background processes get killed on exit
  at_exit do
    kill_background_process(@pid)
  end
end
CLIENT - DAEMON
require 'cloud_tunnel'

SLEEP_INTERVAL = 180

loop do
  @tunnel ||=nil

  start_tunnel_and_register_pid unless @tunnel && @tunnel.connected?

  sleep(SLEEP_INTERVAL)
end

def start_tunnel_and_register_pid
  # Clean up if process was running previously
  kill_background_process(@pid) unless @pid.nil?

  # Open the tunnel
  @tunnel = CloudTunnel::start
  @pid = @tunnel.pid

  # Ensure the background processes get killed on exit
  at_exit do
    kill_background_process(@pid)
  end
end
CLIENT - REGISTRATION
module CloudTunnel
  class RedirectClient

    def create_or_update(source, destination)
      uri = URI('http://ctr.herokuapp.com/route')
      req = Net::HTTP::Post.new(uri.path)
      req.set_form_data(:source => source, :destination => destination)

      res = Net::HTTP.start(uri.hostname, uri.port) do |http|
          http.request(req)
      end

      case res
      when Net::HTTPSuccess
        true
      else
        raise 'Could not update redirect server'
      end
    end
  end
end
SERVICE
•Sinatra app
•Running on Heroku
•Dead simple API
 get '/'

 post '/route'

 delete '/route'
SERVICE - ROUTE
require 'sinatra'
require 'dm-core’

class Route
  include DataMapper::Resource
  property :id, Serial
  property :source, String, :unique => true
  property :destination, String
  property :port, Integer
end
SERVICE - REDIRECT

get '/' do
  route = Route.last(:source => parse_hostname(request.host))
  if route
    redirect_path = "#{route.destination}" + (route.port.nil? ?
'' : ":#{route.port}")
    redirect redirect_path, 302
  else
    halt 404, 'Not found.'
  end
end
SERVICE - REDIRECT

get '/' do
  route = Route.last(:source => parse_hostname(request.host))
  if route
    redirect_path = "#{route.destination}" + (route.port.nil? ?
'' : ":#{route.port}")
    redirect redirect_path, 302
  else
    halt 404, 'Not found.'
  end
end
SERVICE - REDIRECT

get '/' do
  route = Route.last(:source => parse_hostname(request.host))
  if route
    redirect_path = "#{route.destination}" + (route.port.nil? ?
'' : ":#{route.port}")
    redirect redirect_path, 302
  else
    halt 404, 'Not found.'
  end
end
¿QUESTIONS?




 https://github.com/jmanuzak

Jonathan Manuzak / @jonmanuzak
    #ATLRUG / Oct 10, 2012
LINKS
• https://github.com/jmanuzak/cloud_tunnel_redirect

• https://github.com/jmanuzak/cloud_tunnel

• https://github.com/progrium/localtunnel

• http://progrium.com/localtunnel/

• https://showoff.io/

• https://pagekite.net/

• http://daemons.rubyforge.org/

More Related Content

What's hot

the 37 Issues of Travel Weekly
the 37 Issues of Travel Weeklythe 37 Issues of Travel Weekly
the 37 Issues of Travel Weekly
vietnamtw
 
Travel Weekly Magazine travelweekly The 30th Issue (12 Aug, 2010)
Travel Weekly Magazine travelweekly   The 30th Issue (12 Aug, 2010)Travel Weekly Magazine travelweekly   The 30th Issue (12 Aug, 2010)
Travel Weekly Magazine travelweekly The 30th Issue (12 Aug, 2010)
vietnamtw
 
VMware vCloud Director and Nexus 1000V / Workload Mobility
VMware vCloud Director and Nexus 1000V / Workload MobilityVMware vCloud Director and Nexus 1000V / Workload Mobility
VMware vCloud Director and Nexus 1000V / Workload Mobility
Sal Lopez
 
Dental amalgam
Dental amalgamDental amalgam
Dental amalgam
Zirgi Rana
 

What's hot (20)

Enterprise Collaboration: Can You Connect Social Learning and Business Perfor...
Enterprise Collaboration: Can You Connect Social Learning and Business Perfor...Enterprise Collaboration: Can You Connect Social Learning and Business Perfor...
Enterprise Collaboration: Can You Connect Social Learning and Business Perfor...
 
ASRR Keynote by Barry Dahl
ASRR Keynote by Barry DahlASRR Keynote by Barry Dahl
ASRR Keynote by Barry Dahl
 
the 37 Issues of Travel Weekly
the 37 Issues of Travel Weeklythe 37 Issues of Travel Weekly
the 37 Issues of Travel Weekly
 
Spiral Of Knowledge - 1967
Spiral Of Knowledge - 1967Spiral Of Knowledge - 1967
Spiral Of Knowledge - 1967
 
300
300300
300
 
Transport and mobility
Transport and mobilityTransport and mobility
Transport and mobility
 
Personal Branding for Corporate Success
Personal Branding for Corporate SuccessPersonal Branding for Corporate Success
Personal Branding for Corporate Success
 
Ed Burns @ FOWA 08
Ed Burns @ FOWA 08Ed Burns @ FOWA 08
Ed Burns @ FOWA 08
 
Travel Weekly Magazine travelweekly The 30th Issue (12 Aug, 2010)
Travel Weekly Magazine travelweekly   The 30th Issue (12 Aug, 2010)Travel Weekly Magazine travelweekly   The 30th Issue (12 Aug, 2010)
Travel Weekly Magazine travelweekly The 30th Issue (12 Aug, 2010)
 
VMware vCloud Director and Nexus 1000V / Workload Mobility
VMware vCloud Director and Nexus 1000V / Workload MobilityVMware vCloud Director and Nexus 1000V / Workload Mobility
VMware vCloud Director and Nexus 1000V / Workload Mobility
 
120125 tridti p2_resized
120125 tridti p2_resized120125 tridti p2_resized
120125 tridti p2_resized
 
Murcia esl position english teacher
Murcia esl position english teacher Murcia esl position english teacher
Murcia esl position english teacher
 
The 35th Travelweekly Digital Issue
The 35th Travelweekly Digital Issue The 35th Travelweekly Digital Issue
The 35th Travelweekly Digital Issue
 
2010 Honda Insight Hybrid Los Angeles
2010 Honda Insight Hybrid Los Angeles2010 Honda Insight Hybrid Los Angeles
2010 Honda Insight Hybrid Los Angeles
 
Me gusta fumar ¿por qué dejarlo
Me gusta fumar ¿por qué dejarlo Me gusta fumar ¿por qué dejarlo
Me gusta fumar ¿por qué dejarlo
 
2010 Honda Insight Boston
2010 Honda Insight Boston2010 Honda Insight Boston
2010 Honda Insight Boston
 
Dental amalgam
Dental amalgamDental amalgam
Dental amalgam
 
36 Issues of Travel Weekly magazines
36 Issues of Travel Weekly magazines36 Issues of Travel Weekly magazines
36 Issues of Travel Weekly magazines
 
Introduction to windows workflow foundation (2007)
Introduction to windows workflow foundation (2007)Introduction to windows workflow foundation (2007)
Introduction to windows workflow foundation (2007)
 
2010 Honda Insight Hybrid Jackson
2010 Honda Insight Hybrid Jackson2010 Honda Insight Hybrid Jackson
2010 Honda Insight Hybrid Jackson
 

Similar to CloudTunnel Atlanta Ruby Users Group October 2012

Re on farm survey outline results
Re on farm  survey outline resultsRe on farm  survey outline results
Re on farm survey outline results
Bioenergy Crops
 
art of presentation Map of Jamies Yam
art of presentation Map of Jamies Yamart of presentation Map of Jamies Yam
art of presentation Map of Jamies Yam
Jamies Yam
 
if you forget me
if you forget meif you forget me
if you forget me
nitish
 
Dave Folio G D 8
Dave Folio  G D 8Dave Folio  G D 8
Dave Folio G D 8
Dave Lilly
 
Week4 presentaion
Week4 presentaionWeek4 presentaion
Week4 presentaion
UNSW
 
VocaLight Infrared Classroom Amplification Brochure
VocaLight Infrared Classroom Amplification BrochureVocaLight Infrared Classroom Amplification Brochure
VocaLight Infrared Classroom Amplification Brochure
GailMaynard
 
5.1.3 poster researchin findings
5.1.3 poster researchin findings5.1.3 poster researchin findings
5.1.3 poster researchin findings
AbisolaCm
 
5.1.3 poster researchin findings
5.1.3 poster researchin findings5.1.3 poster researchin findings
5.1.3 poster researchin findings
AbisolaCm
 
Ethan And Josh’s Clicker Quiz
Ethan And  Josh’s  Clicker  QuizEthan And  Josh’s  Clicker  Quiz
Ethan And Josh’s Clicker Quiz
ray13
 

Similar to CloudTunnel Atlanta Ruby Users Group October 2012 (20)

REFEDS MET, PEER and MDUI Presentation
REFEDS MET, PEER and MDUI PresentationREFEDS MET, PEER and MDUI Presentation
REFEDS MET, PEER and MDUI Presentation
 
Wetland Mapping & Conservation Efforts in the Fort Nelson area
Wetland Mapping & Conservation Efforts in the Fort Nelson areaWetland Mapping & Conservation Efforts in the Fort Nelson area
Wetland Mapping & Conservation Efforts in the Fort Nelson area
 
Blackhawk Mines Corp. Marmajito Mining Sector
Blackhawk Mines Corp. Marmajito Mining SectorBlackhawk Mines Corp. Marmajito Mining Sector
Blackhawk Mines Corp. Marmajito Mining Sector
 
Re on farm survey outline results
Re on farm  survey outline resultsRe on farm  survey outline results
Re on farm survey outline results
 
Re on farm survey outline results
Re on farm  survey outline resultsRe on farm  survey outline results
Re on farm survey outline results
 
art of presentation Map of Jamies Yam
art of presentation Map of Jamies Yamart of presentation Map of Jamies Yam
art of presentation Map of Jamies Yam
 
Mobile Marketing May 2011
Mobile Marketing May 2011Mobile Marketing May 2011
Mobile Marketing May 2011
 
AAF Nissan Plans Book
AAF Nissan Plans BookAAF Nissan Plans Book
AAF Nissan Plans Book
 
A af plansbook2012
A af plansbook2012A af plansbook2012
A af plansbook2012
 
Bas03 seminar
Bas03 seminarBas03 seminar
Bas03 seminar
 
if you forget me
if you forget meif you forget me
if you forget me
 
Dave Folio G D 8
Dave Folio  G D 8Dave Folio  G D 8
Dave Folio G D 8
 
International Trade Compliance Strategy Responsibility Matrix
International Trade Compliance Strategy Responsibility MatrixInternational Trade Compliance Strategy Responsibility Matrix
International Trade Compliance Strategy Responsibility Matrix
 
Week4 presentaion
Week4 presentaionWeek4 presentaion
Week4 presentaion
 
Packet tracer53support
Packet tracer53supportPacket tracer53support
Packet tracer53support
 
VocaLight Infrared Classroom Amplification Brochure
VocaLight Infrared Classroom Amplification BrochureVocaLight Infrared Classroom Amplification Brochure
VocaLight Infrared Classroom Amplification Brochure
 
5.1.3 poster researchin findings
5.1.3 poster researchin findings5.1.3 poster researchin findings
5.1.3 poster researchin findings
 
5.1.3 poster researchin findings
5.1.3 poster researchin findings5.1.3 poster researchin findings
5.1.3 poster researchin findings
 
Intimacy Web
Intimacy WebIntimacy Web
Intimacy Web
 
Ethan And Josh’s Clicker Quiz
Ethan And  Josh’s  Clicker  QuizEthan And  Josh’s  Clicker  Quiz
Ethan And Josh’s Clicker Quiz
 

Recently uploaded

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 

CloudTunnel Atlanta Ruby Users Group October 2012

  • 1. TUNNELING FOR FUN Jonathan Manuzak / @jonmanuzak #ATLRUG / Oct 10, 2012
  • 4. MOST OF MY DEVELOPMENT HAPPENS HERE Photo: http://www.flickr.com/photos/blueace/797823265
  • 5. MOST OF MY DEVELOPMENT HAPPENS HERE
  • 6.
  • 7.
  • 10. FIREWALL / NAT •Permissive with outgoing requests •Restrictive with incoming requests •Not accessible if behind NAT
  • 11. OUTSIDE THE FIREWALL BUT THE REST OF THE WORLD IS OVER HERE
  • 12.
  • 13.
  • 14.
  • 15.
  • 16. BUT, SURELY THIS IS A SOLVED PROBLEM. RIGHT?
  • 17. BUT, SURELY THIS IS A SOLVED PROBLEM. RIGHT? DEPENDS ON YOUR DEFINITION OF SOLVED
  • 18. BUT, SURELY THIS IS A SOLVED PROBLEM. RIGHT? DEPENDS ON YOUR DEFINITION OF SOLVED CODE, DEPLOY, TEST, FAIL, CODE, DEPLOY, TEST, FAIL, CODE, DEPLOY, TEST, FAIL, CODE, DEPLOY, TEST, FAIL, CODE, DEPLOY, TEST, FAIL, CODE, DEPLOY, TEST, FAIL, CODE, DEPLOY, TEST, FAIL, CODE, DEPLOY, TEST, FAIL, RINSE, REPEAT
  • 19. JUST USE A SSH TUNNEL!
  • 20. ANATOMY OF A SSH TUNNEL http://localhost:8080
  • 21. ANATOMY OF A SSH TUNNEL U s e r http://localhost:8080 Photos: http://eandt.theiet.org/magazine/2012/07/interview-andrew-blum.cfm, http://www.quickmeme.com/meme/35583x/
  • 22. ANATOMY OF A SSH TUNNEL U s e r http://localhost:8080 S e r v e r Photos: http://eandt.theiet.org/magazine/2012/07/interview-andrew-blum.cfm, http://www.quickmeme.com/meme/35583x/
  • 23. ANATOMY OF A SSH TUNNEL U s e r http://localhost:8080 I n t e r n e t S e r v e r Photos: http://eandt.theiet.org/magazine/2012/07/interview-andrew-blum.cfm, http://www.quickmeme.com/meme/35583x/
  • 24. ANATOMY OF A SSH TUNNEL U s e r http://localhost:8080 I n Ports t 605 e 8080 r n e t Ports S e 80 r 22 v e r Photos: http://eandt.theiet.org/magazine/2012/07/interview-andrew-blum.cfm, http://www.quickmeme.com/meme/35583x/
  • 25. ANATOMY OF A SSH TUNNEL U s e r http://localhost:8080 I n Ports t 605 e 8080 r n e t Ports S e 80 r 22 v e r Photos: http://eandt.theiet.org/magazine/2012/07/interview-andrew-blum.cfm, http://www.quickmeme.com/meme/35583x/
  • 26. ANATOMY OF A SSH TUNNEL U s e r http://localhost:8080 I n Ports t 605 e 8080 r n e t Ports S e 80 r 22 v e r Photos: http://eandt.theiet.org/magazine/2012/07/interview-andrew-blum.cfm, http://www.quickmeme.com/meme/35583x/
  • 27. SSH TUNNELS HAVE BAGGAGE YOU STILL NEED... •A server that’s somewhere on the internet • Running some kind of *nix • That you control
  • 28. I’M LAZY ssh -tR {remote_port}: 127.0.0.1:{local_port} {user} @{remote_host} “sudo ssh -Nl $USER -L {host_alias}: {local_port}:127.0.0.1: {remote_port} {remote_host}” Source: https://gist.github.com/945690
  • 29. THERE MUST BE AN EASIER WAY
  • 31. NEAT! HOW DOES IT WORK? CLIENT SERVICE
  • 32. NEAT! HOW DOES IT WORK? CLIENT SERVICE
  • 33. NEAT! HOW DOES IT WORK? CLIENT SERVICE 1. Makes HTTP POST to localtunnel
  • 34. NEAT! HOW DOES IT WORK? CLIENT SERVICE 1. Makes HTTP POST to localtunnel 2. Responds with an open hostname and port
  • 35. NEAT! HOW DOES IT WORK? CLIENT SERVICE 1. Makes HTTP POST to localtunnel 2. Responds with an open hostname and port 3. Opens a tunnel using specified port
  • 36. NEAT! HOW DOES IT WORK? CLIENT SERVICE 1. Makes HTTP POST to localtunnel 2. Responds with an open hostname and port 3. Opens a tunnel using specified port 4. Proxies traffic from your assigned hostname to your tunnel
  • 38. TROUBLE IN PARADISE • Random hostname, changes every time.
  • 39. TROUBLE IN PARADISE • Random hostname, changes every time. • Idle timeout
  • 40. TROUBLE IN PARADISE • Random hostname, changes every time. • Idle timeout • Change network connections?
  • 41. TROUBLE IN PARADISE • Random hostname, changes every time. • Idle timeout • Change network connections? • Put your laptop to sleep?
  • 42. TROUBLE IN PARADISE • Random hostname, changes every time. • Idle timeout • Change network connections? • Put your laptop to sleep? • Stop and start your server?
  • 43. WHAT I REALLY WANT IS... MACBOOK.MANUZAK.COM ALL. THE. TIME.
  • 44. ALTERNATIVES showoff.io • Allows custom CNAMEs! • $5/mo pagekite.net • Allows custom CNAMEs! • ~$4/mo
  • 45. CLOUDTUNNEL TO THE RESCUE! Photo: http://commons.wikimedia.org/wiki/File:Roll-cloud.JPG
  • 47. WHAT IS CLOUDTUNNEL? CLIENT SERVICE •Keeps the connection alive •Restarts the connection if needed •Runs localtunnel as a daemon
  • 48. WHAT IS CLOUDTUNNEL? CLIENT SERVICE •Keeps the connection •Allows you to specify your alive hostname •Restarts the connection •Supports CNAMES! if needed •Redirects users to your •Runs localtunnel as a current tunnel address daemon
  • 49. CLIENT ➜ ps aux | grep cloud_tunnel 19036 1.2 0.1 2509496 12164 7:22AM 0:03.37 cloud_tunnel 19024 0.0 0.1 2490680 14504 7:22AM 0:00.29 cloud_tunnel_monitor 19023 0.0 0.1 2501304 18332 7:22AM 0:00.42 cloud_tunnel
  • 50. CLIENT ➜ ps aux | grep cloud_tunnel 19036 1.2 0.1 2509496 12164 7:22AM 0:03.37 cloud_tunnel 19024 0.0 0.1 2490680 14504 7:22AM 0:00.29 cloud_tunnel_monitor 19023 0.0 0.1 2501304 18332 7:22AM 0:00.42 cloud_tunnel
  • 51. CLIENT ➜ ps aux | grep cloud_tunnel 19036 1.2 0.1 2509496 12164 7:22AM 0:03.37 cloud_tunnel 19024 0.0 0.1 2490680 14504 7:22AM 0:00.29 cloud_tunnel_monitor 19023 0.0 0.1 2501304 18332 7:22AM 0:00.42 cloud_tunnel
  • 52. CLIENT ➜ ps aux | grep cloud_tunnel 19036 1.2 0.1 2509496 12164 7:22AM 0:03.37 cloud_tunnel 19024 0.0 0.1 2490680 14504 7:22AM 0:00.29 cloud_tunnel_monitor 19023 0.0 0.1 2501304 18332 7:22AM 0:00.42 cloud_tunnel
  • 53. CLIENT - TUNNEL module CloudTunnel   class Tunnel     TUNNEL_SERVICE_HOST_DOMAIN = 'localtunnel.com'     attr_reader :host, :pid     def open_tunnel      start_tunnel_in_background     end     def connected?       return false unless @pid       ping_tunnel && process_alive?(@pid)     end     def keep_alive       ping_tunnel     end
  • 55. CLIENT - TUNNEL     def start_tunnel_in_background       key = File.open(KEY_FILE).read       t = LocalTunnel::Tunnel.new(PORT, key)       t.register_tunnel       pid = fork { t.start_tunnel }       @host = t.host       @pid = pid       Process.detach(@pid)     end
  • 56. CLIENT - TUNNEL     def start_tunnel_in_background       key = File.open(KEY_FILE).read       t = LocalTunnel::Tunnel.new(PORT, key)       t.register_tunnel       pid = fork { t.start_tunnel }       @host = t.host       @pid = pid       Process.detach(@pid)     end
  • 57. FORKING AND PIDS • PID = Process ID • Unique ID for each running process • Allows direct access for management • Why Process (fork)? • Process.detach == Thread.new { Process.wait(pid) }
  • 58. CLIENT - TUNNEL     def process_alive?(pid)       begin         Process.getpgid(pid)         true       rescue Errno::ESRCH         false       end     end     def ping_tunnel       url = "http:// #{@host}.#{TUNNEL_SERVICE_HOST_DOMAIN}"       uri = URI(url)       response = Net::HTTP.get_response(uri)       case response       when Net::HTTPSuccess         true       else         false       end     end   end end
  • 59. CLIENT - TUNNEL     def process_alive?(pid)       begin         Process.getpgid(pid)         true       rescue Errno::ESRCH         false       end     end     def ping_tunnel       url = "http:// #{@host}.#{TUNNEL_SERVICE_HOST_DOMAIN}"       uri = URI(url)       response = Net::HTTP.get_response(uri)       case response       when Net::HTTPSuccess         true       else         false       end     end   end end
  • 60. CLIENT - TUNNEL     def process_alive?(pid)       begin         Process.getpgid(pid)         true       rescue Errno::ESRCH         false       end     end     def ping_tunnel       url = "http:// #{@host}.#{TUNNEL_SERVICE_HOST_DOMAIN}"       uri = URI(url)       response = Net::HTTP.get_response(uri)       case response       when Net::HTTPSuccess         true       else         false       end     end   end end
  • 61. CLIENT - DAEMON require 'cloud_tunnel' SLEEP_INTERVAL = 180 loop do   @tunnel ||=nil   start_tunnel_and_register_pid unless @tunnel && @tunnel.connected?   sleep(SLEEP_INTERVAL) end def start_tunnel_and_register_pid   # Clean up if process was running previously   kill_background_process(@pid) unless @pid.nil?   # Open the tunnel   @tunnel = CloudTunnel::start   @pid = @tunnel.pid   # Ensure the background processes get killed on exit   at_exit do     kill_background_process(@pid)   end end
  • 62. CLIENT - DAEMON require 'cloud_tunnel' SLEEP_INTERVAL = 180 loop do   @tunnel ||=nil   start_tunnel_and_register_pid unless @tunnel && @tunnel.connected?   sleep(SLEEP_INTERVAL) end def start_tunnel_and_register_pid   # Clean up if process was running previously   kill_background_process(@pid) unless @pid.nil?   # Open the tunnel   @tunnel = CloudTunnel::start   @pid = @tunnel.pid   # Ensure the background processes get killed on exit   at_exit do     kill_background_process(@pid)   end end
  • 63. CLIENT - DAEMON require 'cloud_tunnel' SLEEP_INTERVAL = 180 loop do   @tunnel ||=nil   start_tunnel_and_register_pid unless @tunnel && @tunnel.connected?   sleep(SLEEP_INTERVAL) end def start_tunnel_and_register_pid   # Clean up if process was running previously   kill_background_process(@pid) unless @pid.nil?   # Open the tunnel   @tunnel = CloudTunnel::start   @pid = @tunnel.pid   # Ensure the background processes get killed on exit   at_exit do     kill_background_process(@pid)   end end
  • 64. CLIENT - REGISTRATION module CloudTunnel   class RedirectClient     def create_or_update(source, destination)       uri = URI('http://ctr.herokuapp.com/route')       req = Net::HTTP::Post.new(uri.path)       req.set_form_data(:source => source, :destination => destination)       res = Net::HTTP.start(uri.hostname, uri.port) do |http|           http.request(req)       end       case res       when Net::HTTPSuccess         true       else         raise 'Could not update redirect server'       end     end   end end
  • 65. SERVICE •Sinatra app •Running on Heroku •Dead simple API get '/' post '/route' delete '/route'
  • 66. SERVICE - ROUTE require 'sinatra' require 'dm-core’ class Route   include DataMapper::Resource   property :id, Serial   property :source, String, :unique => true   property :destination, String   property :port, Integer end
  • 67. SERVICE - REDIRECT get '/' do   route = Route.last(:source => parse_hostname(request.host))   if route     redirect_path = "#{route.destination}" + (route.port.nil? ? '' : ":#{route.port}")     redirect redirect_path, 302   else     halt 404, 'Not found.'   end end
  • 68. SERVICE - REDIRECT get '/' do   route = Route.last(:source => parse_hostname(request.host))   if route     redirect_path = "#{route.destination}" + (route.port.nil? ? '' : ":#{route.port}")     redirect redirect_path, 302   else     halt 404, 'Not found.'   end end
  • 69. SERVICE - REDIRECT get '/' do   route = Route.last(:source => parse_hostname(request.host))   if route     redirect_path = "#{route.destination}" + (route.port.nil? ? '' : ":#{route.port}")     redirect redirect_path, 302   else     halt 404, 'Not found.'   end end
  • 70. ¿QUESTIONS? https://github.com/jmanuzak Jonathan Manuzak / @jonmanuzak #ATLRUG / Oct 10, 2012
  • 71. LINKS • https://github.com/jmanuzak/cloud_tunnel_redirect • https://github.com/jmanuzak/cloud_tunnel • https://github.com/progrium/localtunnel • http://progrium.com/localtunnel/ • https://showoff.io/ • https://pagekite.net/ • http://daemons.rubyforge.org/

Editor's Notes

  1. \n
  2. - Let’s get the hard questions out of the way first.\n- For those of you who don’t know me, my name is Jonathan Manuzak\n- I’m the lead developer at a startup called CodeGuard, where we do website backup and monitoring\n\n
  3. \n
  4. Like most of you, I do most of my development on a laptop\nOk, maybe it looks more like this...\n
  5. What’s more interesting is where I could be working from. I might be at the office, my house, a coffee shop, an airport or who knows where\n\n
  6. - The one thing all of these situations have in common is that I’m behind a firewall or NAT device\n\nLet’s take a second to talk about these firewalls or nat devices\n
  7. Firewalls are like diodes, they really prefer for things to go in one direction. In the case of firewalls, it’s out. You can connect to websites, email, maybe FTP.\n\n- Even if you could make these changes they can be a security risk\n- It’s really never accessible to the rest of the world\n
  8. Firewalls are like diodes, they really prefer for things to go in one direction. In the case of firewalls, it’s out. You can connect to websites, email, maybe FTP.\n\n- Even if you could make these changes they can be a security risk\n- It’s really never accessible to the rest of the world\n
  9. Firewalls are like diodes, they really prefer for things to go in one direction. In the case of firewalls, it’s out. You can connect to websites, email, maybe FTP.\n\n- Even if you could make these changes they can be a security risk\n- It’s really never accessible to the rest of the world\n
  10. Firewalls are like diodes, they really prefer for things to go in one direction. In the case of firewalls, it’s out. You can connect to websites, email, maybe FTP.\n\n- Even if you could make these changes they can be a security risk\n- It’s really never accessible to the rest of the world\n
  11. - But, the rest of the world has lots of cool stuff and people!\n\n\n
  12. - You may want to share an app you’re working on with a client instead of sending screenshots\n\n
  13. - Then there are services, full of webhooks and callbacks\n- OAuth Authentication providers\n- Payments\n- Communications\n\nThis stuff can be painful to develop if you have to keep deploying, testing, deploying, testing\n\n\n\n\n
  14. - Then there are services, full of webhooks and callbacks\n- OAuth Authentication providers\n- Payments\n- Communications\n\nThis stuff can be painful to develop if you have to keep deploying, testing, deploying, testing\n\n\n\n\n
  15. - Then there are services, full of webhooks and callbacks\n- OAuth Authentication providers\n- Payments\n- Communications\n\nWith all of these big companies -- facebook, twitter, google...\n\n
  16. - With all of those companies on the previous page who claim to support developers, this should be a non-issue, right?\n
  17. Sure, there are a few ways around it\n
  18. Sure, there are a few ways around it\n
  19. - Just fire up a ssh tunnel\n- Has anyone here used SSH tunnels before?\nDid you know that SSH was released in 1995 and by the end of that year it had over 20,000 users. Not bad growth for one year, right?\n
  20. Assume you have a local webserver running on port 8080\nIt’s sunday afternoon, you’re at home, and you want to show someone this cool app you’re working on\nMaybe it’s your Grandma\n
  21. ... and she’s at her house in a different state\nLets also assume that you have a linode or slicehost...\n
  22. ...some kind server floating around...\n
  23. ... out there on the internet\nNow, how do we get grandma to see your local webserver?\nUsing some variation of that ugly command I showed earlier, we can create a tunnel from your server to your laptop \n\n
  24. The first part of the tunnel is an SSH connection that’s made from your laptop out, through your firewall/router to the remote server\nThen the tunnel is created which essentially binds two ports on either side of the ssh connection\n\n
  25. Thereby sending all traffic from port 80 on the server through the tunnel to port 8080 on your local machine\n\n
  26. Then all grandma has to do is connect to the remote server in her browser and she’ll see what you see\n\n
  27. SSH tunnels are easy if you have all of the right ingredients\n\n- Outside of your firewall\n- For ssh\n- ...because you’re probably going to need at root or sudo access to do this\n\nSo if you have all of that, it’s just a simple one-line command\n
  28. I’m lazy, so the appeal of running my own server and having to run this command every time I want to use an ssh tunnel is not appealing.\n\n
  29. \n
  30. Localhost maintains the public server for you \nIt also provides a nice client to hide the ugly tunnel creation stuff\n\n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. Localtunnel is awesome, but it has a few issues that make it a pain to use more than occasionally\n\n- First, the hostname is random. It changes every time you connect.\n- Idle timeout\n\n- If you change network connections, restart your server, put your laptop to sleep or do anything else to interrupt that socket connection you’re going to have to restart localtunnel.\n
  37. Localtunnel is awesome, but it has a few issues that make it a pain to use more than occasionally\n\n- First, the hostname is random. It changes every time you connect.\n- Idle timeout\n\n- If you change network connections, restart your server, put your laptop to sleep or do anything else to interrupt that socket connection you’re going to have to restart localtunnel.\n
  38. Localtunnel is awesome, but it has a few issues that make it a pain to use more than occasionally\n\n- First, the hostname is random. It changes every time you connect.\n- Idle timeout\n\n- If you change network connections, restart your server, put your laptop to sleep or do anything else to interrupt that socket connection you’re going to have to restart localtunnel.\n
  39. Localtunnel is awesome, but it has a few issues that make it a pain to use more than occasionally\n\n- First, the hostname is random. It changes every time you connect.\n- Idle timeout\n\n- If you change network connections, restart your server, put your laptop to sleep or do anything else to interrupt that socket connection you’re going to have to restart localtunnel.\n
  40. Localtunnel is awesome, but it has a few issues that make it a pain to use more than occasionally\n\n- First, the hostname is random. It changes every time you connect.\n- Idle timeout\n\n- If you change network connections, restart your server, put your laptop to sleep or do anything else to interrupt that socket connection you’re going to have to restart localtunnel.\n
  41. \n
  42. - There are some alternatives to localtunnel\n- Both showoff io and pagekite allow custom cnames, but as far as I can tell still suffer from the other issues.\n- So, just like many engineers, rather than spending the princely sum of $4 or $5 per month, I decided to solve the solution myself using localtunnel.\n
  43. Quick side note. This is what you see if you search for ‘cloud tunnel’ \n\nIt’s a type of arcus cloud, called a roll cloud. They’re relatively rare, and appear to be when an incoming cold sea breeze meets the warmer opposing landmass.\n
  44. The service maintains a record of your localtunnel address and forwards users from a hostname you specify to your current localtunnel\n- Runs on Heroku\n
  45. The service maintains a record of your localtunnel address and forwards users from a hostname you specify to your current localtunnel\n- Runs on Heroku\n
  46. Lets take a closer look at what was going on during the demo\nIf we look at the processlist, we’d notice 3 cloud_tunnel processes\nThe monitor is created by the deamon to watch over, start, and stop the primary cloud_tunnel process\n- If you noticed during the first demo, the localtunnel client blocked until it was killed\n
  47. Lets take a closer look at what was going on during the demo\nIf we look at the processlist, we’d notice 3 cloud_tunnel processes\nThe monitor is created by the deamon to watch over, start, and stop the primary cloud_tunnel process...\n\n
  48. This so called primary tunnel process handles the creation and maintenance of the localtunnel client connection\n- If you noticed during the first demo, the localtunnel client blocked until it was killed\n- For compatibility, I wanted to re-use the localtunnel client instead of reimplementing it myself\nThis adds a bit of complexity, but with a new version of localtunnel on the horizon it will make forward compatibility easier\n\n
  49. Finally, this is the localtunnel client which was forked from the primary cloud_tunnel process\n\n
  50. This is the wrapper class that handles the LocalTunnel client. The meat of it is here...\n
  51. After creating a new instance of the LocalTunnel client, the tunnel is opened (which blocks), so we detach the process\n
  52. After creating a new instance of the LocalTunnel client, the tunnel is opened (which blocks), so we detach the process\n
  53. After creating a new instance of the LocalTunnel client, the tunnel is opened (which blocks), so we detach the process\n
  54. After creating a new instance of the LocalTunnel client, the tunnel is opened (which blocks), so we detach the process\n
  55. After creating a new instance of the LocalTunnel client, the tunnel is opened (which blocks), so we detach the process\n
  56. After creating a new instance of the LocalTunnel client, the tunnel is opened (which blocks), so we detach the process\n
  57. After creating a new instance of the LocalTunnel client, the tunnel is opened (which blocks), so we detach the process\n
  58. After creating a new instance of the LocalTunnel client, the tunnel is opened (which blocks), so we detach the process\n
  59. After creating a new instance of the LocalTunnel client, the tunnel is opened (which blocks), so we detach the process\n
  60. Process allows better management\nBut we’re kind of using threads. Thread waits on \n
  61. This is the wrapper class that handles the LocalTunnel client. The meat of it is here...\n
  62. This is the wrapper class that handles the LocalTunnel client. The meat of it is here...\n
  63. This is the wrapper class that handles the LocalTunnel client. The meat of it is here...\n
  64. This is the wrapper class that handles the LocalTunnel client. The meat of it is here...\n
  65. Now that we detached that process, we have to keep an eye on it.\nThis is a script that starts and maintains that tunnel which and is invoked from the daemon\n
  66. Now that we detached that process, we have to keep an eye on it.\nThis is a script that starts and maintains that tunnel which and is invoked from the daemon\n
  67. Now that we detached that process, we have to keep an eye on it.\nThis is a script that starts and maintains that tunnel which and is invoked from the daemon\n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. You can find everything I talked about here today on Github. I’d encourage you to give it a try and let me know what you think. Pull requests are welcome.\nQuestions?\n
  77. \n