Skip to content
Erik Lönroth edited this page Apr 28, 2017 · 10 revisions

This tutorial covers basics of developing a juju charm with a "base layer".

A base layer is a kind of juju charm that could hold common functionality to many charms, perhaps package installations, deploys common code or simply performs actions you tend to repeat over many charms. It helps you repeat code which is nasty.

The layer will check that the package 'zip' is installed and if it is, write a log message with that information.

Make sure to complete the "hello-world" tutorial before starting this one.

Setup a fresh workspace

  • Create the needed directories

      mkdir -p ~/git/juju/{layers,charms,interfaces}
    
  • Clone the hello-world charm into your 'charms' directory. We are going to continue on this charm.

      cd ~/git/juju/charms
      git clone [email protected]:erik78se/hello-world.git
    
  • Create a new charm in the 'layers' directory. Name it 'flight-check'.

      cd ~/git/juju/layers
      charm-create flight-check
    
  • As we did in the hello-world tutorial, edit the README, metadata.yaml and create the hooks directory. cd ~/git/juju/layers/flight-check mkdir -p hooks cd hooks touch install start stop config-changed chmod +x install start stop config-changed

  • Validate that our new layer charm flight-check is all good. cd ~/git/juju/layers/ charm proof flight-check

Clone this wiki locally