LXD projects are a great way to separate machines to different project scopes. Here’s an example on bootstrapping juju to project “juju-proj” in LXD and deploying charms to another LXD project, “mymodel-proj”.
-
Create the lxc project juju and switch to it.
lxc project create juju-proj
lxc project switch juju-proj
-
Copy over the default profile from project default to the new project.
lxc profile show default --project default | lxc profile edit default
-
Bootstrap Juju to localhost LXD.
juju bootstrap localhost mycontroller --config "project=juju-proj"
-
Verify the controller was created.
lxc ls
juju status
-
Create a lxc project for the model and switch to it.
lxc project create mymodel-proj
lxc project switch mymodel-proj
-
Just like in step 2, copy over the default profile from project default to the new project.
lxc profile show default --project default | lxc profile edit default
-
Set the juju model and config to use mymodel-proj.
juju add-model mymodel --config "project=mymodel-proj"
Note: Using
juju model-config project=mymodel-proj
on existing models will not deploy charms to the project. -
Deploy a charm.
juju deploy apache2
-
Check juju status.
juju status
-
Switch to lxc project and check machines.
lxc project switch mymodel-proj && lxc ls
Reference
Launchpad: Add support for LXD projects
LXD Documentation: How to work with different projects