Redmine-operator docs - Development

This page serves to provide instructions on how to setup, change, and publish an update for the redmine-operator charm.

To test the deploy of the charm locally, use MicroK8s:

# Install/Setup MicroK8s    
     
$ sudo snap install --classic microk8s    
$ sudo usermod -aG microk8s $(whoami)    
$ sudo microk8s status --wait-ready    
$ sudo microk8s enable storage dns ingress    
$ sudo snap alias microk8s.kubectl kubectl    
$ newgrp microk8s    
     
# Install Charmcraft    
$ sudo snap install charmcraft    
     
# Install Juju 2.9+    
$ sudo snap install juju --classic    
     
# Bootstrap MicroK8s    
$ juju bootstrap microk8s micro    
$ juju add-model development    
     
# Build the charm and deploy    
$ git clone https://git.launchpad.net/~thogarre/+git/redmine-operator    
$ cd redmine-operator    
$ charmcraft pack    
$ juju deploy postgresql-k8s postgres    
$ juju deploy ./redmine_ubuntu-20.04-amd64.charm --resource redmine-image=bitnami/redmine:latest    
$ juju relate postgres:db redmine:db    

Debugging

Create a bash session to inspect the redmine container with:

$ kubectl exec --stdin --tty redmine-0 -n <namespace> -c redmine -- /bin/bash                                                                                                                                       

Publishing and Releasing a new version

See Juju | Publishing and Juju | Resources for additional documentation. As a short summary:

$ charmcraft login
$ charmcraft pack
$ chamcraft upload
# if a new resource has to be uploaded, such as the redmine image:
$ charmcraft upload-resource --image redmine:4.2 redmine-operator redmine-image
# get the image revision number from the output
$ charmcraft release redmine-operator --revision=$charm_revision --channel=$channel --resource=redmine-image:$image_revision
# be sure to also git commit/code review/push to the upstream source so the changes are in version control

If a new version of the OCI image is added as a resource, make sure to update the documentation so this new image can be mapped to the specific charm revision.