Thanks, Ray,
Sometimes the obvious gets overlooked.
On Thu, 2020-02-13 at 09:40 -0500, Raymond Auge wrote:
> I'm not sure this is useful for you, but you say you are on a
> container
> platform. Have you tried to forward the port for gogo outside the
> container?
>
> For docker this is with the -p flag.
>
> e.g.
> -p <host_port1>:<container_port1> -p <host_port2>:<container_port2>
> -p ...
Yup, I completely forgot that I needed to publish the port. So, just to
recap, here is what I needed to do:
1. Add the correct bundles
"org.apache.felix/org.apache.felix.gogo.command/1.1.0",
"org.apache.felix/org.apache.felix.gogo.shell/1.1.2",
"org.apache.felix/org.apache.felix.gogo.runtime/1.1.2",
"org.apache.felix/org.apache.felix.shell.remote/1.2.0"
2. Instruct gogo to not open an interactive shell
-Dgosh.args="--nointeractive"
3. Instruct the remote shell to bind to all IPs
Since this is running in a container, we won't be connecting from
localhost, and I don't know the IP address beforehand.
-Dosgi.shell.telnet.ip="0.0.0.0"
This means that I am on my own regarding securing access if the port is
exposed.
4. Expose the port in the Dockerfile
EXPOSE 6666
5. Publish the port when running the application
$ docker run -p 6666 ....
Now I have a working remote shell without a TTY.
Thanks Ray and Bernd for you help.
Robert
> HTH
> - Ray
>
> On Thu, Feb 13, 2020 at 9:27 AM Robert Munteanu <[email protected]>
> wrote:
>
> > Hello Bernd,
> >
> > On Wed, 2020-02-12 at 20:22 +0000, Bernd Eckenfels wrote:
> > > Can you describe why you think you need a tty? What fails if you
> > > don't have one? Do use "karaf console" instead of "karaf start"?
> > > Do
> > > you have ansi.so load problems?
> >
> > Note - I don't use karaf, but instead the bundles I indicated in my
> > previous email.
> >
> > I think that it needs a TTY because as soon as I get the note that
> > the
> > framework has started, the application immediately starts shutting
> > down. Here's the message printed out:
> >
> > [INFO] Framework started
> > ____________________________
> > Welcome to Apache Felix Gogo
> >
> > g! gosh: stopping framework
> >
> >
> > I have associated that with a 'close' signal sent to the console
> > due to
> > no TTY being available. I may be wrong though, but I did not find a
> > solution.
> >
> > I did a bit of digging and found out that I can add
> >
> > -Dgosh.args="--nointeractive"
> >
> > to my startup script and then the container runs without the need
> > to
> > pas the it flags.
> >
> > However, even though the remote shell bundle is started, I am
> > unable to
> > telnet
> >
> > [FelixDispatchQueue] INFO E.B.org.apache.felix.gogo.runtime -
> > BundleEvent
> > STARTED
> > [FelixDispatchQueue] INFO E.B.org.apache.felix.shell.remote -
> > BundleEvent
> > RESOLVED
> > [FelixDispatchQueue] INFO E.B.org.apache.felix.shell.remote -
> > BundleEvent
> > STARTED
> >
> > $ telnet localhost 6666
> > Trying ::1...
> > telnet: connect to address ::1: Connection refused
> > Trying 127.0.0.1...
> > telnet: connect to address 127.0.0.1: Connection refused
> >
> > For reference, these are the bundles I am using
> >
> > "org.apache.felix/org.apache.felix.gogo.command/1.1.0",
> > "org.apache.felix/org.apache.felix.gogo.shell/1.1.2",
> > "org.apache.felix/org.apache.felix.gogo.runtime/1.1.2",
> > "org.apache.felix/org.apache.felix.shell.remote/1.2.0
> >
> > Thanks,
> > Robert
> >
> > > Gruss
> > > Bernd
> > >
> > >
> > > --
> > > http://bernd.eckenfels.net
> > > ________________________________
> > > Von: Robert Munteanu <[email protected]>
> > > Gesendet: Wednesday, February 12, 2020 11:26:32 AM
> > > An: [email protected] <[email protected]>
> > > Betreff: Gogo shell + telnet without a local TTY
> > >
> > > Hi,
> > >
> > > I am trying to open up access to the gogo shell via telnet
> > > without
> > > allocating a TTY.
> > >
> > > The problem with the TTY is that is there is none the shell will
> > > get
> > > an
> > > interrupt, therefore shutting down the OSGi framework. I am
> > > running
> > > on
> > > a container platform, so no much luck in getting that changed.
> > >
> > > I have tried by adding the following bundles:
> > >
> > > "org.apache.felix/org.apache.felix.gogo.command/1.1.0"
> > > "org.apache.felix/org.apache.felix.gogo.runtime/1.1.2"
> > > "org.apache.felix/org.apache.felix.shell.remote/1.2.0"
> > >
> > > Connecting via telnet results in a connection closed
> > >
> > > $ telnet localhost 6666
> > > Trying ::1...
> > > telnet: connect to address ::1: Connection refused
> > > Trying 127.0.0.1...
> > > Connected to localhost.
> > > Escape character is '^]'.
> > > Good Bye!
> > > Connection closed by foreign host.
> > >
> > > and an uncaught exception on the console for the app
> > >
> > > org.apache.felix.gogo.runtime.CommandNotFoundException: Command
> > > not
> > > found: gosh
> > > at
> > > org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:596
> > > )
> > > at
> > > org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.ja
> > > va:5
> > > 26)
> > > at
> > > org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415)
> > > at
> > > org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416)
> > > at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229)
> > > at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59)
> > > at
> > > java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264
> > > )
> > > at
> > > java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Threa
> > > dPoo
> > > lExecutor.java:1128)
> > > at
> > > java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Thre
> > > adPo
> > > olExecutor.java:628)
> > > at java.base/java.lang.Thread.run(Thread.java:834)
> > >
> > > Adding back the
> > > "org.apache.felix/org.apache.felix.gogo.shell/1.1.2"
> > > bundle fixes the issue, but requires an interactive TTY.
> > >
> > > I tried replacing the gogo shell bundle with
> > > org.apache.felix.shell,
> > > but that is not aware of the gogo commands, and is therefore not
> > > useful.
> > >
> > > I'm out of ideas at this point, so how can I use the gogo shell
> > > via
> > > telnet without a local TTY?
> > >
> > > Thanks,
> > > Robert
> > >
> > >
> > > ---------------------------------------------------------------
> > > ------
> > > To unsubscribe, e-mail: [email protected]
> > > For additional commands, e-mail: [email protected]
> > >
> >
> > -----------------------------------------------------------------
> > ----
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]