I was wondering if instead of creating a wrapper API to talk to LXD from remote servers, in order to implement some functionality I need, if it would make more sense to just add a command directly to LXD API instead.
If reasonable/feasible, where to start, documentation, where to start looking in the code, etc…
Thank you @tomp,
OK, so for the simplest parts first, I need some commands like:
“new-tenant” = lxc launch imagename containername
It needs to stop 2 containers (APP + DB).
Then edit the HAProxy config file or connect to the hap control plane API so it does this for you.
Create randomized credentials and apply to both ends.
Check if the command was successful.
Finally send an event or log to a DB whether the command was successful, etc.
“freeze” (tenant) command which is basically the same as:
lxc stop conatainername
Needs to stop 2 containers (APP + DB).
Then edit the HAProxy config file or connect to the hap control plane API so it does this for you.
Check if the command was successful.
Finally send an event or log to a DB whether the command was successful, etc.
Just 2 examples from a total of 15 or so commands / about 50-75 endpoints…
Initially single host, then clustered in a second phase.
The current design implements one command as several endpoints, here’s an example for the “freeze” command.
/v2.1/tenant/manage/freeze
Stops the APP and MySQL Containers for a specific tenant and accordingly adjust the HAP configuration.
/v2.1/tenant/manage/freeze/app
Stops the APP container for a specific tenant
/v2.1/tenant/manage/freeze/mysql
Stops the MySQL container for a specific tenant
/v2.1/tenant/manage/freeze/hap
Adjusts the HAP configuration for a specific container that is being frozen.
And if we want to keep things assynchronous…
/v2.1/tenant/manage/freeze/check/app
/v2.1/tenant/manage/freeze/check/mysql
/v2.1/tenant/manage/freeze/check/hap
Also, from a terminology perspective, LXD does have lxc freeze <instance> (an alias of lxc pause) that will freeze a running instance, but not stop it, allowing it to be resumed using lxc start <instance>.