You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Jason Dillon <ja...@planet57.com> on 2006/10/02 09:01:02 UTC

What is GShell?

I keep hearing this question... I thought I had put out enough detail  
about GShell on the list months ago, but still there is some mystery  
about it.  So I thought I would send out a simple terse explanation  
that sums it up.

  * * *

GShell allows users to telnet into a running Geronimo server and run  
some commands.

It includes a 'script' command which allows an arbitrary script (in  
any bsf supported language) to be executed... all _inside_ of  
Geronimo.  Soon GShell will also support ssh (as soon as I can figure  
out how to make Jsch work as a server).

The framework to make the above command stuff work can also be used  
to implement simple pluggable tools for command-line use... and I  
would imagine that we could eventually change all of our command line  
bits to run from it (perhaps all except the server command).  The  
nice thing here is that it is trivial to just "drop in" new commands  
with out needing more platform scripts and with out having to rewrite  
all of that icky main(String[]) handling muck... all with sexy  
readline-like buffer editing/history and tab completion (all of which  
provided by jline which kicks ass).

Eventually GShell will have a full expression parser very similar to  
Bash, but right now it is a tad primitive, but functional enough for  
compound expressions and variable expansion.

Okay, I gotta stop now or else this will turn into a novel...

So, I hope that helps explain what the mysterious GShell is... if  
not, let me know and I will revise my simple terse explanation so  
that it does.

Cheers,

--jason

Re: What is GShell?

Posted by David Blevins <da...@visi.com>.
On Oct 3, 2006, at 10:12 AM, Paul McMahan wrote:

> I love the idea of being able to telnet or ssh into the server and run
> commands remotely.

Ditto.  Everyone gave me hard time when I did this in OpenEJB a  
couple years ago.  Hiram cleaned the code up considerably when I  
moved it into xbean -- thanks Hiram.

   http://incubator.apache.org/openejb/telnet-console.html

GShell looks pretty awesome..  Jason's definitely taken it to the  
next level.  Super excited to see GShell get integrated into Geronimo.

Really looking forward to that full bash shell.  That's going to be  
so sweet.  I'm a bash junkie.  I did a Groovy shell that James  
blogged about, but Groovy just didn't cut it as an interactive shell  
-- sorry James.

Props to Jason for some pretty outstanding work!

-David


Re: What is GShell?

Posted by Jason Dillon <ja...@planet57.com>.
On Oct 3, 2006, at 10:12 AM, Paul McMahan wrote:
> OK I should have guessed that windows was the culprit. I jumped over
> to debian and now all is fine.  GShell looks very promising!!  I love
> the idea of being able to telnet or ssh into the server and run
> commands remotely.  As a matter of fact this appears to provide a
> vital improvement that Geronimo users have been asking for: the
> ability to remotely administer a running server (see the "Swing
> console?" thread from 9/17/2006).

Yup, that is the general idea. :-)


> A few questions :
> -  what's the security model?

Mostly this is TBD.  I plan on adding some sort of login context to  
allow users to login (for ssh this will be the ssh auth callback, for  
telnet it will have to be a custom login handler).  Once credentials  
are established, then it should be possible to limit the set of  
commands that are enabled for a user.  I am sure there is much more  
than can be done here too.  But at the moment, I've only planned to  
get a simple login implemented and have not done much more design of  
a richer model.


> -  will GShell share a common code path with the console and the CLI
> for handling things like deployment?

Yes, well... yes for the CLI, as I hope to eventually replace the  
existing CLI tools with command plugins into gshell, so they will be  
one and the same.  I am not really sure what the web console is  
doing, but we should definitely share as much as possible.... where  
possible.

It should be possible to define a simple interface (or set o  
interfaces) for each admin bit in the console... and provide a  
portlet and gshell command (or set of commands) to adapt to the  
interface.

I think this will be easy(ish) to do... more so once the webconsole  
is more xtensible/pluggbale, and when admin portlets are split up  
into modules that are specific to the function they provide.

It certainly would be nice to have one-to-one mappings for admin  
functionality between the webconsole and gshell commands... but there  
is still work on both sides before that would be possible... but it  
is kind of a longer term goal.


> -  which subsystems of geronimo will GShell depend on and how will it
> access them? e.g. will it be wrappered as a gbean and use the kernel
> to get access to them?  mainly I'm wondering if (unlike the console)
> it will be able to administer components running in the server without
> a having a run-time dependency against them.

Um, well I am in the process of writing a few simple GBeans to run/ 
manage the server components of GShell (the telnet/ssh server and the  
config and monitoring aspects that they bring in).  Short of that  
there are no dependencies on Geronimo.

I am thinking that a simple GBean to mange the start/stop of the  
server (ie, start/stop the telnet/ssh connector), which will manage  
the basic port config as well as the more advanced ssh config  
needed.  And then a simple portlet to control the gbean, to list who  
is logged in, maybe even allow sessions to be terminated and such.

May need to introduce some extra command sets which are G specific...  
or augment the script command to know more about the G namespace, so  
that we can register some more helpful variables to allow some  
meaningful/useful scripts to be written.

But, so far these are just ideas in my head... some with TODO  
comments in code... I have not had enough time to get anymore  
significant work done on gshell after the initial flurry of code I  
dropped in over a week or so.

I hope that once all this build muck is over and done with that I can  
get back into the GShell groove... clean it up and get it integrated  
into the server.

Anyways... ideas and suggestions are welcome :-)

--jason


Re: What is GShell?

Posted by Paul McMahan <pa...@gmail.com>.
OK I should have guessed that windows was the culprit. I jumped over
to debian and now all is fine.  GShell looks very promising!!  I love
the idea of being able to telnet or ssh into the server and run
commands remotely.  As a matter of fact this appears to provide a
vital improvement that Geronimo users have been asking for: the
ability to remotely administer a running server (see the "Swing
console?" thread from 9/17/2006).

A few questions :
-  what's the security model?
-  will GShell share a common code path with the console and the CLI
for handling things like deployment?
-  which subsystems of geronimo will GShell depend on and how will it
access them? e.g. will it be wrappered as a gbean and use the kernel
to get access to them?  mainly I'm wondering if (unlike the console)
it will be able to administer components running in the server without
a having a run-time dependency against them.

thanks,
Paul



On 10/3/06, Jason Dillon <ja...@planet57.com> wrote:
> I was playing with JTB support in the JavaCC plugin... JTB is a
> really cool simplified parser, but was written very, very, very
> poorly... the way it handles config and outputting files is a
> complete horrible mess, and I had to hack the JavaCC plugin up some
> to make it behave better.
>
> My guess is that it does not like... um, can you guess... windows :-
> P  Might need a few more hacks in the JTP mojo to get it working.
> But, I think I am going to give up on JTB and go back to JJTree which
> is a tad more complex but is not buggy.
>
> You can grab a pre-built dist here if you still want to check it out:
>
>      http://people.apache.org/~jdillon/
>
> --jason

Re: What is GShell?

Posted by Jason Dillon <ja...@planet57.com>.
I was playing with JTB support in the JavaCC plugin... JTB is a  
really cool simplified parser, but was written very, very, very  
poorly... the way it handles config and outputting files is a  
complete horrible mess, and I had to hack the JavaCC plugin up some  
to make it behave better.

My guess is that it does not like... um, can you guess... windows :- 
P  Might need a few more hacks in the JTP mojo to get it working.   
But, I think I am going to give up on JTB and go back to JJTree which  
is a tad more complex but is not buggy.

You can grab a pre-built dist here if you still want to check it out:

     http://people.apache.org/~jdillon/

--jason


On Oct 3, 2006, at 8:11 AM, Paul McMahan wrote:

> On 10/2/06, Jason Dillon <ja...@planet57.com> wrote:
>> (in one term)
>> svn co https://svn.apache.org/repos/asf/geronimo/sandbox/gshell/
>> trunk/ gshell
>> cd gshell/
>> setjdk 1.5
>> mvn
>
> Any idea what's up with the build failure shown below?  Looks like my
> classpath is somehow not getting set correctly for compiling the
> generated sources.
>
>
> [INFO]  
> ---------------------------------------------------------------------- 
> ---
> ---
> [INFO] Building GShell Core
> [INFO]    task-segment: [install]
> [INFO]  
> ---------------------------------------------------------------------- 
> ---
> ---
> [INFO] [tools:require-java-version {execution: default}]
> [INFO] [javacc:jtb {execution: jtb}]
> [INFO] Nothing to process - all grammars are up to date
> [INFO] [javacc:javacc {execution: jtb-javacc}]
> [INFO] Nothing to process - all grammars are up to date
> [INFO] [javacc:jjtree {execution: jjtree}]
> [INFO] Nothing to process - all grammars are up to date
> [INFO] [javacc:javacc {execution: jjtree-javacc}]
> [INFO] Nothing to process - all grammars are up to date
> [INFO] [antrun:run {execution: remove-overrides}]
> [INFO] Executing tasks
> [INFO] Executed tasks
> [INFO] [antrun:run {execution: move-to-package}]
> [INFO] Executing tasks
> [INFO] Executed tasks
> [INFO] [resources:resources]
> [INFO] Using default encoding to copy filtered resources.
> [INFO] [compiler:compile]
> Compiling 49 source files to c:\geronimo\gshell\trunk\gshell-core 
> \target\classes
>
> [INFO]  
> ---------------------------------------------------------------------- 
> --
> [ERROR] BUILD FAILURE
> [INFO]  
> ---------------------------------------------------------------------- 
> --
> [INFO] Compilation failure
>
> c:\geronimo\gshell\trunk\gshell-core\target\generated-sources\jtb 
> \org\apache\ger
> onimo\gshell\syntax\parser\SyntaxParserTokenManager.java:[8,0]  
> package org.apach
> e.geronimo.gshell.syntax.syntaxtree does not exist
>
> c:\geronimo\gshell\trunk\gshell-core\target\generated-sources\jtb 
> \org\apache\ger
> onimo\gshell\syntax\parser\SyntaxParser.java:[9,0] package  
> org.apache.geronimo.g
> shell.syntax.syntaxtree does not exist
>
> c:\geronimo\gshell\trunk\gshell-core\target\generated-sources\jtb 
> \org\apache\ger
> onimo\gshell\syntax\parser\SyntaxParser.java:[20,10] cannot find  
> symbol
> symbol  : class CommandLine
> location: class org.apache.geronimo.gshell.syntax.parser.SyntaxParser
>
> [ lots more errors like the ones above ]
>
> [INFO]  
> ---------------------------------------------------------------------- 
> --
> [INFO] For more information, run Maven with the -e switch
> [INFO]  
> ---------------------------------------------------------------------- 
> --
> [INFO] Total time: 16 seconds
> [INFO] Finished at: Tue Oct 03 11:03:17 EDT 2006
> [INFO] Final Memory: 13M/23M
> [INFO]  
> ---------------------------------------------------------------------- 
> --
> bash-3.1$


Re: What is GShell?

Posted by Paul McMahan <pa...@gmail.com>.
On 10/2/06, Jason Dillon <ja...@planet57.com> wrote:
> (in one term)
> svn co https://svn.apache.org/repos/asf/geronimo/sandbox/gshell/
> trunk/ gshell
> cd gshell/
> setjdk 1.5
> mvn

Any idea what's up with the build failure shown below?  Looks like my
classpath is somehow not getting set correctly for compiling the
generated sources.


[INFO] -------------------------------------------------------------------------
---
[INFO] Building GShell Core
[INFO]    task-segment: [install]
[INFO] -------------------------------------------------------------------------
---
[INFO] [tools:require-java-version {execution: default}]
[INFO] [javacc:jtb {execution: jtb}]
[INFO] Nothing to process - all grammars are up to date
[INFO] [javacc:javacc {execution: jtb-javacc}]
[INFO] Nothing to process - all grammars are up to date
[INFO] [javacc:jjtree {execution: jjtree}]
[INFO] Nothing to process - all grammars are up to date
[INFO] [javacc:javacc {execution: jjtree-javacc}]
[INFO] Nothing to process - all grammars are up to date
[INFO] [antrun:run {execution: remove-overrides}]
[INFO] Executing tasks
[INFO] Executed tasks
[INFO] [antrun:run {execution: move-to-package}]
[INFO] Executing tasks
[INFO] Executed tasks
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
Compiling 49 source files to c:\geronimo\gshell\trunk\gshell-core\target\classes

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure

c:\geronimo\gshell\trunk\gshell-core\target\generated-sources\jtb\org\apache\ger
onimo\gshell\syntax\parser\SyntaxParserTokenManager.java:[8,0] package org.apach
e.geronimo.gshell.syntax.syntaxtree does not exist

c:\geronimo\gshell\trunk\gshell-core\target\generated-sources\jtb\org\apache\ger
onimo\gshell\syntax\parser\SyntaxParser.java:[9,0] package org.apache.geronimo.g
shell.syntax.syntaxtree does not exist

c:\geronimo\gshell\trunk\gshell-core\target\generated-sources\jtb\org\apache\ger
onimo\gshell\syntax\parser\SyntaxParser.java:[20,10] cannot find symbol
symbol  : class CommandLine
location: class org.apache.geronimo.gshell.syntax.parser.SyntaxParser

[ lots more errors like the ones above ]

[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16 seconds
[INFO] Finished at: Tue Oct 03 11:03:17 EDT 2006
[INFO] Final Memory: 13M/23M
[INFO] ------------------------------------------------------------------------
bash-3.1$

Re: What is GShell?

Posted by Jason Dillon <ja...@planet57.com>.
On Oct 2, 2006, at 5:16 PM, David Blevins wrote:
> Sounds really cool.  Is there an easy way to boot it up and try it  
> out?

The Geronimo server integration is not completed yet, but to get the  
basic idea you can use the 'server' command to startup a telnet  
server from a regular gsh in a terminal:

(in one term)
svn co https://svn.apache.org/repos/asf/geronimo/sandbox/gshell/ 
trunk/ gshell
cd gshell/
setjdk 1.5
mvn
gunzip -c gshell-assemblies/gshell-complete-assembly/target/ 
gshell-1.0.0-SNAPSHOT-bin.tar.gz | tar xf -
./gshell-1.0.0-SNAPSHOT/bin/gsh
 > server

(in another term)
telnet localhost 5057
 > help commands

Use 'exit' to quit the telnet shell session.

* * *

There is a tiny bug in (something, not sure what) which cases the  
sexy jline history/buffer editing to drop in some extra backspace  
chars when in telnet mode that I have yet to track down.  Also  
something in telnet mode is blocking some chars (like CTRL-D) which  
prevents it from behaving.  I have not had a chance to work these  
buggers out... have not had much chance to work on GShell at all :-(

If you want to see the script bits, beanshell is included by default,  
and in a non-telnet session (like in the first shell where the server  
command was run), you can:

 > script -l beanshell
script(beanshell)> print("hi")

CTRL-D to exit out of the script(beanshell) sub-shell.

History, buffer editing and command tab-completion should all work as  
one might expect from the non-telnet.  History and buffer editing  
works with telnet, but for some reason tab completion is whack.  I  
hope that when I get to implement the ssh support that it will not  
suffer from the same issues that the telnet/nvt4j impl has.  I had  
used xbean-telnet for a short moment, but it did not set the right  
full unbuffered bits, so I switched to nvt4j.

Commands all support '-h' and '--help' so you can kinda see what they  
do.  I was starting to refactor the syntax parser bits and to fully  
support ${vars}, but had to switch gears to m2 other build stuff.  It  
kinda works now but the parser is buggy, so you can:

 > set a=b
 > echo ${a}
b
 > set
a=b
gshell.prompt=>

But due to the whacky parser, you can't really 'set  
gshell.prompt="some thing else"'.  But you can 'set  
gshell.prompt=foo>' (no quotes, the quoted string bits are whack at  
the moment).  When I whipped up the parser my JavaCC was like 5 years  
rusty or so.

Anyways, it is still a tad rough around the edges... I did whip most  
of this up in a week or so.

--jason

Re: What is GShell?

Posted by David Blevins <da...@visi.com>.
On Oct 2, 2006, at 12:01 AM, Jason Dillon wrote:

> I keep hearing this question... I thought I had put out enough  
> detail about GShell on the list months ago, but still there is some  
> mystery about it.  So I thought I would send out a simple terse  
> explanation that sums it up.
>
>  * * *
>
> GShell allows users to telnet into a running Geronimo server and  
> run some commands.
>
> It includes a 'script' command which allows an arbitrary script (in  
> any bsf supported language) to be executed... all _inside_ of  
> Geronimo.  Soon GShell will also support ssh (as soon as I can  
> figure out how to make Jsch work as a server).
>
> The framework to make the above command stuff work can also be used  
> to implement simple pluggable tools for command-line use... and I  
> would imagine that we could eventually change all of our command  
> line bits to run from it (perhaps all except the server command).   
> The nice thing here is that it is trivial to just "drop in" new  
> commands with out needing more platform scripts and with out having  
> to rewrite all of that icky main(String[]) handling muck... all  
> with sexy readline-like buffer editing/history and tab completion  
> (all of which provided by jline which kicks ass).
>
> Eventually GShell will have a full expression parser very similar  
> to Bash, but right now it is a tad primitive, but functional enough  
> for compound expressions and variable expansion.
>
> Okay, I gotta stop now or else this will turn into a novel...
>
> So, I hope that helps explain what the mysterious GShell is... if  
> not, let me know and I will revise my simple terse explanation so  
> that it does.
>
> Cheers,
>

Sounds really cool.  Is there an easy way to boot it up and try it out?

-David



> --jason
>