Git Product home page Git Product logo

box-ngrok's Introduction

box-ngrok

Ngrok integration with CommandBox

Ngrok is a service that will proxy a locally-running server to the Internet where any coworker, friend, or client with a browser can view the local site site you have running. Use this to demo a new site or ask a friend to look at an error for you. This is also great for testing integration with 3rd party systems (like Stripe webhooks) while still developing on localhost!

Usage

Use the commands that come with this module to start and stop Ngrok shares.

Start a share

server share start
# or
share

It will:

  1. Start the CommandBox server if it is not already running.
  2. Start Ngrok using the embedded binaries for your platform.
  3. Stop any currently open Ngrok tunnels (since the free version only allows one at a time).
  4. Create the new Ngrok tunnel.
  5. Display the share url.
  6. Open the share url in the browser.

Stop a share

server share stop
# or
unshare

If you stop a server that is being shared, the Ngrok tunnel will be closed for you.

box-ngrok's People

Contributors

bdw429s avatar bluewatersolutions avatar daemach avatar elpete avatar evagoras avatar scottsteinbeck avatar shreddtech avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

box-ngrok's Issues

Feature request - allow specifying ngrok domain

HI Eric,

would be cool to be able to specify the ngrok domain when setting up the share instead of having to use the random default domains for those of us who have a paid ngrok account.

Cheers,

Gary

Alias 'unshare' for 'server share stop'

How about we add the at-aliases annotation to stop.cfc that will give us the 'unshare' alias for 'server share stop', just like we have 'share' for 'server share start'?

Not working with ColdFusion 11

Running Commandbox 3.3.0 with ColdFusion 11 on Windows and I got this error.
ERROR

500 Internal Server Error

C:\commandbox\cfml\modules\box-ngrok\models\NgrokService.cfc: line 68
66:                 "proto" = protocol,
67:                 "name" = name
68:             } ) );
69:         }
70:
called from C:\commandbox\cfml\modules\box-ngrok\commands\server\share\start.cfc: line 70
68:             name = serverInfo.name,
69:             port = serverInfo.port,
70:             isSSL = serverInfo.sslEnable
71:         );
72:         var tunnelUrl = tunnel.public_url;
called from C:\commandbox\cfml\system\services\CommandService.cfc: line 292
290:             // Run the command
291:             try {
292:                 var result = commandInfo.commandReference.CFC.run( argumentCollection = parameterInfo.namedParameters );
293:                 lastCommandErrored = commandInfo.commandReference.CFC.hasError();
294:             } catch( any e ){
called from C:\commandbox\cfml\system\services\CommandService.cfc: line 131
129:         var commandChain = resolveCommand( line );
130:
131:         return runCommand( commandChain, line );
132:     }
133:
called from C:\commandbox\cfml\system\Shell.cfc: line 465
463:                 }
464:             } else {
465:                 var result = variables.commandService.runCommandLine( arguments.command );
466:             }
467:
called from C:\commandbox\cfml\system\Shell.cfc: line 421
419:                 // If there's input, try to run it.
420:                 if( len( trim( line ) ) ) {
421:                     callCommand( command=line, initialCommand=true );
422:                 }
423:
called from C:\commandbox\cfml\system\Bootstrap.cfm: line 112
110:
111:         // Running the "reload" command will enter this while loop once
112:         while( shell.run( silent=silent ) ){
113:             clearScreen = shell.getDoClearScreen();
114:
500 Internal Server Error
    at lucee.runtime.tag.Http41._doEndTag(Http41.java:1266):1266
    at lucee.runtime.tag.Http41.doEndTag(Http41.java:624):624
    at lucee.runtime.tag.HttpImpl.doEndTag(HttpImpl.java:223):223
    at models.ngrokservice_cfc$cf.udfCall2(C:\commandbox\cfml\modules\box-ngrok\models\NgrokService.cfc:68):68
    at models.ngrokservice_cfc$cf.udfCall(C:\commandbox\cfml\modules\box-ngrok\models\NgrokService.cfc):-1
    at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:111):111
    at lucee.runtime.type.UDFImpl._call(UDFImpl.java:328):328
    at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:216):216
    at lucee.runtime.ComponentImpl._call(ComponentImpl.java:643):643
    at lucee.runtime.ComponentImpl._call(ComponentImpl.java:524):524
    at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1778):1778
    at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:774):774
    at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1603):1603
    at modules.box_ngrok180.commands.server.share.start_cfc$cf.udfCall(C:\commandbox\cfml\modules\box-ngrok\commands\server\share\start.cfc:70):70
    at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:111):111
    at lucee.runtime.type.UDFImpl._call(UDFImpl.java:328):328
    at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:216):216
    at lucee.runtime.ComponentImpl._call(ComponentImpl.java:643):643
    at lucee.runtime.ComponentImpl._call(ComponentImpl.java:524):524
    at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1778):1778
    at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:774):774
    at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1603):1603
    at system.services.commandservice_cfc$cf.udfCall1(C:\commandbox\cfml\system\services\CommandService.cfc:292):292
    at system.services.commandservice_cfc$cf.udfCall(C:\commandbox\cfml\system\services\CommandService.cfc):-1
    at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:111):111
    at lucee.runtime.type.UDFImpl._call(UDFImpl.java:328):328
    at lucee.runtime.type.UDFImpl.call(UDFImpl.java:229):229
    at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:766):766
    at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:743):743
    at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1593):1593
    at system.services.commandservice_cfc$cf.udfCall1(C:\commandbox\cfml\system\services\CommandService.cfc:131):131
    at system.services.commandservice_cfc$cf.udfCall(C:\commandbox\cfml\system\services\CommandService.cfc):-1
    at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:111):111
    at lucee.runtime.type.UDFImpl._call(UDFImpl.java:328):328
    at lucee.runtime.type.UDFImpl.call(UDFImpl.java:229):229
    at lucee.runtime.ComponentImpl._call(ComponentImpl.java:642):642
    at lucee.runtime.ComponentImpl._call(ComponentImpl.java:524):524
    at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1761):1761
    at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:743):743
    at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1593):1593
    at system.shell_cfc$cf.udfCall2(C:\commandbox\cfml\system\Shell.cfc:465):465
    at system.shell_cfc$cf.udfCall(C:\commandbox\cfml\system\Shell.cfc):-1
    at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:111):111
    at lucee.runtime.type.UDFImpl._call(UDFImpl.java:328):328
    at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:216):216
    at lucee.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:775):775
    at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:774):774
    at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1603):1603
    at system.shell_cfc$cf.udfCall2(C:\commandbox\cfml\system\Shell.cfc:421):421
    at system.shell_cfc$cf.udfCall(C:\commandbox\cfml\system\Shell.cfc):-1
    at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:111):111
    at lucee.runtime.type.UDFImpl._call(UDFImpl.java:328):328
    at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:216):216
    at lucee.runtime.ComponentImpl._call(ComponentImpl.java:643):643
    at lucee.runtime.ComponentImpl._call(ComponentImpl.java:524):524
    at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1778):1778
    at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:774):774
    at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1603):1603
    at commandbox.cfml.system.bootstrap_cfm$cf.call(C:\commandbox\cfml\system\Bootstrap.cfm:112):112
    at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:954):954
    at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:906):906
    at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:225):225
    at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:37):37
    at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2265):2265
    at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2228):2228
    at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:456):456
    at lucee.runtime.engine.CFMLEngineImpl.cli(CFMLEngineImpl.java:760):760
    at lucee.loader.engine.CFMLEngineWrapper.cli(CFMLEngineWrapper.java:267):267
    at luceecli.CLIMain.run(CLIMain.java:223):223
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method):-2
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62):62
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43):43
    at java.lang.reflect.Method.invoke(Method.java:497):497
    at cliloader.LoaderCLIMain.execute(LoaderCLIMain.java:205):205
    at cliloader.LoaderCLIMain.main(LoaderCLIMain.java:698):698

CommandBox:adminrewrite>```

access denied when share starts server

I don't have time right now to look at this, but putting this here since it's happened a bunch of times.

Basically, every time I run share and it tries to start the server for me, I get an access denied on the server.json file. I wouldn't expect the file to be locked, but it seems to happen every time on Windows.

CommandBox:commandbox> share

The server needs to be started first.  Doing that now.

ERROR (@build.version@[email protected]@)

D:\commandbox (Access is denied)

C:\Users\Brad.development\.CommandBox\cfml\system\services\ServerService.cfc: line 1211
1209:         // Try to prevent bunping the date modified for no reason
1210:         if( oldJSON != newJSON ) {
1211:             fileWrite( arguments.configFilePath, newJSON );
1212:         }
1213:     }
called from C:\Users\Brad.development\.CommandBox\cfml\system\services\ServerService.cfc: line 356
354:
355:         if( !serverJSON.isEmpty() && serverProps.saveSettings ) {
356:             saveServerJSON( defaultServerConfigFile, serverJSON );
357:         }
358:
called from C:\Users\Brad.development\.CommandBox\cfml\system\modules_app\server-commands\commands\server\start.cfc: line 131
129:
130:             // startup the server
131:             return serverService.start( serverProps = arguments );
132:
133:         // endpointException exception type is used when the endpoint has an issue that needs displayed,
called from C:\Users\Brad.development\.CommandBox\cfml\system\services\CommandService.cfc: line 292
290:             // Run the command
291:             try {
292:                 var result = commandInfo.commandReference.CFC.run( argumentCollection = parameterInfo.namedParameters );
293:                 lastCommandErrored = commandInfo.commandReference.CFC.hasError();
294:             } catch( any e ){
called from C:\Users\Brad.development\.CommandBox\cfml\system\services\CommandService.cfc: line 149
147:         }
148:
149:         return runCommand( commandChain, tokens.toList( ' ' ) );
150:
151:     }
called from C:\Users\Brad.development\.CommandBox\cfml\system\Shell.cfc: line 473
471:                     var result = variables.commandService.runCommandTokens( arguments.command, piped );
472:                 } else {
473:                     var result = variables.commandService.runCommandTokens( arguments.command );
474:                 }
475:             } else {
called from C:\Users\Brad.development\.CommandBox\cfml\system\util\CommandDSL.cfc: line 174
172:             return shell.callCommand( getTokens(), arguments.returnOutput, arguments.piped );
173:         } else {
174:             return shell.callCommand( getTokens(), arguments.returnOutput );
175:         }
176:     }
called from C:\Users\Brad.development\.CommandBox\cfml\modules\box-ngrok\commands\server\share\start.cfc: line 41
39:             serverArgs.openBrowser = false;
40:             command( "server start" )
41:                 .params( argumentCollection = serverArgs )
42:                 .run();
43:             sleep( 1000 );
called from C:\Users\Brad.development\.CommandBox\cfml\system\services\CommandService.cfc: line 292
290:             // Run the command
291:             try {
292:                 var result = commandInfo.commandReference.CFC.run( argumentCollection = parameterInfo.namedParameters );
293:                 lastCommandErrored = commandInfo.commandReference.CFC.hasError();
294:             } catch( any e ){
called from C:\Users\Brad.development\.CommandBox\cfml\system\services\CommandService.cfc: line 131
129:         var commandChain = resolveCommand( line );
130:
131:         return runCommand( commandChain, line );
132:     }
133:
called from C:\Users\Brad.development\.CommandBox\cfml\system\Shell.cfc: line 476
474:                 }
475:             } else {
476:                 var result = variables.commandService.runCommandLine( arguments.command );
477:             }
478:
called from C:\Users\Brad.development\.CommandBox\cfml\system\Shell.cfc: line 425
423:                 // If there's input, try to run it.
424:                 if( len( trim( line ) ) ) {
425:                     callCommand( command=line, initialCommand=true );
426:                 }
427:
called from C:\Users\Brad.development\.CommandBox\cfml\system\Bootstrap.cfm: line 112
110:
111:         // Running the "reload" command will enter this while loop once
112:         while( shell.run( silent=silent ) ){
113:             clearScreen = shell.getDoClearScreen();
114:

server share stop not stopping share

If I start a server and then open a share like so it works great:

start
share

However if I run server share stop, the tunnel still passes through to my local server unabated and the ngrok-windows.exe process remains running. Stopping the local server gives me a message about the tunnel not being found, but I'm still not sure if NGrok is really stopped since the ngrok-windows.exe process never dies until I kill it manually.

Is there any output from the ngrok command that we can output when stopping the tunnel to help debug?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.