#Connect to Dagger Shell websocket?

1 messages · Page 1 of 1 (latest)

granite shore
#

I'm not yet using zenith, it would be a bit of a big lift to migrate my pipelines, but I would really like to use the .Shell() call.

I see that it outputs a websocket address.... Is there any tooling I can use to connect to this address?

frank goblet
granite shore
#

Ah gotcha ok

frank goblet
#

a bit of a bummer I can't access the engineconn package or the conn from the Client so I can construct the WS the client myself from the SDK to actually be able to use that for the ssh access. cc @timber chasm @median lily

median lily
#

If we want to support this, we can add a session attachable for it, that way it will work with any SDK since the functionality will be in the CLI

#

I was waiting to see if anyone would actually ever end up wanting this before implementing it, I guess so 🙂

frank goblet
median lily
frank goblet
median lily
frank goblet
#

at least not in Go since the underlying conn or engineconn packages are private and I can't use the dialer to make my WS request

median lily
frank goblet
frank goblet
#

👍 .

#

was trying to see if I could highjack the connection from the GraphQLClient SDK client somehow but all the graphql types are also private 😬

median lily
frank goblet
median lily
frank goblet
granite shore
#

Cool I'll keep an eye out thanks!

drifting elbow
#

Sorry for bumping this. I'm also trying to connect to a shell but from the PHP SDK. I guess this is not possible yet ? My use case is getting a stream of stdout from a long running task

frank goblet
frank goblet
drifting elbow
#

Alright I managed to connect to the websocket endpoint. Here is the code :

  public function getWebsocketConnection(string $webSocketEndpoint): PromiseInterface
    {
        $endpoint = str_replace('dagger', '127.0.0.1:'.$this->port, $webSocketEndpoint);

        return WebsocketClient\connect($endpoint, headers: [
            'Origin' => 'http://dagger',
            'Authorization' => 'Basic '.base64_encode($this->sessionToken.':'),
        ]);

    }
frank goblet
granite shore
#

@drifting elbow - where did you get your session token? I see I can get this from a call to dagger session - but not sure which api to use internally to get it

granite shore
#

hmm I think I'm past the auth token, but still having issues finding how I can connect to the websocket endpoint - it doesn't appear exposed anywhere I can access

#

using engine/client package and .Dagger() call on client seems to work, but then I get stuck connecting ot websocket

#

Oh and worth mentioning I'm on 11.4 now and using .Terminal() - which seems to do the same thing

#

eyyoooooo got it working. certainly no niceties of a real terminal, but works.jpg.

gist

Thanks for coming to my ted talk (or more accurately - rubber duck session)

Gist

Creates an ubuntu container and then exec's into it. - dagger terminal.

left trellis