By “Install LXC” do you mean install LXD? I assume that is the case, because you mention remotes and you reference the LXD documentation for token-based authentication.
So you are thinking of putting your application in a container. I believe this is generally a good idea. One reason for this is that you can port a container to another machine, so if you replace an Ubuntu 16.04 machine with an Ubuntu 22.04 machine (or Debian), you can then move your application to the new host without changing it.
My first question is how are you going to maintain changes to your application? LXD does not provide a direct mechanism to update an instance to a new image. But it makes it possible to do so, because of the attached disk devices feature, if you carefully separate the image from your data. You can put your application data in attached disk devices, which you can put in profiles. When you upgrade to a new image, you keep the existing profiles, so a new instance from the updated image has access to the existing application data. You can probably also do this for moving your camera devices to the new instances, with profiles, as you mentioned.
Another issue is distribution of your application image, which I assume is private. I have been looking into this too, and I think that LXD is lacking in this. My preference would be to find a tool that can create a simplestreams format for the images, which you can then secure with HTTPS Basic Auth, or something like this. I have collected a list of related topics:
- LXD: Looking for comprehensible description of simplestreams
- An actually **simple** simplestreams server
- Simplestreams generator
- GitHub - antifob/lxd-simplestreams: A simplestreams builder for LXD images
- Best practice create/share simplestreams from lxd image export
I haven’t used one of these tools/strategies yet. For now, I’m using rsync to send my exported images to each host. You could explore an LXD remote (public?) image server first.
I think it’s best to use a single image with profiles for different number of cameras. You can create these profiles on the fly with a script (create profile for N cameras).
I’m in favor of pre-installing packages in your own pre-built image, rather than using a stock base image that builds itself when it is instantiated. An image installs faster than individual packages, and it may use less bandwidth. More importantly, by pre-installing packages in your image, you make sure that you use exactly the same package versions everywhere. If you install packages in the instance, you may occasionally get different versions of packages. But I prefer running final configuration in the instance, so that it is easier to make configuration changes (without having to built a whole new image every time). You can distribute these configuration scripts separately from the image, via a git repository.
Using Ubuntu 16.04 with LXD is problematic, as 16.04 is quite old and I think there is some incompatibility in the LXD images built for it and images built for subsequent Ubuntu LTS versions. I can’t find a reference to this right now.