Cloud-init scripts to setup your development environment

When you start writing Charmed Operators (AKA charms) one of the first tasks you have to perform is to set up your development environment.

If you are writing Kubernetes charms this task requires you to execute a lot of commands since at least you need a K8s instance up and running and a Juju controller that manages this instance.

And what if you want to use @ppasotti’s jhack? It needs to be installed and configured.

And if you want to use ZSH with @sed-i’s juju plugin so you have useful aliases and functions?? It needs to be installed and configured.

And if you want… It needs to be installed and configured.

Well, if want to do all this (and more) with only one command (well, three actually :stuck_out_tongue: ), this post is for you!

  1. Install Multipass:
    • sudo snap install multipass
      
  2. Clone this repo:
    • git clone https://github.com/Abuelodelanada/charm-dev-utils.git
      
  3. Launch the development environment of your choice:
    • multipass launch --cloud-init charm-dev-juju-3.0.yaml \
      --timeout 1200 \
      --name charm-dev-juju-3 \
      --mem 4G \
      --cpus 3 \
      --disk 30G \
      --mount /home/jose/trabajos/canonical/repos:/home/ubuntu/repos
      

And voilà, you have a VM with all you need to start developing Charmed Operators!

Now you can jump into the new VM:

$ multipass shell charm-dev-juju-3

Welcome to Ubuntu 22.04.1 LTS (GNU/Linux 5.15.0-52-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage


0 updates can be applied immediately.


*** System restart required ***
╭─ubuntu@charm-dev-juju-3 ~
╰─$
3 Likes

You actually can do it with one command because multipass now takes URLs:

multipass launch --cloud-init \
    https://raw.githubusercontent.com/Abuelodelanada/charm-dev-utils/main/cloud-init/charm-dev-juju-3.0.yaml
2 Likes

Hello mates!

I have upgraded the cloud-init scripts to create Multipass virtual machines for charm development!

Now we have 4 different flavors:

  • charm-dev-juju-3.1
  • charm-dev-juju-3.0
  • charm-dev-juju-2.9
  • charm-dev-juju--latest-edge

all running microk8s 1.26-strict and jhack stable!

Please take a look at: https://github.com/Abuelodelanada/charm-dev-utils

Happy charming!

2 Likes