I wish to use Xterm.js to connect to a LXC container, however I am not really understanding the steps to connect this and how to do this via the API. Just looking at it makes my head spin…
Can anybody give me an idea on how I can implement this, what steps i must take etc?
I mean I dunno what your trying todo but I assume its executing commands on lots of containers, I built this the other weekend and may even more appropriate to either give some input on or a base for your research (it uses PHP and the exec API (but not xterm.js - its not needed) which i prefer to node everday)
Id be happy to give more specific guidance than look at my code but I dont know what your trying todo you’ll need to get more specific
I am scratching an itch, building a web app to manage linux containers, and simplifies the process.
As for the action series, i already have a queuing library part of my framework, which can handle that quite easily using success or error callbacks. It doesnt have to be complex. Unless you want to diagram it that is.
Same result, the terminal is not responsive, whatever I type does never give me any result.
Randomly I end up with "Error: Failed running forkconsole: “attaching to the container failed” but this happens on booth versions.
So the Socket is open and LXD can talk to xterm.js however xterm.js is not responsive at all.
Okay, but if the auth is not completed, why does LXD start send stuff like this:
“Error: Failed running forkconsole: “attaching to the container failed”
My brain went like the auth is fine, LXD is talking to the websocket.
I don’t have any other means to debug this since I did got no error message and apparently I forgot the part completely with the certificates.
From the looks of it, LXD seems to sending messages but never reacts or ignores messages send to the websocket endpoint.
Boot sequence and Shutdown sequence all come through however any input send to the websocket is ignored. Is there any specific format that it needs to be?
I see nothing in the documentation that does mention anything related to that.
edit: When sending messages in the shutdown/boot seq. the websocket gets terminated.
Is that normal? Usually it runs through.
I used /1.0/operations/{id}/websocket before
After switching to /1.0/operations/{id}/websocket?public it works without issues.
Since the auth runs over the secret.
Thanks @Wolfo-Gaming
However, still the issue ,that LXD seems to ignore the messages that are getting send to the LXD API.
Receiving is no issue, I tried sending just strings to binary formatted data as LXD is sending, however no success.
Anyone got an idea how to build the payload so, LXD does not ignore it? (javascript)
What it does for me, is properly closing the Attached Console if the Browser window is closed, happens apparently automatically which is neat. Without it, the Attached old Session stays open.
Im not currently seeing why you should have issues, by the way attachAddon is a way to attach a ws for i/o to xtermjs so adding xtermjs and ws listeners in not needed
Most of the code that i use is similar to what lxdmosaic does, i havent run tour code in my browser yet. i can try to make a working example but it will be diffcult since youre connecting straight through the browser wich seems weird to me because of lxd auth with certificates
@stgraber according to swagger, this Endpoint Swagger UI runs the auth over the secret instead/without the certificates. Is this correct?
@Wolfo-Gaming I am going to setup a nginx config as proxy and let it attach the certificates just for a test. Its wired since I still get output. Thanks.