A repository to collect initiatives around making the life of a charm author easier.
Table of Contents
In the cloud-init directory you will find the following cloud-init scripts to launch reusable VMs to everyday charm development:
charm-dev-juju-4.0.yamlcharm-dev-juju-3.6.yaml
These script will create a VM with:
- juju (stable
4.0and3.6) - Canonical Kubernetes 1.35-classic/stable
- ZSH as a default SHELL with oh-my-zsh and juju theme with plugins:
- Pietro's amazing jhack tool.
- just
- goss + kgoss
Let's say you need to launch a VM using Multipass that runs juju 3.6/stable with:
- 4G RAM
- 3 CPUs
- 30G disk
- and mounting your
reposdirectory inside the ubuntu user home directory - an IP address provide
you may run:
multipass launch --cloud-init charm-dev-juju-3.6.yaml \
--timeout 1200 \
--name charm-dev-36 \
--memory 4G \
--cpus 3 \
--disk 30G \
--mount /home/jose/trabajos/canonical/repos:/home/ubuntu/repos \
--network enp1s0Once the VM is ready you will see:
Launched: charm-dev-36
Mounted '/home/jose/trabajos/canonical/repos' into 'charm-dev-36:/home/ubuntu/repos'
Now you can jump into the new VM:
multipass shell charm-dev-36Welcome to Ubuntu 24.04.1 LTS (GNU/Linux 6.8.0-51-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro
Expanded Security Maintenance for Applications is not enabled.
0 updates can be applied immediately.
Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status
Last login: Thu Jan 9 09:49:25 2025 from 10.169.97.1
╭─ubuntu@charm-dev-36 ~ [lxd:null]
╰─$And voilà, you have a VM with all you need to start developing Charmed Operators!
Let's say you need to launch a VM using LXD that runs juju 3.6/stable with:
- 4G RAM
- 3 CPUs
- 30G disk
- and mounting your
reposdirectory inside the ubuntu user home directory - an IP provided by the DHCP present in the host network
you need to run:
lxc init ubuntu:24.04 charm-dev-36 --vm \
-c limits.memory=4GB \
-c limits.cpu=3 \
-c cloud-init.user-data="$(cat charm-dev-juju-3.6.yaml)" \
-c environment.LXC_START_COMMAND="/bin/zsh --login -c 'su - ubuntu'" \
-s defaultlxc config device set charm-dev-36 root size=30GBlxc config device add charm-dev-36 repos disk \
source=/home/jose/trabajos/canonical/repos \
path=/home/ubuntu/reposlxc config device add charm-dev-36 eth0 nic \
nictype=bridged \
parent=br-enp1s0lxc start charm-dev-36Now you can jump into the new VM:
lxc exec charm-dev-36 -- su ubuntu
╭─ubuntu@charm-dev-36 /root [lxd:null]
╰─$And voilà, you have a VM with all you need to start developing Charmed Operators!
In the zsh_themes directory you will find a juju.zsh-theme that uses the juju plugin to show a prompt with juju information about controller and model.
