How to run LXD Demo Server with Clustering?

Hello, i’m trying to run a learning platform based on LXD Demo Server code, at this time my system already running, but it’s run on same machine with the LXD Host, meanwhile i want to run my system using this schema:

My question is, how to run LXD clustering and can i run LXD Demo Server using different machine
Thank you

It is pretty easy to do.

There is some documentation at Clustering - LXD documentation.

The documentation also links to a detailed YouTube tutorial on creating a LXD cluster.

I don’t see why running your LXD Demo Server on a different machine would be an issue. What exactly is the LXD Demo Server?

Hi @jarrodu thanks for your info

And this is what i mean about LXD Demo Server: https://github.com/lxc/lxd-demo-server

After looking at your link, I am not sure if you can run the demo server on another machine. I think I would start with the cluster and see if the demo server can run on one of the cluster nodes.

Could be wrong here as ive taken a quick 5 min glance, the frontend (HTML / JS) looks like it wont care if you cluster the backend. The backend (the go part) may work by default (but it doesn’t look intended to).

It looks like it connects over the Unix socket [0] to the host (so it assumes LXD running on the same server as the demo server), if you keep creating instances on a clustered host, LXD used to, distribute them across members of the cluster which means technically “yes you can”.

At a guess it will fail when the terminals start because LXD wont re-route the request to the right LXD server with the new instance (thats a guess it might work been a while since ive used clusters, which means this does work).

You are probably far better of writing something yourself, a clustered demo server seems extreme.

[0] https://github.com/lxc/lxd-demo-server/blob/6d54658066a3cd44885432d43adb78c06755794a/main.go#L154

That is what i mean @turtle0x1

Can i replace the “” with other endpoint, like “https://192.168.1.1:8443” or “wss://192.168.1.1:8443”?

You will need to use the method connectLXDHTTPS (or something im not a golang guy beyond reading really, I could if I was really interested / paid OFC)

I think this code probably serves as a good “base” but you’ll need to re-write a little to support clusters.

Couldn’t you just add more resources to a single node to support your use case? (vertical scale vs horizontal)

End users of the demo cant tell the difference (kinda, the socket might reveal that).

Ah i see, okay @turtle0x1 i think i can just set my demo server as part of the cluster, and then manually distribute instance, rather than let LXD to handle the distribution, so i can free up my demo server just for handling websocket and the other management things

Thanks @turtle0x1 and @jarrodu

Sounds like you’ve got the idea, sorry I couldn’t advise more specifically!

LXDMosaic might do some of what your needing, though its not supposed to be a “demo” (your actual use case isn’t well defined, and also - ill always throw out a cheap plug).

1 Like